FAQ
I was trying to print out the score explanation by a DisjunctionMaxQuery.
Though there is a hit score > 0 for the results, there is no detailed
explanation. Am I doing something wrong?

In the following output, each hit has two lines. The first line is the hit
score and the second line is the explanation given by the
DisjunctionMaxQuery.

Hit 1: 0.6027994
0.0 = max plus 0.1 times others of:

Hit 2: 0.59990174
0.0 = max plus 0.1 times others of:

Hit 3: 0.41993123
0.0 = max plus 0.1 times others of:

Search Discussions

  • Chris Hostetter at Sep 19, 2006 at 7:26 pm
    : In the following output, each hit has two lines. The first line is the hit
    : score and the second line is the explanation given by the
    : DisjunctionMaxQuery.

    how are you printing the Explanation? .. are you using the toString()?

    can you post a small self contained code example showing how you got this
    output?

    : Hit 1: 0.6027994
    : 0.0 = max plus 0.1 times others of:
    :
    : Hit 2: 0.59990174
    : 0.0 = max plus 0.1 times others of:
    :
    : Hit 3: 0.41993123
    : 0.0 = max plus 0.1 times others of:




    -Hoss


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Find Me at Sep 19, 2006 at 7:35 pm
    public void explainSearchScore(String indexLocation, DisjunctionMaxQuery
    disjunctQuery){
    IndexSearcher searcher = new IndexSearcher(IndexReader.open
    (indexLocation));

    Hits hits = searcher.search(disjunctQuery);
    if(hits == null) return;

    for(int i = 0; i < hits.length(); i++){
    System.out.println("Hit " + i + " " +
    searcher.explain(disjunctQuery,
    i).toString());
    }
    }

    On 9/19/06, Chris Hostetter wrote:


    : In the following output, each hit has two lines. The first line is the
    hit
    : score and the second line is the explanation given by the
    : DisjunctionMaxQuery.

    how are you printing the Explanation? .. are you using the toString()?

    can you post a small self contained code example showing how you got this
    output?

    : Hit 1: 0.6027994
    : 0.0 = max plus 0.1 times others of:
    :
    : Hit 2: 0.59990174
    : 0.0 = max plus 0.1 times others of:
    :
    : Hit 3: 0.41993123
    : 0.0 = max plus 0.1 times others of:




    -Hoss


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

    --
    --Rajesh Munavalli
    Blog: http://munavalli.blogspot.com
  • Find Me at Sep 19, 2006 at 7:43 pm
    Forgot to add the hits.score() to print out the hits score.

    public void explainSearchScore(String indexLocation, DisjunctionMaxQuery
    disjunctQuery){
    IndexSearcher searcher = new
    IndexSearcher(IndexReader.open(indexLocation));

    Hits hits = searcher.search(disjunctQuery);
    if(hits == null) return;

    for(int i = 0; i < hits.length(); i++){
    System.out.println("Hit " + i + ": " + hits.score(i) +
    "\n" + searcher.explain(disjunctQuery, i).toString());
    }
    }

    Find Me wrote:
    public void explainSearchScore(String indexLocation,
    DisjunctionMaxQuery disjunctQuery){
    IndexSearcher searcher = new
    IndexSearcher(IndexReader.open(indexLocation));

    Hits hits = searcher.search(disjunctQuery);
    if(hits == null) return;

    for(int i = 0; i < hits.length(); i++){
    System.out.println("Hit " + i + " " +
    searcher.explain(disjunctQuery, i).toString());
    }
    }


    On 9/19/06, *Chris Hostetter* wrote:


    : In the following output, each hit has two lines. The first line
    is the hit
    : score and the second line is the explanation given by the
    : DisjunctionMaxQuery.

    how are you printing the Explanation? .. are you using the toString()?

    can you post a small self contained code example showing how you
    got this
    output?

    : Hit 1: 0.6027994
    : 0.0 = max plus 0.1 times others of:
    :
    : Hit 2: 0.59990174
    : 0.0 = max plus 0.1 times others of:
    :
    : Hit 3: 0.41993123
    : 0.0 = max plus 0.1 times others of:




    -Hoss


    ---------------------------------------------------------------------
    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
  • Chris Hostetter at Sep 19, 2006 at 7:55 pm
    The "i" you pass to Hits.score is the index of the result in that Hits
    object ... the "i" you pass to Searcher.explain should be the absolute
    docid (the searcher has no way of knowing about your Hits, or what order
    they are in).

    Try something like...

    searcher.explain(disjunctQuery, hits.doc(i)).toString()



    : Date: Tue, 19 Sep 2006 14:42:58 -0500
    : From: Find Me <findmath@gmail.com>
    : Reply-To: java-user@lucene.apache.org
    : To: Lucene Java Group <java-user@lucene.apache.org>
    : Subject: Re: DisjunctionMaxQuery explaination
    :
    : Forgot to add the hits.score() to print out the hits score.
    :
    : public void explainSearchScore(String indexLocation, DisjunctionMaxQuery
    : disjunctQuery){
    : IndexSearcher searcher = new
    : IndexSearcher(IndexReader.open(indexLocation));
    :
    : Hits hits = searcher.search(disjunctQuery);
    : if(hits == null) return;
    :
    : for(int i = 0; i < hits.length(); i++){
    : System.out.println("Hit " + i + ": " + hits.score(i) +
    : "\n" + searcher.explain(disjunctQuery, i).toString());
    : }
    : }
    :
    : Find Me wrote:
    : > public void explainSearchScore(String indexLocation,
    : > DisjunctionMaxQuery disjunctQuery){
    : > IndexSearcher searcher = new
    : > IndexSearcher(IndexReader.open(indexLocation));
    : >
    : > Hits hits = searcher.search(disjunctQuery);
    : > if(hits == null) return;
    : >
    : > for(int i = 0; i < hits.length(); i++){
    : > System.out.println("Hit " + i + " " +
    : > searcher.explain(disjunctQuery, i).toString());
    : > }
    : > }
    : >
    : >
    : > On 9/19/06, *Chris Hostetter* <hossman_lucene@fucit.org
    : > wrote:
    : >
    : >
    : > : In the following output, each hit has two lines. The first line
    : > is the hit
    : > : score and the second line is the explanation given by the
    : > : DisjunctionMaxQuery.
    : >
    : > how are you printing the Explanation? .. are you using the toString()?
    : >
    : > can you post a small self contained code example showing how you
    : > got this
    : > output?
    : >
    : > : Hit 1: 0.6027994
    : > : 0.0 = max plus 0.1 times others of:
    : > :
    : > : Hit 2: 0.59990174
    : > : 0.0 = max plus 0.1 times others of:
    : > :
    : > : Hit 3: 0.41993123
    : > : 0.0 = max plus 0.1 times others of:
    : >
    : >
    : >
    : >
    : > -Hoss
    : >
    : >
    : > ---------------------------------------------------------------------
    : > 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
    :



    -Hoss


    ---------------------------------------------------------------------
    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
postedSep 19, '06 at 7:21p
activeSep 19, '06 at 7:55p
posts5
users2
websitelucene.apache.org

2 users in discussion

Find Me: 3 posts Chris Hostetter: 2 posts

People

Translate

site design / logo © 2022 Grokbase