With the help of this list, I solved a similar issue by altering my query as 
follows:

Before (did not return full word matches): q=searchTerm*
After (returned full-word matches and wildcard searches as you would expect): 
q=searchTerm OR searchTerm*

You can also boost the exact match by doing the following: q=searchTerm^2 OR 
searchTerm*

Not sure if the NGram changes things or not, but it might be a starting point.

Mike


-----Original Message-----
From: Arkadi Colson [mailto:ark...@smartbit.be] 
Sent: Friday, June 29, 2012 3:17 AM
To: solr-user@lucene.apache.org
Subject: NGram and full word

Hi

I have a question regarding the NGram filter and full word search.

When I insert "arkadicolson" into Solr and search for "arkadic", solr will find 
a match.
When searching for "arkadicols", Solr will not find a match because the 
maxGramSize is set to 8.
However when searching for the full word "arkadicolson" Solr will also not 
match.

Is there a way to also match full word in combination with NGram?

Thanks!

     <fieldType name="text" class="solr.TextField" 
positionIncrementGap="100">
       <analyzer type="index">
         <charFilter class="solr.HTMLStripCharFilterFactory"/>
         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
         <filter class="solr.StopFilterFactory" ignoreCase="true" 
words="stopwords_en.txt,stopwords_du.txt" enablePositionIncrements="true"/>
         <filter class="solr.WordDelimiterFilterFactory" 
generateWordParts="1" generateNumberParts="1" catenateWords="1" 
catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
         <filter class="solr.LowerCaseFilterFactory"/>
         <filter class="solr.SnowballPorterFilterFactory" 
language="Dutch" />
         <filter class="solr.NGramFilterFactory" minGramSize="3" 
maxGramSize="8"/>
       </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_en.txt,stopwords_du.txt" enablePositionIncrements="true"/>
         <filter class="solr.WordDelimiterFilterFactory" 
generateWordParts="1" generateNumberParts="1" catenateWords="0" 
catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
         <filter class="solr.LowerCaseFilterFactory"/>
         <filter class="solr.SnowballPorterFilterFactory" 
language="Dutch" />
       </analyzer>
     </fieldType>

--
Smartbit bvba
Hoogstraat 13
B-3670 Meeuwen
T: +32 11 64 08 80
F: +32 89 46 81 10
W: http://www.smartbit.be
E: ark...@smartbit.be

Reply via email to