The Solr suggester keeps its own dictionary of suggestions. How and when that dictionary is rebuilt decides whether autocomplete costs nothing or keeps a CPU core busy all day.
buildOnCommit rebuilds from the whole index
With DocumentDictionaryFactory, a build reads the stored field of every document in the index. buildOnCommit="true" starts such a build on every commit, and on a replica on every replication. If your application commits every few seconds, builds queue up and never finish.
Build on a schedule instead
Set buildOnCommit and buildOnStartup to false and trigger a build from a scheduled job, for example once a night, and only when the content changed.
<searchComponent name="suggest" class="solr.SuggestComponent"> <lst name="suggester"> <str name="name">default</str> <str name="lookupImpl">AnalyzingInfixLookupFactory</str> <str name="dictionaryImpl">DocumentDictionaryFactory</str> <str name="field">title</str> <str name="suggestAnalyzerFieldType">text_general</str> <str name="buildOnCommit">false</str> <str name="buildOnStartup">false</str> </lst> </searchComponent>
curl "https://YOUR-SERVER/solr/YOUR_INDEX/suggest?suggest.build=true&suggest.dictionary=default"
Do not send suggest.buildAll from frequent jobs
suggest.buildAll=true rebuilds every dictionary of the index. Sent from a cron that runs every few minutes, it is the same as rebuilding constantly.
Make sure the source field has data
A suggester built from a field that is empty still reads every document, and then returns nothing. Check how many documents carry the field before enabling the suggester.
One field, short values
Build suggestions from a short field such as a title, never from body text or rendered pages. If the index fails to reload with an infix suggester, see this error page.
Solr best practices
Suggesters that rebuild on every commit (this page)