Solr wildcard query with whitespace and synonym -
this problem this:solr wildcard query whitespace have wildcard query looks like:
q=location:los a*
i'd match "los angeles" , "los altos". query like:
q=location:los\ a*
works fine, if have synonym logic:(synonym.txt)
los,las
and use "los l*" match "las lu".seems not work.how can this?
the filetype , file config:
<fieldtype name="ngram" class="solr.textfield" positionincrementgap="100"> <analyzer type="index"> <tokenizer class="solr.whitespacetokenizerfactory"/> <filter class="solr.worddelimiterfilterfactory" stemenglishpossessive="0" generatewordparts="0" generatenumberparts="0" catenatewords="1" catenatenumbers="0" catenateall="0" splitonnumerics="0" preserveoriginal="1"/> <filter class="solr.asciifoldingfilterfactory"/> <filter class="solr.synonymfilterfactory" synonyms="synonym.txt" ignorecase="true" expand="true"/> <filter class="solr.lowercasefilterfactory"/> <filter class="solr.edgengramfilterfactory" mingramsize="1" maxgramsize="25"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.whitespacetokenizerfactory"/> <filter class="solr.worddelimiterfilterfactory" stemenglishpossessive="0" generatewordparts="0" generatenumberparts="0" catenatewords="0" catenatenumbers="0" catenateall="0" splitonnumerics="0" preserveoriginal="1"/> <filter class="solr.asciifoldingfilterfactory"/> <filter class="solr.lowercasefilterfactory"/> </analyzer> </fieldtype>
<field name="location" type="ngram" indexed="true" stored="false"/>
you used solr.synonymfilterfactory
indexing not query analyzer so
when search "los l*"
looks terms starting los not "las". use analyzer query
add line query analyzer
<filter class="solr.synonymfilterfactory" synonyms="synonyms.txt" ignorecase="true" expand="true"/>
hope works
Comments
Post a Comment