Ahhh... you put autoGeneratePhraseQueries="false" on the field - but it needs to be on the field type.

You can see from the parsed query that it generated the phrase.

-- Jack Krupansky

-----Original Message----- From: James Bathgate
Sent: Tuesday, July 02, 2013 5:35 PM
To: solr-user@lucene.apache.org
Subject: Re: Partial Matching in both query and field

Jack,

I've already tried that, here's my query:

<str name="debugQuery">on</str>
<str name="indent">on</str>
<str name="start">0</str>
<str name="q">0_extrafield1_n:20454</str>
<str name="q.op">OR</str>
<str name="rows">10</str>
<str name="version">2.2</str>

Here's the parsed query:

<str name="parsedquery_toString">0_extrafield1_n:"2o45 o454 2o454"</str>

Here's the applicable lines from schema.xml:

   <fieldType name="ngram" class="solr.TextField"
positionIncrementGap="100">
     <analyzer type="index">
       <tokenizer class="solr.WhitespaceTokenizerFactory"/>
       <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" enablePositionIncrements="true"/>
       <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
ignoreCase="true" expand="true"/>
       <filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1" catenateWords="1"
catenateNumbers="1" catenateAll="1" splitOnCaseChange="0"
splitOnNumerics="0" preserveOriginal="0"/>
       <filter class="solr.LowerCaseFilterFactory"/>
       <filter class="solr.PatternReplaceFilterFactory" pattern="0"
replacement="o" replace="all"/>
       <filter class="solr.PatternReplaceFilterFactory" pattern="1|l"
replacement="i" replace="all"/>
       <filter class="solr.NGramFilterFactory" minGramSize="4"
maxGramSize="16"/>
       <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
     </analyzer>
     <analyzer type="query">
       <tokenizer class="solr.NGramTokenizerFactory" minGramSize="4"
maxGramSize="16" />
       <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" enablePositionIncrements="true"/>
       <filter class="solr.PatternReplaceFilterFactory"
pattern="[^A-Za-z0-9]+" replacement="" replace="all"/>
       <filter class="solr.LowerCaseFilterFactory"/>
       <filter class="solr.PatternReplaceFilterFactory" pattern="0"
replacement="o" replace="all"/>
       <filter class="solr.PatternReplaceFilterFactory" pattern="1|l"
replacement="i" replace="all"/>
       <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
     </analyzer>
   </fieldType>

<dynamicField name="*_n" type="ngram" indexed="true" stored="true"
autoGeneratePhraseQueries="false" />


James


[image: SearchSpring | Findability Unleashed]

James Bathgate | Sr. Developer

Toll Free (888) 643-9043 x610 - Fax (719) 358-2027

4291 Austin Bluffs Pkwy #206 | Colorado Springs, CO 80918
www.searchspring.net       <http://www.searchspring.net>


On Tue, Jul 2, 2013 at 2:22 PM, Jack Krupansky <j...@basetechnology.com>wrote:

You will need to set q.op to "OR", and... use a field type that has the
autoGeneratePhraseQueries attribute set to "false".

-- Jack Krupansky

-----Original Message----- From: James Bathgate
Sent: Tuesday, July 02, 2013 5:10 PM
To: solr-user@lucene.apache.org
Subject: Partial Matching in both query and field


Given a string of "123456" and a search query "923459", what should the
schema look like to consider this a match because at least 4 consecutive in characters the query match 4 consecutive characters in the data? I'm trying
an NGramFilterFactory on the index and NGramTokenizerFactory on the query
in the schema, but that's not working.

I believe the problem is 'field:923459' is parsed as 'field:"9234 2345
3459"' instead of 'field:9234 field:2345 field:3459'.

[image: SearchSpring | Findability Unleashed]

James Bathgate | Sr. Developer

Toll Free (888) 643-9043 x610 - Fax (719) 358-2027

4291 Austin Bluffs Pkwy #206 | Colorado Springs, CO 80918
www.searchspring.net       <http://www.searchspring.net>


Reply via email to