FAQ
How easy is it to influence the score of search results in lucene 2.9?

The situation is that we have a large number of dated documents that
match the term "john" but we want to return the latest documents when
"john" is the search term.

My solution to this would be to override the score such that the score
is the number of days since 01/01/1970, the latest documents therefore
scoring the highest.

How is this possible in the lucene API?

Thanks

Greg

This message should be regarded as confidential. If you have received this email in error please notify the sender and destroy it immediately.
Statements of intent shall only become binding when confirmed in hard copy by an authorised signatory. The contents of this email may relate to dealings with other companies within the Detica Limited group of companies.

Detica Limited is registered in England under No: 1337451.

Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, England.

Search Discussions

  • Erick Erickson at May 12, 2010 at 5:22 pm
    Why wouldn't simply sorting by date descending work in this case? If
    you can detect the situation ahead of time that might be simpler.

    Do be aware that sorting by date has its own issues if you've stored
    the dates with very fine resolutions (e.g. seconds), but there are
    well-understood ways of dealing with this.

    Best
    Erick
    On Wed, May 12, 2010 at 1:04 PM, Gregory Tarr wrote:

    How easy is it to influence the score of search results in lucene 2.9?

    The situation is that we have a large number of dated documents that
    match the term "john" but we want to return the latest documents when
    "john" is the search term.

    My solution to this would be to override the score such that the score
    is the number of days since 01/01/1970, the latest documents therefore
    scoring the highest.

    How is this possible in the lucene API?

    Thanks

    Greg

    This message should be regarded as confidential. If you have received this
    email in error please notify the sender and destroy it immediately.
    Statements of intent shall only become binding when confirmed in hard copy
    by an authorised signatory. The contents of this email may relate to
    dealings with other companies within the Detica Limited group of companies.

    Detica Limited is registered in England under No: 1337451.

    Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP,
    England.
  • Ian Lea at May 13, 2010 at 10:24 am
    An alternative, if you want the date to influence rather than
    determine the score, is to use document boosting, with the boost value
    set small for old docs and high for new docs. You would probably need
    to play to find suitable values. One problem would be that a doc that
    is recent today will be somewhat older tomorrow.

    Another option, more complicated but very flexible, is to use CustomScoreQuery.


    --
    Ian.

    On Wed, May 12, 2010 at 6:21 PM, Erick Erickson wrote:
    Why wouldn't simply sorting by date descending work in this case? If
    you can detect the situation ahead of time that might be simpler.

    Do be aware that sorting by date has its own issues if you've stored
    the dates with very fine resolutions (e.g. seconds), but there are
    well-understood ways of dealing with this.

    Best
    Erick
    On Wed, May 12, 2010 at 1:04 PM, Gregory Tarr wrote:

    How easy is it to influence the score of search results in lucene 2.9?

    The situation is that we have a large number of dated documents that
    match the term "john" but we want to return the latest documents when
    "john" is the search term.

    My solution to this would be to override the score such that the score
    is the number of days since 01/01/1970, the latest documents therefore
    scoring the highest.

    How is this possible in the lucene API?

    Thanks

    Greg

    This message should be regarded as confidential. If you have received this
    email in error please notify the sender and destroy it immediately.
    Statements of intent shall only become binding when confirmed in hard copy
    by an authorised signatory.  The contents of this email may relate to
    dealings with other companies within the Detica Limited group of companies.

    Detica Limited is registered in England under No: 1337451.

    Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP,
    England.
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [email protected]
    For additional commands, e-mail: [email protected]

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedMay 12, '10 at 5:04p
activeMay 13, '10 at 10:24a
posts3
users3
websitelucene.apache.org

People

Translate

site design / logo © 2023 Grokbase