Reputation: 1
I am using Solr with Solarium and I am trying to implement searching for different words with the same meaning. For example, if a user searched for photo, it would also return results for photograph and photographs.
I have tried Implementing Hunspell and Snowball Filter Factory. Both seem to take care of plural instances of words.
Here is the entry from my schema:
<fieldType name="text_general" class="solr.TextField" multiValued="true" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.SynonymFilterFactory" expand="true" synonyms="synonyms.txt" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.HunspellStemFilterFactory" dictionary="en_US.dic" affix="en_US.aff" ignoreCase="true" />
</analyzer>
Thanks!
Upvotes: 0
Views: 603
Reputation: 71
In stemming, the word is reduced into word stem or the root form. You have already used SnowballPorterFilterFactory and HunspellStemFilterFactory and can try PorterStemFilterFactory, KStemFilterFactory and EnglishMinimalStemFilter in solr. Stemming filters can't handle synonyms. If you want to search different words with the same meaning, you have to use stopfilterfactory in solr and add possible synonym words to the sysnoyms.txt. Replacement synonyms, one-way expansion synonyms and multiway expansion synonyms can be defined there.
Upvotes: 0