lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aviran" <>
Subject RE: Sorting on a long string
Date Thu, 30 Sep 2004 13:40:26 GMT
When you index the keyword field (for sort), you'll probably need to lower
case  the term before indexing.

-----Original Message-----
From: Daly, Pete [] 
Sent: Thursday, September 30, 2004 7:38 AM
To: Lucene Users List
Subject: RE: Sorting on a long string

> How are you indexing the name field?  (code please :)

doc.add(Field.Text("name", name));

Based on Aviron's suggestion, if I index as a Keyword, the sort works fine.

> Normally random order?!  The natural (not using a Sort) order is by
> score (also called relevance).  Nothing random about it at all.  In 
> fact, this ordering is very special!  See the Javadocs on the 
> Similarity class for details of the formula.

Score makes sense then.  I didn't think about sort by score since I was
specifying a specific sort to use instead.

> No limitations that I know if.  Some bugs have been fixed, so be sure
> you're using Lucene 1.4.1, and not just 1.4, but please report back 
> with more details if this issue still occurs in 1.4.1.

Looks like switching to keyword is the solution.  Can someone describe what
abilities I would be losing by using Keyword instead of Text.  I am indexing
people's name, which are searched on my partial name quite a bit.  Can a
Keyword consisting of more than one "word" be searched on just as well as a
"Text" field, or do I need to index both ways in order to keep functionality
with sorting ability?

Thanks all for your help,


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message