![]() ![]() Edit this file and add the below code to enable SOLR for the Autosuggest. Navigate to your SOLR Instance and open the sitecore_sxa_master_index and open the solrconfig.xml file. Step 1 – Add and Configure the SuggesterComponent We followed the below steps for the implementation More Details on Solr Autosuggest are available on the official page – Our first point of reference for this was using the Sitecore Docs – This post draws heavily from the official sitecore documentation, but there are a few gotchas and typos on that page. With this blog post we aim to document the approach we used and the issues faced during implementation. The key feature in this search module was implemented using a Autosuggest using the SOLR AutoSuggest Module. User experience is enhanced because Json faceting API provides sub-second response, especially useful in (big) data-intensive applications that have global user base.Me and My teammate Sumit Upadhyay were recently working on a client requirement to implement a Search Module. Of course, service layer should intercept this API call and combine autocomplete results from several Solr fields into a single result set, that the UI displays to user. and obtain autocomplete results making a single API call. and you’d want to apply custom filter at each territory such as excluding documents/records that user isn’t supposed to view (think user auth security!)Ĭ. sales territories spread across 5 or more fields such as sales_territory_1, sales_territory_2, sales_territory_3 etc.ī. Above example is a simple use case, but what if we have a schema withĪ. ![]() There is an interesting analysis in Yonik Seeley’s blog on Solr facet performance. Performance implications: I can vouch that Json facet API wins hands down than usual approaches in Solr (refer to blogs at the start of this post).but we are interested in returning actual phrase in manu_exact # manu_exact_ci is the auto_complete text field that we search on. # which is a non-tokenized string field suitable for faceting. but we are interested in returning actual phrase name_id # name_ci is the auto_complete text field that we search on. example/exampledocs/*.xmlįind name of the product that has app infix and at the same timeįind manufacturer with the same infix app &rows=0&wt=json&indent=on& # Delete all the documents in techproducts colelction We need to re-index data for new schema changes to take effect.īetter to delete the documents in the collection and re-index as follows.confdir ~/solr-6.4.1/server/solr/configsets/sample_techproducts_configs/conf collection techproducts -confname techproducts \ zkcli.sh -cmd upconfig -zkhost localhost:2181 \ # Use the following zookeeper utility to upload the changed schema Use following zk scripts.Ĭd ~/solr-6.4.1/server/scripts/cloud-scripts If you are following previous blogs, ensure Zookeeper and Solr are up and running.Make changes to this files If you are following along the previous blogs, could simply ‘upload’ the changed schema to Solr using Zookeeper scripts. The techproducts schema is in ~/solr-6.4.1/server/solr/configsets/sample_techproducts_configs/conf/managed-schema, under Solr download directory.Name_id with type=”string” is created because Json faceting works best on string fields, we can also use docValues=true for single-values fields. Copy the content from ‘source field’ to newly created _ci fields.It means fields are standardized into single case, in this instance to lowercase. Because whether we search for ‘APPLE’ or ‘apple’, we intend to find ‘Apple’. Define name_ci and manu_exact_ci fields, _ci indicates case-insensitive.The Interesting point in this field type is NGramFilterFactory that allows to search phrases infix i:e in the middle of the phrase as opposed to the beginning of the phrase. Define a new field type text_autocomplete.Let us change techproducts schema to add name_id.In use cases I have come across, autocomplete feature is on non-tokenized string phrases and words rather than tokenized “text_general” fields. It’s important to note that Json Facteting works best on “string” type fields. What if we want to search several fields in a single API call and still take advantage of Json facet API? For example, in the techproducts collection can we search name and manu_exact fields for a term in one-go? If there are several fields to search simultaneously, it means there are more API calls originating from the UI and performance impacting on Solr cluster. Normally, autocomplete feature in Solr allows to ‘search’ single field. Thanks to the authors for listing various methods and techniques, I was able to improvise and create better way (in my view) using the latest Json facet API. There are several options to implement Autocomplete/Typeahead in Solr. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |