I have a weird problem with the spellcheck suggestions of Solr.
I search for a term like this (a product-number for example): 08p17a6
With this term, i find documents in my index.
I have enabled spellcheck=true. So besides documents, solr also gives me a spellcheck suggestion in the xml response:
<lst name="spellcheck">
<lst name="suggestions">
<lst name="p17a6">
<int name="numFound">1</int>
<int name="startOffset">2</int>
<int name="endOffset">7</int>
<arr name="suggestion">
<str>08p17a6</str>
</arr>
</lst>
</lst>
</lst>
Solr takes of the first to numbers of my search term, and gives me a suggestion based on "p17a6". I don't understand why he cuts of the first two numbers for his suggestion.
Things will get more weird, if i enable spellcheck.collate:
<lst name="spellcheck">
<lst name="suggestions">
<lst name="p17a6">
<int name="numFound">1</int>
<int name="startOffset">2</int>
<int name="endOffset">7</int>
<arr name="suggestion">
<str>08p17a6</str>
</arr>
</lst>
<str name="collation">0808p17a6</str>
</lst>
</lst>
I need to use spellcheck.collate for suggestsions on multiple search terms. But as you can see, the xml response suggests me to use "0808p17a6".
Does anyone know how this happens?
Edit:
Here is my schema configuration regarding the spellcheck:
<field name="spell" type="textSpell" indexed="true" stored="false" multiValued="true" />
<copyField source="title" dest="spell" />
<copyField source="subTitle" dest="spell" />
<copyField source="content" dest="spell" />
The source fields of the copyfields are configured like this:
<field name="title" type="text" indexed="true" stored="true" termVectors="true" omitNorms="true" />
<field name="subTitle" type="text" indexed="true" stored="true" termVectors="true" omitNorms="true" />
<field name="content" type="text" indexed="true" stored="true" termVectors="true" />
This is the configuration for the analyzers:
<filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1"
generateNumberParts="1"
catenateWords="1"
catenateNumbers="1"
catenateAll="0"
splitOnCaseChange="1"
preserveOriginal="1"
/>
<!-- best practice (currently) for synonyms is to add them by
expansions during index time
-->
<filter class="solr.SynonymFilterFactory" synonyms="german/synonyms.txt" ignoreCase="true" expand="true"/>
<!-- Case insensitive stop word removal.
add enablePositionIncrements=true in both the index and query
analyzers to leave a 'gap' for more accurate phrase queries.
-->
<filter class="solr.StopFilterFactory" words="german/stopwords.txt" ignoreCase="true" enablePositionIncrements="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SnowballPorterFilterFactory" language="German2" protected="german/protwords.txt"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1"
generateNumberParts="1"
catenateWords="0"
catenateNumbers="0"
catenateAll="0"
splitOnCaseChange="1"
preserveOriginal="1"
/>
<filter class="solr.StopFilterFactory" words="german/stopwords.txt" ignoreCase="true" enablePositionIncrements="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SnowballPorterFilterFactory" language="German2" protected="german/protwords.txt"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldType>
<!-- Setup simple analysis for spell checking -->
<fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100" omitNorms="true">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="german/synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.StopFilterFactory" words="german/stopwords.txt" ignoreCase="true"/>
<filter class="solr.StandardFilterFactory" />
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory" />
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.StopFilterFactory" words="german/stopwords.txt" ignoreCase="true"/>
<filter class="solr.StandardFilterFactory" />
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldType>