One solution is to amend our first use case by adding a leading wildcard to the query: Whereas, prediction wouldn’t occur in these cases: This means “my little pony” would appear when the user types: Match as a suggestion everything that contains the user’s phrase as a subphrase. In this this last case, our requirement now is: 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: 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. Indexing easily takes a day for site in the config for categories and &suggest.cfq=com to the query when applicable.In recent years, autocomplete has become a staple feature for searches of all types. The results of this approach are quite good, basically as specified except for some duplicate phrases because some keywords are duplicated because they have whitespaces at the beginning or end like "power cable" and "power cable ". Using the same fields, there are no search results for certain queries. searchterm cab results cable, cables, voltage cables, cable accessories, power cables. The second approach leads to a for me strange behaviour: Approach : BlendedInfixLookupFactory with custom field schema: Because of the FreeTextLookupFactory categories are not supported. I tried to combine this with a ShingleFilter, but this didn't work, probably because the ShingleFilter is already part of the FreeTextLookupFactory. searchterm Alex results Alexander, Alexandra. This works reasonable well, but delivers only single words. Approach : FreeTextLookupFactory config (no special schema changes): contextField only works with "AnalyzingInfixLookupFactory and BlendedInfixLookupFactory currently support this feature, when backed by DocumentDictionaryFactory." I tried three approaches 1. The suggestions must be filterable by category, we have the results of several domains in one index and the result should be filtered by a specific field containing the domain. The query should be caseinsensitive, Alex should have the same results as alex, but the searchresult (suggestions) must have the original case. The aim is to have phrases as suggestion and not entire fields or excerpts. Searchterm cab results cable, high voltage cable, cable cutter Searchterm Alex results Alexander Behling, Alexander Someone. I need a google like suggestions in a search box.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |