You may want to take a very close look at what the WordDelimiterFilter
is doing. I believe the underscore is dropped entirely during indexing
AND searching as it's not alphanumeric.

Wiki doco here
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters?highlight=(t
okenizer)#head-1c9b83870ca7890cd73b193cefed83c283339089

The admin analysis page and query debug will help a lot to see what's
going on.

-Todd

-----Original Message-----
From: Stephen Weiss [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 27, 2008 10:32 PM
To: solr-user@lucene.apache.org
Subject: Question about textTight

Hi,

So I've been using the textTight field to hold filenames, and I've run  
into a weird problem.  Basically, people want to search by part of a  
filename (say, the filename is stm0810m_ws_001ftws and they want to  
find everything starting with stm0810m_ (stm0810m_*).  I'm hoping  
someone might have done this before (I bet someone has).

Lots of things work - you can search for stm0810m_ws_001ftws and get a  
result, or (stm 0810 m*), or various other combinations.  What does  
not work, is searching for (stm0810m_*) or (stm 0810 m_*) or anything  
like that - a problem, because often they don't want things with ma_  
or mx_, but just m_.  It's almost like underscores just break  
everything, escaping them does nothing.

Here's the field definition (it should be what came with my solr):

     <fieldType name="textTight" class="solr.TextField"  
positionIncrementGap="100" >
       <analyzer>
         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
         <filter class="solr.SynonymFilterFactory"  
synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
         <filter class="solr.StopFilterFactory" ignoreCase="true"  
words="stopwords.txt"/>
         <filter class="solr.WordDelimiterFilterFactory"  
generateWordParts="0" generateNumberParts="0" catenateWords="1"  
catenateNumbers="1" catenateAll="0"/>
         <filter class="solr.LowerCaseFilterFactory"/>
         <filter class="solr.EnglishPorterFilterFactory"  
protected="protwords.txt"/>
         <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
       </analyzer>
     </fieldType>

and usage:

    <field name="name" type="textTight"
           indexed="true" stored="true" omitNorms="true"
           />


Now, I thought textTight would be good because it's the one best  
suited for SKU's, but I guess I'm wrong.  What should I be using for  
this?  Would changing any of these "generateWordParts" or  
"catenateAll" options help?  I can't seem to find any documentation so  
I'm really not sure what it would do, but reindexing this whole thing  
will take quite some time so I'd rather know what will actually work  
before I just start changing things.

Thanks so much for any insight!

--
Steve

Reply via email to