FAQ
Hi Everyone,

I am very new to Lucene and am trying to perform a sort on a field
containing strings. I get the error message:

there are more terms than documents in field <my sort field>

I have read through the same problem in the user group archives and the
replies usually ask the person if they are trying to sort on a tokenised
field, however, I can't see any further correspondence to say whether
they were or not and if they found a solution.

I create my index as below, where field is the field name I am trying to
sort and sortvalue is the text content of the field. From what I have
read, I think this is creating an index field which is stored but not
tokenised:

doc.add(Field.Keyword(field, sortvalue));

Does anyone know how to look into this problem further or can point me
in the direction of a solution?

Many thanks in anticipation,

Beverley Taylor

Search Discussions

  • Dblanch at Nov 23, 2005 at 3:39 pm
    I think you are doing it right. Fields used for sorting must be Keyword
    type. See you are not adding the Field more than once for the same
    Document.

    -----"Taylor, BE \(Beverley\)" <b.e.taylor@dl.ac.uk> escribió: -----


    Para: <java-user@lucene.apache.org>
    De: "Taylor, BE \(Beverley\)" <b.e.taylor@dl.ac.uk>
    Fecha: 23/11/2005 16:04
    Asunto: there are more terms than documents in field <my sort field>

    Hi Everyone,

    I am very new to Lucene and am trying to perform a sort on a field
    containing strings. I get the error message:

    there are more terms than documents in field

    I have read through the same problem in the user group archives and the
    replies usually ask the person if they are trying to sort on a tokenised
    field, however, I can't see any further correspondence to say whether
    they were or not and if they found a solution.

    I create my index as below, where field is the field name I am trying to
    sort and sortvalue is the text content of the field. From what I have
    read, I think this is creating an index field which is stored but not
    tokenised:

    doc.add(Field.Keyword(field, sortvalue));

    Does anyone know how to look into this problem further or can point me
    in the direction of a solution?

    Many thanks in anticipation,

    Beverley Taylor


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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedNov 23, '05 at 3:15p
activeNov 23, '05 at 3:39p
posts2
users2
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase