Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wildcard search in Solr

I am having a problem doing wildcard searches in lucene syntax using the edismax handler. I have Solr 4.0 nightly build from the trunk.

A general search like 'computer' returns results but 'comer' doesn't return any results. Similary, a search like 'co?mput?r' returns no results. The only type of wildcard searches working currrently is ones with trailing wildcards(like compute? or comput).

I want to be able to do searches with wildcards at the beginning (puter) and in between (comer). Could someone please tell me what I am doing wrong and how to fix it.

Thanks.

Regards,
Imran.

like image 395
Imran Khan Avatar asked Jul 12 '10 14:07

Imran Khan


1 Answers

Leading wildcard won't work unless you activate the reverse string filter. To use it in Solr, add a ReversedWildcardFilterFactory to the analyzer of the field that you want to search with a leading wildcard.

As for your other queries that return 0 result, try using luke to see how your terms are being analyzed (stored in the index). Don't forget to take into account the effect of stemming, if you are using it.

like image 62
Pascal Dimassimo Avatar answered Sep 28 '22 10:09

Pascal Dimassimo