FAQ

On Jul 13, 2004, at 7:35 PM, MATL (Mats Lindberg) wrote:
when i index i use the Field.Text, do you mean that i should use
Field.Keyword instead
When you use Field.Text, the terms split out and actually indexed are
very likely numerous for that field. Sorting has no idea which term
you intend to sort on since there are multiple for that field.

So, yes, you should use Field.Keyword (or at least an untokenized field
- read the sorting Javadocs for more details) for fields you wish to
sort by.

Erik
Mats

-----Oprindelig meddelelse-----
Fra: MATL (Mats Lindberg)
Sendt: 14. juli 2004 01:32
Til: Lucene Users List
Emne: SV: lucene sort error - there are more terms than documents in
field ....

Hello.

I only have one term, this is the sample code (where sortfield is a
fields that has been indexed):

hits = searcher.search(query, new Sort(sortField, false));


you mention Field.Keyword, what is that.

Mats

-----Oprindelig meddelelse-----
Fra: Erik Hatcher
Sendt: 14. juli 2004 01:29
Til: Lucene Users List
Emne: Re: lucene sort error - there are more terms than documents in
field ....

On Jul 13, 2004, at 7:10 PM, MATL (Mats Lindberg) wrote:

Hello.

I am using:
import org.apache.lucene.search.Sort

when searching an index, but for some reasons, in some indexes i get
this error:

caught a class java.lang.RuntimeException with message: there are
more terms than documents in field <TheFieldIAmSortingBy>

does anybody know what causes this, or how to solve it.
You may only have a single term for each document. How is the field
indexed you're sorting by? Field.Keyword is the only guaranteed safe
one, and your analyzer will determine how the other fields are treated.

Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 3 | next ›
Discussion Overview
groupjava-user @
categorieslucene
postedJul 13, '04 at 11:32p
activeJul 14, '04 at 12:45a
posts3
users2
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase