java - Apache Solr - How to prevent splitting when searching phrases -
i have following fieldtype:
<fieldtype name="textfield" class="solr.textfield" positionincrementgap="100"> <analyzer type="index"> <charfilter class="solr.htmlstripcharfilterfactory"/> <tokenizer class="solr.whitespacetokenizerfactory"/> <filter class="solr.trimfilterfactory"/> <filter class="solr.lengthfilterfactory" min="3" max="30"/> <!-- in example, use synonyms @ query time <filter class="solr.synonymfilterfactory" synonyms="index_synonyms.txt" ignorecase="true" expand="false"/> --> <filter class="solr.stopfilterfactory" ignorecase="true" words="stopwords.txt" enablepositionincrements="true"/> <filter class="solr.lowercasefilterfactory"/> <filter class="solr.worddelimiterfilterfactory" generatewordparts="1" generatenumberparts="1" catenatewords="1" catenatenumbers="1" catenateall="0" splitoncasechange="1"/> <filter class="solr.snowballporterfilterfactory" language="english" protected="protwords.txt"/> <filter class="solr.removeduplicatestokenfilterfactory"/> </analyzer> <analyzer type="query"> <tokenizer class="solr.whitespacetokenizerfactory"/> <filter class="solr.lengthfilterfactory" min="3" max="30"/> <!--<filter class="solr.synonymfilterfactory" synonyms="synonyms.txt" ignorecase="true" expand="true"/>--> <filter class="solr.stopfilterfactory" ignorecase="true" words="stopwords.txt" enablepositionincrements="true"/> <filter class="solr.lowercasefilterfactory"/> <filter class="solr.trimfilterfactory" /> <filter class="solr.worddelimiterfilterfactory" generatewordparts="1" generatenumberparts="1" catenatewords="0" catenatenumbers="0" catenateall="0" splitoncasechange="1"/> <filter class="solr.snowballporterfilterfactory" language="english" protected="protwords.txt"/> </analyzer> </fieldtype>
the problem have when searching phrase using quotes, results same if there no quotes, if search let's say:
abc. 8
that'll show same results of
"abc. 8"
, period split text too?
in other words want search phrases when query text quoted. thx.
you've incorporated lengthfilterfactory
analyzer minimum length 3. token 8
has length 1, , eliminated both index , query filter. you're query syntax correct, , if both terms being indexed, phrase query performed you've specified.
Comments
Post a Comment