Package org.apache.lucene.search

Examples of org.apache.lucene.search.Hits.score()


                         4, h.length());

            float score0 = h.score(0);
            float score1 = h.score(1);
            float score2 = h.score(2);
            float score3 = h.score(3);

            String doc0 = h.doc(0).get("id");
            String doc1 = h.doc(1).get("id");
            String doc2 = h.doc(2).get("id");
            String doc3 = h.doc(3).get("id");
View Full Code Here


        try {

            assertEquals("4 docs should match " + q.toString(),
                         4, h.length());

            float score0 = h.score(0);
            float score1 = h.score(1);
            float score2 = h.score(2);
            float score3 = h.score(3);

            String doc0 = h.doc(0).get("id");
View Full Code Here

            assertEquals("4 docs should match " + q.toString(),
                         4, h.length());

            float score0 = h.score(0);
            float score1 = h.score(1);
            float score2 = h.score(2);
            float score3 = h.score(3);

            String doc0 = h.doc(0).get("id");
            String doc1 = h.doc(1).get("id");
View Full Code Here

            assertEquals("4 docs should match " + q.toString(),
                         4, h.length());

            float score0 = h.score(0);
            float score1 = h.score(1);
            float score2 = h.score(2);
            float score3 = h.score(3);

            String doc0 = h.doc(0).get("id");
            String doc1 = h.doc(1).get("id");
            String doc2 = h.doc(2).get("id");
View Full Code Here

                         4, h.length());

            float score0 = h.score(0);
            float score1 = h.score(1);
            float score2 = h.score(2);
            float score3 = h.score(3);

            String doc0 = h.doc(0).get("id");
            String doc1 = h.doc(1).get("id");
            String doc2 = h.doc(2).get("id");
            String doc3 = h.doc(3).get("id");
View Full Code Here

    message("--------------------------------------");
    for (int start = 0; start < hits.length(); start += HITS_PER_PAGE) {
      int end = Math.min(hits.length(), start + HITS_PER_PAGE);
      for (int ii = start; ii < end; ii++) {
        Document doc = hits.doc(ii);
        message("---------------- " + (ii + 1) + " score:" + hits.score(ii) + "---------------------");
        printHit(doc);
        if (showTokens) {
          invertDocument(doc);
        }
        if (explain) {
View Full Code Here

      for (int start = 0; start < hits.length(); start += HITS_PER_PAGE) {
        int end = Math.min(hits.length(), start + HITS_PER_PAGE);
        for (int i = start; i < end; i++) {

          if (raw) {                              // output raw format
            System.out.println("doc="+hits.id(i)+" score="+hits.score(i));
            continue;
          }

          Document doc = hits.doc(i);
          String path = doc.get("path");
View Full Code Here

        o.println("found: " + len + " documents matching");
        o.println();
        for (int i = 0; i < Math.min(25, len); i++) {
            Document d = hits.doc(i);
      String summary = d.get( "summary");
            o.println("score  : " + hits.score(i));
            o.println("url    : " + d.get("url"));
            o.println("\ttitle  : " + d.get("title"));
      if ( summary != null)
        o.println("\tsummary: " + d.get("summary"));
            o.println();
View Full Code Here

  private void queryTest(Query query) throws IOException {
    Hits parallelHits = parallel.search(query);
    Hits singleHits = single.search(query);
    assertEquals(parallelHits.length(), singleHits.length());
    for(int i = 0; i < parallelHits.length(); i++) {
      assertEquals(parallelHits.score(i), singleHits.score(i), 0.001f);
      Document docParallel = parallelHits.doc(i);
      Document docSingle = singleHits.doc(i);
      assertEquals(docParallel.get("f1"), docSingle.get("f1"));
      assertEquals(docParallel.get("f2"), docSingle.get("f2"));
      assertEquals(docParallel.get("f3"), docSingle.get("f3"));
View Full Code Here

      for( int iHit = 0 ; iHit < nHitCount ; iHit++ )
      {
        Document aDoc = aHits.doc( iHit );
        String aPath = aDoc.get( "path" );
        aDocs[iHit] = ( aPath != null ) ? aPath : "";
        aScores[iHit] = aHits.score( iHit );
      }
      aScoreOutArray[0] = aScores;

      reader.close();
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.