![]() The idea is to add synonym token filter for the artist names so that the synonym token would be on the 0 position in the token stream. His example was: “I’ve heard that most babies can’t pronounce britney and she say something like ditney, so to make our product more successful among the baby searchers segment we must support this use case”. Bonus 1: Synonyms for suggestionsĪfter the “successful” release of the new functionality the very next day PM (under the usual influence of some exotic and probably illegal substances) once again came up with new idea: “in search suggestions we need to support variants of artist names”. How to combine those suggestions is out of scope for this post, but it should be implemented in your app. To support all of them at once you just need to add all the subfields into index and query all of them with multiple suggest clauses. SummaryĮvery separate use case is covered with a dedicated field. Note that the suggestion for “john e” also works. ![]() The idea is not to tokenize the string, reverse the string, tokenize the reversed string, and reverse the tokens once again. The hack would be to use char_filter to get rid of the first “entity”. For the indexing to achieve the required functionality with token filters would be complicated. Once again, we will leverage different index and search time analyzers. The implementation assumes that you have 2 entities. In other words we need to suggest text that starts after the separator. What about starting from the 3rd and 4th word? Could we just create a new subfield and change the script for the predicate_token_filter from token.position != 0 to token.position != 0 & token.position != 1 and so on? IMO, could work but there should be a “better” way. Do not forget to set preserve_position_increments as false for the new field. For search time analyzer we want to use a standard analyzers because we should not drop first token from the search string. For indexing we want an analyzer that drops the first token. The idea here is to have a subfield for suggestions that uses different analyzers for indexing and searching. Nothing fancy here, copy-paste from the documentation verbatim, for the sake of completeness. All examples are worked out and tested with version 8.4.1.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |