FAQ
I just implemented a sorting feature on our application where the user can
change the sort on a query and reexecute the search. It works fine on
text fields where most of the documents have different field values.
However, on fields that are categories, that is, there are only four
distinct values for the category field and
all of the documents fit into a distinct category, the results are not in
the sorted values.

All of the sort fields are untokenized and stored. and each document has
only one value for the sorted field.

Are there any known issues (Lucene 2.3.0)? How can I go about debugging
this? I have tried Luke, also I have the Lucene source.

Bob Hastings
Ancept Inc.

Search Discussions

  • Erick Erickson at Jun 27, 2008 at 5:20 pm
    That's surprising. Could you post a brief example of your
    index and search code?

    It sounds like you're saying
    docs 1, 2, 3 all have category aaa
    docs 4, 5, 6 all have category bbb
    docs 7, 8, 9 all have category ccc

    But if you search for category:bbb
    you don't get docs 4, 5, and 6

    Is this a fair statement of the issue?

    Best
    Erick

    On Fri, Jun 27, 2008 at 11:44 AM, wrote:

    I just implemented a sorting feature on our application where the user can
    change the sort on a query and reexecute the search. It works fine on
    text fields where most of the documents have different field values.
    However, on fields that are categories, that is, there are only four
    distinct values for the category field and
    all of the documents fit into a distinct category, the results are not in
    the sorted values.

    All of the sort fields are untokenized and stored. and each document has
    only one value for the sorted field.

    Are there any known issues (Lucene 2.3.0)? How can I go about debugging
    this? I have tried Luke, also I have the Lucene source.

    Bob Hastings
    Ancept Inc.
  • Robert Hastings at Jun 27, 2008 at 6:48 pm
    Actually, I do a global search and the order comes out: 1, 2, 8, 3, 5, 6,
    7,8, 4, 9. I'm having trouble finding in the code where the sort actually
    gets applied. Can you help me out there?

    Bob




    "Erick Erickson" <erickerickson@gmail.com>
    06/27/2008 12:19 PM
    Please respond to
    java-user@lucene.apache.org


    To
    java-user@lucene.apache.org
    cc

    Subject
    Re: Sorting issues






    That's surprising. Could you post a brief example of your
    index and search code?

    It sounds like you're saying
    docs 1, 2, 3 all have category aaa
    docs 4, 5, 6 all have category bbb
    docs 7, 8, 9 all have category ccc

    But if you search for category:bbb
    you don't get docs 4, 5, and 6

    Is this a fair statement of the issue?

    Best
    Erick

    On Fri, Jun 27, 2008 at 11:44 AM, wrote:

    I just implemented a sorting feature on our application where the user can
    change the sort on a query and reexecute the search. It works fine on
    text fields where most of the documents have different field values.
    However, on fields that are categories, that is, there are only four
    distinct values for the category field and
    all of the documents fit into a distinct category, the results are not in
    the sorted values.

    All of the sort fields are untokenized and stored. and each document has
    only one value for the sorted field.

    Are there any known issues (Lucene 2.3.0)? How can I go about debugging
    this? I have tried Luke, also I have the Lucene source.

    Bob Hastings
    Ancept Inc.
  • Erick Erickson at Jun 27, 2008 at 6:59 pm
    I can't really help since I've never had to go into the guts of Lucene and
    see where sorting is applied, so I don't know where to point you <G>.

    But the sorting has always worked for me, and I don't remember anyone
    else posting a similar issue in the last year or so. Which means that
    the first thing I'd suspect is that something in your code.

    Which is why it would be helpful if you'd post some code snippets
    showing
    1> how you index your field
    2> how you construct your sort object
    3> how you search using your sort object

    Best
    Erick
    On Fri, Jun 27, 2008 at 2:46 PM, wrote:

    Actually, I do a global search and the order comes out: 1, 2, 8, 3, 5, 6,
    7,8, 4, 9. I'm having trouble finding in the code where the sort actually
    gets applied. Can you help me out there?

    Bob




    "Erick Erickson" <erickerickson@gmail.com>
    06/27/2008 12:19 PM
    Please respond to
    java-user@lucene.apache.org


    To
    java-user@lucene.apache.org
    cc

    Subject
    Re: Sorting issues






    That's surprising. Could you post a brief example of your
    index and search code?

    It sounds like you're saying
    docs 1, 2, 3 all have category aaa
    docs 4, 5, 6 all have category bbb
    docs 7, 8, 9 all have category ccc

    But if you search for category:bbb
    you don't get docs 4, 5, and 6

    Is this a fair statement of the issue?

    Best
    Erick

    On Fri, Jun 27, 2008 at 11:44 AM, wrote:

    I just implemented a sorting feature on our application where the user can
    change the sort on a query and reexecute the search. It works fine on
    text fields where most of the documents have different field values.
    However, on fields that are categories, that is, there are only four
    distinct values for the category field and
    all of the documents fit into a distinct category, the results are not in
    the sorted values.

    All of the sort fields are untokenized and stored. and each document has
    only one value for the sorted field.

    Are there any known issues (Lucene 2.3.0)? How can I go about debugging
    this? I have tried Luke, also I have the Lucene source.

    Bob Hastings
    Ancept Inc.
  • Robert Hastings at Jun 27, 2008 at 7:10 pm
    Thanks Eric,

    I did find the problem using Luke, I see that all of the documents have
    the same category field, so I must not be adding the field correctly when
    I index them.

    Bob

    Bob




    "Erick Erickson" <erickerickson@gmail.com>
    06/27/2008 01:58 PM
    Please respond to
    java-user@lucene.apache.org


    To
    java-user@lucene.apache.org
    cc

    Subject
    Re: Sorting issues






    I can't really help since I've never had to go into the guts of Lucene and
    see where sorting is applied, so I don't know where to point you <G>.

    But the sorting has always worked for me, and I don't remember anyone
    else posting a similar issue in the last year or so. Which means that
    the first thing I'd suspect is that something in your code.

    Which is why it would be helpful if you'd post some code snippets
    showing
    1> how you index your field
    2> how you construct your sort object
    3> how you search using your sort object

    Best
    Erick
    On Fri, Jun 27, 2008 at 2:46 PM, wrote:

    Actually, I do a global search and the order comes out: 1, 2, 8, 3, 5, 6,
    7,8, 4, 9. I'm having trouble finding in the code where the sort actually
    gets applied. Can you help me out there?

    Bob




    "Erick Erickson" <erickerickson@gmail.com>
    06/27/2008 12:19 PM
    Please respond to
    java-user@lucene.apache.org


    To
    java-user@lucene.apache.org
    cc

    Subject
    Re: Sorting issues






    That's surprising. Could you post a brief example of your
    index and search code?

    It sounds like you're saying
    docs 1, 2, 3 all have category aaa
    docs 4, 5, 6 all have category bbb
    docs 7, 8, 9 all have category ccc

    But if you search for category:bbb
    you don't get docs 4, 5, and 6

    Is this a fair statement of the issue?

    Best
    Erick

    On Fri, Jun 27, 2008 at 11:44 AM, wrote:

    I just implemented a sorting feature on our application where the user can
    change the sort on a query and reexecute the search. It works fine on
    text fields where most of the documents have different field values.
    However, on fields that are categories, that is, there are only four
    distinct values for the category field and
    all of the documents fit into a distinct category, the results are not in
    the sorted values.

    All of the sort fields are untokenized and stored. and each document
    has
    only one value for the sorted field.

    Are there any known issues (Lucene 2.3.0)? How can I go about
    debugging
    this? I have tried Luke, also I have the Lucene source.

    Bob Hastings
    Ancept Inc.
  • Erick Erickson at Jun 27, 2008 at 7:17 pm
    I can't count how many times I've said "It must be a bug
    in the compiler", but I *can* count how rarely I've been
    right <G>.

    Glad you're on a path to resolution.

    Erick
    On Fri, Jun 27, 2008 at 3:09 PM, wrote:

    Thanks Eric,

    I did find the problem using Luke, I see that all of the documents have
    the same category field, so I must not be adding the field correctly when
    I index them.

    Bob

    Bob




    "Erick Erickson" <erickerickson@gmail.com>
    06/27/2008 01:58 PM
    Please respond to
    java-user@lucene.apache.org


    To
    java-user@lucene.apache.org
    cc

    Subject
    Re: Sorting issues






    I can't really help since I've never had to go into the guts of Lucene and
    see where sorting is applied, so I don't know where to point you <G>.

    But the sorting has always worked for me, and I don't remember anyone
    else posting a similar issue in the last year or so. Which means that
    the first thing I'd suspect is that something in your code.

    Which is why it would be helpful if you'd post some code snippets
    showing
    1> how you index your field
    2> how you construct your sort object
    3> how you search using your sort object

    Best
    Erick
    On Fri, Jun 27, 2008 at 2:46 PM, wrote:

    Actually, I do a global search and the order comes out: 1, 2, 8, 3, 5, 6,
    7,8, 4, 9. I'm having trouble finding in the code where the sort actually
    gets applied. Can you help me out there?

    Bob




    "Erick Erickson" <erickerickson@gmail.com>
    06/27/2008 12:19 PM
    Please respond to
    java-user@lucene.apache.org


    To
    java-user@lucene.apache.org
    cc

    Subject
    Re: Sorting issues






    That's surprising. Could you post a brief example of your
    index and search code?

    It sounds like you're saying
    docs 1, 2, 3 all have category aaa
    docs 4, 5, 6 all have category bbb
    docs 7, 8, 9 all have category ccc

    But if you search for category:bbb
    you don't get docs 4, 5, and 6

    Is this a fair statement of the issue?

    Best
    Erick

    On Fri, Jun 27, 2008 at 11:44 AM, wrote:

    I just implemented a sorting feature on our application where the user can
    change the sort on a query and reexecute the search. It works fine on
    text fields where most of the documents have different field values.
    However, on fields that are categories, that is, there are only four
    distinct values for the category field and
    all of the documents fit into a distinct category, the results are not in
    the sorted values.

    All of the sort fields are untokenized and stored. and each document
    has
    only one value for the sorted field.

    Are there any known issues (Lucene 2.3.0)? How can I go about
    debugging
    this? I have tried Luke, also I have the Lucene source.

    Bob Hastings
    Ancept Inc.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedJun 27, '08 at 3:45p
activeJun 27, '08 at 7:17p
posts6
users2
websitelucene.apache.org

2 users in discussion

Erick Erickson: 3 posts Robert Hastings: 3 posts

People

Translate

site design / logo © 2022 Grokbase