Examples of explain()


Examples of org.apache.lucene.search.IndexSearcher.explain()

    q.add(new Term[] {new Term("body", "nope"), new Term("body", "nope")});
    assertEquals("Wrong number of hits", 0,
        searcher.search(q, null, 1).totalHits);
   
    // just make sure no exc:
    searcher.explain(q, 0);
   
    writer.close();
    searcher.close();
    reader.close();
    indexStore.close();
View Full Code Here

Examples of org.apache.lucene.search.Rescorer.explain()

    assertEquals(3, hits.totalHits);
    assertEquals("2", r.document(hits.scoreDocs[0].doc).get("id"));
    assertEquals("1", r.document(hits.scoreDocs[1].doc).get("id"));
    assertEquals("3", r.document(hits.scoreDocs[2].doc).get("id"));

    String expl = rescorer.explain(searcher,
                                   searcher.explain(query, hits.scoreDocs[0].doc),
                                   hits.scoreDocs[0].doc).toString();

    // Confirm the explanation breaks out the individual
    // variables:
View Full Code Here

Examples of org.apache.lucene.search.Scorer.explain()

   */
  public void testSpanNearScorerExplain() throws Exception {
    SpanNearQuery q = makeQuery();
    Weight w = q.createWeight(searcher);
    Scorer s = w.scorer(searcher.getIndexReader());
    Explanation e = s.explain(1);
    assertTrue("Scorer explanation value for doc#1 isn't positive: "
               + e.toString(),
               0.0f < e.getValue());
  }
 
View Full Code Here

Examples of org.apache.lucene.search.Searcher.explain()

      );
    }
    try {
      org.apache.lucene.search.Query query = filterQueryByClasses( luceneQuery );
      buildFilters();
      explanation = searcher.explain( query, documentId );
    }
    catch ( IOException e ) {
      throw new HibernateException( "Unable to query Lucene index and build explanation", e );
    }
    finally {
View Full Code Here

Examples of org.apache.lucene.search.Weight.explain()

    final Query query = npq("renaud", "delbru").getLuceneProxyQuery();

    final Weight w = query.createWeight(searcher);

    // Explain entity 0 : 1 match
    Explanation explanation = w.explain((AtomicReaderContext) reader.getContext(), 0);
    assertNotNull("explanation is null and it shouldn't be", explanation);

//    final Similarity sim = searcher.getSimilarity();
    // TODO: The similarity is randomly set
//     System.out.println("Explanation: " + explanation.toString());
View Full Code Here

Examples of org.apache.lucene.search.Weight.explain()

//    //All this Explain does is return the term frequency
//    assertEquals("term frq is not 1",
//      sim.tf(1), explanation.getDetails()[1].getDetails()[0].getValue(), 0.01);

    // Explain entity 1 : 2 match
    explanation = w.explain((AtomicReaderContext) reader.getContext(), 1);
    assertNotNull("explanation is null and it shouldn't be", explanation);
    // TODO: The similarity is randomly set
//     System.out.println("Explanation: " + explanation.toString());
//    //All this Explain does is return the term frequency
//    assertEquals("term frq is not 2",
View Full Code Here

Examples of org.apache.lucene.search.Weight.explain()

//    //All this Explain does is return the term frequency
//    assertEquals("term frq is not 2",
//      sim.tf(2), explanation.getDetails()[1].getDetails()[0].getValue(), 0f);

    // Explain non existing entity
    explanation = w.explain((AtomicReaderContext) reader.getContext(), 2);
    assertNotNull("explanation is null and it shouldn't be", explanation);
//    System.out.println("Explanation: " + explanation.toString());
    //All this Explain does is return the term frequency
    assertEquals("term frq is not 0", 0f, explanation.getValue(), 0f);
  }
View Full Code Here

Examples of org.apache.lucene.search.Weight.explain()

    final Weight w = searcher.createNormalizedWeight(query);
    assertTrue(searcher.getTopReaderContext() instanceof AtomicReaderContext);
    final AtomicReaderContext context = (AtomicReaderContext) searcher.getTopReaderContext();

    // Explain entity 0
    Explanation explanation = w.explain(context, 0);
    assertNotNull("explanation is null and it shouldn't be", explanation);

    // TODO: the similarity is random
    // All this Explain does is return the term frequency
//    final float termFreq = explanation.getDetails()[0].getDetails()[0].getValue();
View Full Code Here

Examples of org.apache.lucene.search.Weight.explain()

    // All this Explain does is return the term frequency
//    final float termFreq = explanation.getDetails()[0].getDetails()[0].getValue();
//    assertEquals("term frq is not 2", 2f, termFreq, 0f);

    // Explain non existing entity
    explanation = w.explain(context, 1);
    assertNotNull("explanation is null and it shouldn't be", explanation);
    //All this Explain does is return the term frequency
    assertEquals("term frq is not 0", 0f, explanation.getValue(), 0f);
  }
View Full Code Here

Examples of org.apache.lucene.search.similarities.Similarity.ExactSimScorer.explain()

          result.setDescription("weight("+this.getQuery()+" in "+doc+") [" + similarity.getClass().getSimpleName() + "], result of:");
          while (scorer.nextNode()) {
            final ComplexExplanation nodeMatch = new ComplexExplanation();
            nodeMatch.setDescription("in "+scorer.node()+"), result of:");
            final float freq = scorer.freqInNode();
            final Explanation scoreExplanation = docScorer.explain(doc, new Explanation(freq, "termFreq=" + freq));
            nodeMatch.setValue(scoreExplanation.getValue());
            nodeMatch.setMatch(true);
            nodeMatch.addDetail(scoreExplanation);
            result.addDetail(nodeMatch);
          }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.