Implementing multiterm ordered suggestions with Solr The same edge n-gram technique mentioned above can be applied on a single-word basis, with prefixes for each individual word stored as well. The user’s phrase also needs to be parsed into a set of words: ![]() Setting up the query to behave in this way isn’t hard: it requires every phrase to be split in the index. Whereas, prediction should not occur when the user types: The phrase, “my little pony” should now appear when the user types: Match as a suggestion everything that contains the user’s phrase as a subphrase. In this case, assume that our requirement changed to: Implementing multiterm unordered suggestions with Solr This approach has an obvious benefit in that a query that is powered with a larger index is not only simpler but also performs faster, in general. Let’s take “my little pony,” with this configuration as an example: Īcceptable partial search phrases would be: It requires storing every prefix for a given phrase in the index. ![]() In this case, we need the search to take into account every phrase in our index, as well as every partial phrase the user types in as a single term, and use KeywordTokenizer for the suggestion field: Īn alternative to using a wildcard query is the edge n-gram approach. However, prediction will not occur when the user types: If we have the “ my little pony” phrase in our index, it should show when the user types: Match as a suggest everything that starts exactly with the phrase _ Implementing single term suggestions with Solr Solr supports all three of these approaches via field type, which defines how data in a given field is interpreted and queried. The third method matches everything that contains a subphrase of the complete phrase as long as it’s in the correct order, i.e. ![]() This autocomplete method recognizes “shirts” as part of the phrase, like “men’s shirts,” and suggests it to the customer along with “women’s shirts,” “work shirts,” and other phrases that contain “men’s.” This method looks for the first letter, then the first word in a phrase, a search for “men’s shirts” must begin with “m,” then “men’s,” to bring up “men’s shirts” as a response. Solr, an open-source framework that powers many of the world’s most popular e-commerce sites and applications, supports three approaches to auto-complete implementation: Whether Google, Amazon, or smaller sites and vendors, predictive typing, as it’s otherwise known, (also sometimes called auto-suggest, search-as-you-type or type-ahead) has become an expected part of an engaging, user-friendly search experience. In recent years, autocomplete has become a staple feature for searches of all types.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |