similarity: generate and store various ngrams for document contents and search request, prepare learning features