lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andre Rubin" <andre.ru...@gmail.com>
Subject Sorting
Date Tue, 05 Aug 2008 19:14:33 GMT
Hi there!

I'm new to Lucene, so forgive any misconceptions on my part.

I created an Index and now I want to search on it based on a field.
The field is a String field and Field.Store.YES and
Field.Index.TOKENIZED. No problems with the search.

Now, I wanted to sort the results, and according to the Sort javadoc
the field "should not be tokenized". But I decided to try it anyway,
and it worked. However, the results showed that the tokens were
sorted, not the full string in the field.

Just to make myself more clear, here's an example. Let's say I have
these strings indexed:

"North Carolina"
"British Columbia"
"Canada"

Now I search (with sort) for the token 'c*'

The result I get is (sorted by the token found):

1) Canada
2) North Carolina
3) British Columbia

The result I wanted was (sorted by the whole String)"

1) British Columbia
2) Canada
3) North Carolina

Is there a way to do this?


Another option would be to sort the index itself, since this field is
the only field that we'd be searching on. But I'm just guessing here,
cause I have no idea if this is possible at all!

Thanks,


Andre

---------------------------------------------------------------------
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