lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andre Rubin" <>
Subject Field sorting when same doc has multiple values for a field
Date Mon, 22 Dec 2008 22:13:01 GMT
Hi all,

Has anyone been through this issue?

I have documents that have one or more values for the same field. For example:

doc1 = new Document();
doc1.add(new Field("Letter"), "A", ...);
doc1.add(new Field("Letter"), "C", ...);
// doc1.add(other fields);
//write to index

Now I add another document:
doc2 = new Document();
doc2.add(new Field("Letter"), "B", ...);
//write to index

Now, when I query, sorting by "Letter" field, doc2 will return before
doc1. I think it is sorting by the last value added to the field
(therefore, B precedes C), but I cannot make any assumptions on the
order that I add the fields to my documents.

Is there a way to handle the sorting within a document as well,
instead of only among different documents? I wanted doc1 to be sorted
as if its "Letter" was "A" (lexicographic order).



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

View raw message