Hi,
According to the FAQ, by indexing the title of the document and performing a 
search against the shorter field will automatically give it a higher weight 
than matches against the document content.  That is what I am trying to 
accomplish with a "NAME" field.  If someone enters a close match of the name of 
a document (example Names: "Color Me Mine" ,"Pittsburgh and Its Countryside"), 
I want that document to get a hit.  The search is user entered, so I want it to 
be case-insensitive.  I also don't want it to have to be an exact match.  
Search terms such as "Pittsburgh Countryside" should match up against a name of 
"Pittsburgh and Its Countryside".


Here I am adding the name field to my document:
String value= "Color Me Mine";
document.add(new Field("NAME", value, Field.Store.YES,
                                Field.Index.TOKENIZED));

Performing a search:
NAME:color me mine ->returns no results
NAME:color -> returns the document

I tried indexing the document without the value tokenized:
document.add(new Field("NAME", value, Field.Store.YES,
                                Field.Index.UN_TOKENIZED));

This caused the search to be case sensitive.

I am about to modify my indexing/searching code to use a secondary field, 
"name_lowercase", this field would of course contain the name of the object in 
lowercase and I would lowercase my search terms in I construct my TermQuery for 
this field.  

Is this a valid approach, or am I missing something?

Thanks!  




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to