开发者

solr synonyms not being parsed

I'm making an auto-suggest feature using past searches in solr. Synonyms.txt contains a list of common typos / misspellings etc. It's setup to run on index and using the anaysis tool in the admin I can see it's working correctly - however it doesn't seem to be applied to live data.

Field type :
<field name="suggest_ngrams" type="text_ngram" indexed="true" stored="false" multiValued="true" />

Schema:
<fieldType name="text_ngram" class="solr.TextField" positionIncrementGap="100">
 <analyzer type="index">
    <tokenizer class="solr.KeywordTokenizerFactory"/>
     &l开发者_JAVA技巧t;filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords_en.txt" enablePositionIncrement="true"/>
    <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
    <filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="15" side="front"/>
 </analyzer>
 <analyzer type="query">
<tokenizer class="solr.KeywordTokenizerFactory"/>   
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords_en.txt" enablePositionIncrement="true"/>
 </analyzer>

and an example of synonyms.txt
watch, watches, watche, watchs => watch

So at index time I would expect "watche" to be replaced with "watch" - this doesn't seem to be the case (even though the analysis tool says that's what it's doing.

To be clear if I query solr (?q=watc) the phrase "watche" appears in the results

Any ideas or insight would be appreciated as I think everything is setup correctly

Thanks


If I got the issue right :-
The synonyms are used only during index time and do not affect the stored values.
So what you see in the analysis is the index time values, which seem to work fine.
When you query solr and it matches this result, the results would return "watche" only, as this is the original value stored.
The stored values are never modified and are stored as is and returned in the response.

Please clarify if i got it wrong.


As @Jayendra described solr doesn't change stored value. Therefore you should find another way of handling this obstacle. In my case I come up with a solution using facet. If you facet on that field you receive the indexed value(Mapped).

Another solution is You can apply the filters to the data in a separate process prior to loading the data into Solr

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜