I'm using Solr 7.2.1, I'm implementing did you mean functionality using Solr spellchecker, I want the collation results to be relevant to a field, for example if I search with 'drive cay', the result will be 'drive cat' then 'drive car', of course the second option is more relevant to the user, but 'cat' word exists in the index more than 'car' so it shows first.
I need the collation that its words together occur more in a field like title field for example.
<!-- a spellchecker built from a field of the main index -->
<lst name="spellchecker">
<str name="name">default</str>
<str name="field">title_t</str>
<str name="classname">solr.DirectSolrSpellChecker</str>
<!-- the spellcheck distance measure used, the default is the internal levenshtein -->
<str name="distanceMeasure">internal</str>
<!-- minimum accuracy needed to be considered a valid spellcheck suggestion -->
<float name="accuracy">0.5</float>
<!-- the maximum #edits we consider when enumerating terms: can be 1 or 2 -->
<int name="maxEdits">2</int>
<!-- the minimum shared prefix when enumerating terms -->
<int name="minPrefix">0</int>
<!-- maximum number of inspections per result. -->
<int name="maxInspections">5</int>
<!-- minimum length of a query term to be considered for correction -->
<int name="minQueryLength">3</int>
<!-- maximum threshold of documents a query term can appear to be considered for correction -->
<float name="maxQueryFrequency">0.00</float>
<!-- uncomment this to require suggestions to occur in 1% of the documents -->
<float name="thresholdTokenFrequency">0.00001</float>
</lst>
<requestHandler name="/spell" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<!-- Solr will use suggestions from both the 'default' spellchecker
and from the 'wordbreak' spellchecker and combine them.
collations (re-written queries) can include a combination of
corrections from both spellcheckers -->
<str name="spellcheck.dictionary">default</str>
<str name="spellcheck">on</str>
<str name="df">title_t</str>
<str name="spellcheck.extendedResults">true</str>
<str name="spellcheck.count">10</str>
<str name="spellcheck.alternativeTermCount">5</str>
<str name="spellcheck.maxResultsForSuggest">5</str>
<str name="spellcheck.collate">true</str>
<str name="spellcheck.collateExtendedResults">true</str>
<str name="spellcheck.maxCollationTries">10</str>
<str name="spellcheck.maxCollations">5</str>
<str name="spellcheck.build">true</str>
</lst>
<arr name="last-components">
<str>spellcheck</str>
</arr>
Lookup Implementations
of suggester (ways how suggester find relevant results). For example you can setup suggester withFuzzyLookupFactory
instead of spellchecker. Read more about suggester lookup implementations here: lucene.apache.org/solr/guide/6_6/suggester.html#Tips_and_tricks