Sitecore’s auto-suggest feature for search in the Content Authoring environment is pretty slick, but there is some confusing documentation from Sitecore about how to set it up properly with Solr. As of today, Sitecore’s documentation on integrating with Solr indicates…
“When you implement Solr with Sitecore you need to enable term support in the Solr search handler. The term functionality is built into Solr but is disabled by default. To power the dropdowns in the UI you must enable the terms component.
That above documentation will be updated at some point by Sitecore, since it’s no longer the case for the latest version of Sitecore — 8.2 rev. 161221 (Update-2).
In earlier versions of Sitecore, search in the Sitecore Content Editor could make use of the Solr “terms” component to populate suggestions. This is why this guidance has previously been part of the Solr integration documentation from Sitecore. Read more about Solr’s use of this auto-suggest through terms at https://cwiki.apache.org/confluence/display/solr/The+Terms+Component.
Sitecore’s strategy of making use of the “terms” component has changed with recently, however. Sitecore now uses faceting with Solr instead of terms.
To prove this out, I’m going to turn to the Solr logs after I try some queries for content in the Sitecore client. Refer to this documentation from Sitecore if you’re looking for more context on how to use the search facility — there are a lot of features that are very under-utilized, in my experience. I’ll specify a clause by typing Updatedby: and then “siteco” to engage the auto-suggest feature:
Very nice, right?
Under the covers, the Solr logs will reveal something like this . . .
2017-02-17 19:33:07.546 INFO (qtp33171127-11) [ x:trial_core] o.a.s.c.S.Request [trial_core] webapp=/solr path=/select params={q=*:*&facet.field=parsedupdatedby_s&facet.prefix=siteco&rows=0&facet=true&version=2.2&facet.sort=true} hits=24626 status=0 QTime=2
. . . and that can be further debugged by turning it into the URL request powering that auto-suggest response . . .
. . . and that would return results like the following:
If instead we tried an author: search in Sitecore, for example, the facet.field would be parsedcreatedby_s instead of parsedupdatedby_s.
I don’t want to go too far down this rabbit hole. I really just wanted to share that despite what the documentation shows, it’s not necessary to enable the Solr term component on the /select requestHandler in Solr if you’re using the most recent version of Sitecore. I’ve confirmed with official Sitecore support that this change was tagged as change #444661 and that’s it was incorporated into the product since Sitecore 8.1 update-1 (rev. 151207); the release notes for 8.1 update-1 are vague, but here it is:
Autocomplete for known fields such as language did not work in the Content Editor Search tab using the SOLR provider. The problem was related to the SOLR server configuration. This has been fixed so that Sitecore no longer depends on this configuration. (444661)
Happy faceting to all!