lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: How does lucene choose a field for sort?
Date Tue, 22 Nov 2005 00:05:55 GMT

On 21 Nov 2005, at 16:12, John Powers wrote:
> If I sort on a field called sequence, but at document creation time  
> I add in
>
> //create doc A
> doc.add(Field.Text("sequence", "32"));
> doc.add(Field.Text("sequence", "3"));
> doc.add(Field.Text("sequence", "932"));
>
> //create doc B
> doc.add(Field.Text("sequence", "1"));
> doc.add(Field.Text("sequence", "300"));
> doc.add(Field.Text("sequence", "50"));
>
> Which number does lucene use for the sort?

Neither.   It'll throw an exception.  The javadocs for Sort tell all:

	<http://lucene.apache.org/java/docs/api/org/apache/lucene/search/ 
Sort.html>

There needs to be a single term per document for any field used for  
sorting.

	Erik


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