how index words with their prefix in solr?

2019-03-03 21:55发布

问题:

I use solr 3.3 to index my files, I want solr index words with their suffixes for example I want to index colorful like color and when i search color solr show any document that has colorful.

回答1:

You would need to apply analysis on the field.

Stemming - Its a kind of dictionary. This would reduce the word indexed and searched to its roots.
e.g. color, colors, colored would match your searches, if any word is searched.

There was would be cases where the above stemming does not work.
You can use SynonymFilter, This allows you to specify words which you term as synonym and would match the search results.