Package org.apache.lucene.search

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


              doc.get("permalink"),
              doc.get("title"),
              doc.get("subtitle"),
              doc.get("truncatedBody"),
              DateField.stringToDate(doc.get("date")),
              hits.score(i));
          searchResults.add(result);
        }
      } catch (ParseException pe) {
        pe.printStackTrace();
        searchResults.setMessage("Sorry, but there was an error. Please try another search");
View Full Code Here


            for(int i = 0; i < hits.length();i++){
            Document doc = hits.doc(i);
           
            String uri2 = doc.get(PropertiesMapper.S_URIDOC);
           
            result.put(uri2, (double)hits.score(i));
          }
           
      }
    }
   
View Full Code Here

      for(int i = 0; i < hits.length();i++){
        Document doc = hits.doc(i);
       
        String uri = doc.get(PropertiesMapper.S_URIDOC);
 
        result.put(uri, (double)hits.score(i));
      }
    }else{
      result = new HashMap<String, Double>();
    }
    return result;
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

    try {
      QueryParser qp = new QueryParser( "id", new StandardAnalyzer() );
      Query query = qp.parse( "title:Action OR Abstract:Action" );
      Hits hits = searcher.search( query );
      assertEquals( 2, hits.length() );
      assertTrue( hits.score( 0 ) == 2 * hits.score( 1 ) );
      assertEquals( "Hibernate in Action", hits.doc( 0 ).get( "title" ) );
    }
    finally {
      searcher.close();
    }
View Full Code Here

    try {
      QueryParser qp = new QueryParser( "id", new StandardAnalyzer() );
      Query query = qp.parse( "title:Action OR Abstract:Action" );
      Hits hits = searcher.search( query );
      assertEquals( 2, hits.length() );
      assertTrue( hits.score( 0 ) == 2 * hits.score( 1 ) );
      assertEquals( "Hibernate in Action", hits.doc( 0 ).get( "title" ) );
    }
    finally {
      searcher.close();
    }
View Full Code Here

                  for (int y=0; y<len; y++) {
                    if(startrow>++count)continue;
                    if(maxrows>-1 && list.size()>=maxrows) break outer;
                    //list.add(new SearchResulItemHits(hits,y,highlighter,analyzer,id,ct,c,aa.getContextPassages(),aa.getContextBytes()));
                    doc = hits.doc(y);
                    list.add(createSearchResulItem(highlighter,analyzer,doc,id,hits.score(y),ct,c,aa.getContextPassages(),aa.getContextBytes()));
                 
                
                }
              
            }
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

    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 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.