FAQ
Given the I have 3 documents with exactly one field and the fields have the following contents:
This is a moon
The moon is bright
moon

If I analyze these documents they all hit on "moon". But how do I need to analyze/search my index in order to have the following "sort order":
moon
The moon is bright
This is a moon

i.e. the earlier the term appears the higher the score.

Thx
Clemens

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

Search Discussions

  • Erick Erickson at May 4, 2011 at 11:50 am
    What is the problem you're trying to solve? I'm wondering if
    this is an XY problem. See:
    http://people.apache.org/~hossman/#xyproblem

    Best
    Erick
    On Wed, May 4, 2011 at 3:16 AM, Clemens Wyss wrote:
    Given the I have 3 documents with exactly one field and the fields have the following contents:
    This is a moon
    The moon is bright
    moon

    If I analyze these documents they all hit on "moon". But how do I need to analyze/search my index in order to have the following "sort order":
    moon
    The moon is bright
    This is a moon

    i.e. the earlier the term appears the higher the score.

    Thx
    Clemens

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Clemens Wyss at May 4, 2011 at 12:06 pm
    I try to be more specific:

    Given the three documents below.
    When I search for "moon", I'd like to get the follwoing order of my search result:

    moon
    The moon is bright
    This is a moon

    i.e. the "leftmost hit" of my search term should be rated highest/best...

    How should I analyze/search my documents to get this search/rating behavior?
    -----Ursprüngliche Nachricht-----
    Von: Erick Erickson
    Gesendet: Mittwoch, 4. Mai 2011 13:50
    An: java-user@lucene.apache.org
    Betreff: Re: Higher scoring if term is at the beginning of a field/document

    What is the problem you're trying to solve? I'm wondering if this is an XY
    problem. See:
    http://people.apache.org/~hossman/#xyproblem

    Best
    Erick
    On Wed, May 4, 2011 at 3:16 AM, Clemens Wyss wrote:
    Given the I have 3 documents with exactly one field and the fields have the
    following contents:
    This is a moon
    The moon is bright
    moon

    If I analyze these documents they all hit on "moon". But how do I need to
    analyze/search my index in order to have the following "sort order":
    moon
    The moon is bright
    This is a moon

    i.e. the earlier the term appears the higher the score.

    Thx
    Clemens

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

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Erick Erickson at May 4, 2011 at 12:35 pm
    I didn't ask a clear question. *Why* do you want to do this?
    What is the use-case you're trying to solve? Is relevance
    not what you want? Are you just experimenting?

    The statement of *what* you want to do is clear, but I don't know
    an easy to do that. Perhaps there's a better approach to solving
    the underlying need.

    Best
    Erick
    On Wed, May 4, 2011 at 8:06 AM, Clemens Wyss wrote:
    I try to be more specific:

    Given the three documents below.
    When I search for "moon", I'd like to get the follwoing order of my search result:

    moon
    The moon is bright
    This is a moon

    i.e. the "leftmost hit" of my search term should be rated highest/best...

    How should I analyze/search my documents to get this search/rating behavior?
    -----Ursprüngliche Nachricht-----
    Von: Erick Erickson
    Gesendet: Mittwoch, 4. Mai 2011 13:50
    An: java-user@lucene.apache.org
    Betreff: Re: Higher scoring if term is at the beginning of a field/document

    What is the problem you're trying to solve? I'm wondering if this is an XY
    problem. See:
    http://people.apache.org/~hossman/#xyproblem

    Best
    Erick

    On Wed, May 4, 2011 at 3:16 AM, Clemens Wyss <clemensdev@mysign.ch>
    wrote:
    Given the I have 3 documents with exactly one field and the fields have the
    following contents:
    This is a moon
    The moon is bright
    moon

    If I analyze these documents they all hit on "moon". But how do I need to
    analyze/search my index in order to have the following "sort order":
    moon
    The moon is bright
    This is a moon

    i.e. the earlier the term appears the higher the score.

    Thx
    Clemens

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

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Clemens Wyss at May 4, 2011 at 12:53 pm
    Ok, I got you ;)

    Besides my "real index" (which is being analyzed through a ShingleAnalyzerWrapper) I implicitly/transparently build up a "search term index" which I populate with the terms (being shingles) of my "real index". The "search term index" is being used to provide search term suggestions when the user types in a search term. E.g.
    if a user types:
    "moo"
    then I'd expect the following order of search term suggestions:
    "moon"
    "The moon..."
    "This is a moon"
    ...

    Thx
    Clemens
    -----Ursprüngliche Nachricht-----
    Von: Erick Erickson
    Gesendet: Mittwoch, 4. Mai 2011 14:35
    An: java-user@lucene.apache.org
    Betreff: Re: Higher scoring if term is at the beginning of a field/document

    I didn't ask a clear question. *Why* do you want to do this?
    What is the use-case you're trying to solve? Is relevance not what you want?
    Are you just experimenting?

    The statement of *what* you want to do is clear, but I don't know an easy to
    do that. Perhaps there's a better approach to solving the underlying need.

    Best
    Erick
    On Wed, May 4, 2011 at 8:06 AM, Clemens Wyss wrote:
    I try to be more specific:

    Given the three documents below.
    When I search for "moon", I'd like to get the follwoing order of my search result:
    moon
    The moon is bright
    This is a moon

    i.e. the "leftmost hit" of my search term should be rated highest/best...

    How should I analyze/search my documents to get this search/rating
    behavior?
    -----Ursprüngliche Nachricht-----
    Von: Erick Erickson
    Gesendet: Mittwoch, 4. Mai 2011 13:50
    An: java-user@lucene.apache.org
    Betreff: Re: Higher scoring if term is at the beginning of a
    field/document

    What is the problem you're trying to solve? I'm wondering if this is
    an XY problem. See:
    http://people.apache.org/~hossman/#xyproblem

    Best
    Erick

    On Wed, May 4, 2011 at 3:16 AM, Clemens Wyss
    <clemensdev@mysign.ch>
    wrote:
    Given the I have 3 documents with exactly one field and the fields
    have the
    following contents:
    This is a moon
    The moon is bright
    moon

    If I analyze these documents they all hit on "moon". But how do I
    need to
    analyze/search my index in order to have the following "sort order":
    moon
    The moon is bright
    This is a moon

    i.e. the earlier the term appears the higher the score.

    Thx
    Clemens

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

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

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Ahmet Arslan at May 4, 2011 at 2:38 pm
    Besides my "real index" (which is being analyzed through a ShingleAnalyzerWrapper) I implicitly/transparently build up a "search term index" which I populate with the terms (being shingles) of my "real index". The "search term index" is being used to provide search term suggestions when the user types in a search term. E.g.
    if a user types:
    "moo"
    then I'd expect the following order of search term suggestions:
    "moon"
    "The moon..."
    "This is a moon"


    So are these lucene documents? Are you contructing shingles outside of the lucene and index them? And issuing a PrefixQuery moo*?


    ---------------------------------------------------------------------
    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
postedMay 4, '11 at 7:28a
activeMay 4, '11 at 2:38p
posts6
users3
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase