autoGeneratePhraseQueries="false" and WordDelimiterFilterFactory
I'm new to solr. My solr instance version is:
Solr Specification Version: 3.1.0
Solr Implementation Version: 3.1.0 1085815 - grantingersoll - 2011-03-26 18:00:07 Lucene Specification Version: 3.1.0 Lucene Implementation Version: 3.1.0 1085809 - 2011-03-26 18:06:58 Current Time: Tue Apr 26 08:01:09 CEST 2011 Server Start Time:Tue Apr 26 07:59:05 CEST 2011I have following definition for textgen type:
<fieldType name="textgen" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="false">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" preserveOriginal="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="15" side="front" preserveOriginal="1"/>
<开发者_运维技巧/analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<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.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" preserveOriginal="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
I'm using this type for name field in my index. As you can see I'm using autoGeneratePhraseQueries="false" but for query sony vaio 4gb I'm getting following query in debug:
<lst name="debug">
<str name="rawquerystring">sony vaio 4gb</str>
<str name="querystring">sony vaio 4gb</str>
<str name="parsedquery">+name:sony +name:vaio +MultiPhraseQuery(name:"(4gb 4) gb")</str>
<str name="parsedquery_toString">+name:sony +name:vaio +name:"(4gb 4) gb"</str>
Do you have any idea how can I avoid this MultiPhraseQuery?
Robert Muir answered on solr user mailing list:
What do you have in solrconfig.xml for luceneMatchVersion?
If you don't set this, then its going to default to "Lucene 2.9" emulation so that old solr 1.4 configs work the same way. I tried your example and it worked fine here, and I'm guessing this is probably whats happening.
the default in the example/solrconfig.xml looks like this:
<!-- Controls what version of Lucene various components of Solr adhere to. Generally, you want to use the latest version to get all bug fixes and improvements. It is highly recommended that you fully re-index after changing this setting as it can affect both how text is indexed and queried. --> <luceneMatchVersion>LUCENE_31</luceneMatchVersion>
It worked for me.
精彩评论