lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phillip Rhodes <spamsu...@rhoderunner.com>
Subject indexing and searching the document title question
Date Tue, 27 Feb 2007 17:59:35 GMT
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message