FAQ
Hi,

My documents contain a field called SORT_ID, which contains an int that
increases with every document added to the index. I want my results to be
sorted by it.

Which approach will prove the best performance:

1) Zero pad SORT_ID field and sort by it as plain text.
2) Sort using SortField for an INT.
3) Trust that using INDEXORDER will always return the same order as SORT_ID,
and use that.


Thanks,
Oren Shir

Search Discussions

  • Erik Hatcher at Nov 1, 2005 at 11:16 am

    On 1 Nov 2005, at 06:03, Oren Shir wrote:

    Hi,

    My documents contain a field called SORT_ID, which contains an int
    that
    increases with every document added to the index. I want my results
    to be
    sorted by it.

    Which approach will prove the best performance:

    1) Zero pad SORT_ID field and sort by it as plain text.
    2) Sort using SortField for an INT.
    3) Trust that using INDEXORDER will always return the same order as
    SORT_ID,
    and use that.
    #3 - to sort by order indexed, there is no need to have a custom
    incrementing field. I'd recommend dropping SORT_ID unless you need
    it for some other purpose.

    Erik


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Michael D. Curtin at Nov 1, 2005 at 1:15 pm

    Oren Shir wrote:

    My documents contain a field called SORT_ID, which contains an int that
    increases with every document added to the index. I want my results to be
    sorted by it.

    Which approach will prove the best performance:

    1) Zero pad SORT_ID field and sort by it as plain text.
    2) Sort using SortField for an INT.
    3) Trust that using INDEXORDER will always return the same order as SORT_ID,
    and use that.
    My experience is that #3 works very well in terms of performance, much
    better than sorting on any arbitrary field. I haven't ever noticed a
    problem with it not working. Good luck!

    --MDC

    ---------------------------------------------------------------------
    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 1, '05 at 11:04a
activeNov 1, '05 at 1:15p
posts3
users3
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase