Package org.apache.lucene.search

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


            }
            for (int i = 0, len = docs.scoreDocs.length;
                    i < limit && i + offset < docs.totalHits
                    && i + offset < len; i++) {
                ScoreDoc sd = docs.scoreDocs[i + offset];
                Document doc = searcher.doc(sd.doc);
                float score = sd.score;
                //## LUCENE3 end ##
                String q = doc.get(LUCENE_FIELD_QUERY);
                if (data) {
                    int idx = q.indexOf(" WHERE ");
View Full Code Here


      float aScores[] = null;
      aScores = new float[nHitCount];
      for( int iHit = 0 ; iHit < nHitCount ; iHit++ )
      {
        ScoreDoc aDoc = aHits.scoreDocs[iHit];
        String aPath = searcher.doc(aDoc.doc).get( "path" );
        aDocs[iHit] = ( aPath != null ) ? aPath : "";
        aScores[iHit] = aDoc.score;
      }
      aScoreOutArray[0] = aScores;
View Full Code Here

      float aScores[] = null;
      aScores = new float[nHitCount];
      for( int iHit = 0 ; iHit < nHitCount ; iHit++ )
      {
        ScoreDoc aDoc = aHits.scoreDocs[iHit];
        String aPath = searcher.doc(aDoc.doc).get( "path" );
        aDocs[iHit] = ( aPath != null ) ? aPath : "";
        aScores[iHit] = aDoc.score;
      }
      aScoreOutArray[0] = aScores;
View Full Code Here

            }
            for (int i = 0, len = docs.scoreDocs.length;
                    i < limit && i + offset < docs.totalHits
                    && i + offset < len; i++) {
                ScoreDoc sd = docs.scoreDocs[i + offset];
                Document doc = searcher.doc(sd.doc);
                float score = sd.score;
                //*/
                String q = doc.get(LUCENE_FIELD_QUERY);
                if (data) {
                    int idx = q.indexOf(" WHERE ");
View Full Code Here

  // ensure that queries return expected results without DateFilter first
        ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
  assertEquals(1, hits.length);

         doAssert(searcher.doc(hits[0].doc), true);
         searcher.close();
    }

    private Document makeDocumentWithFields()
    {
View Full Code Here

      // ensure that queries return expected results without DateFilter first
      ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
      assertEquals(3, hits.length);
      int result = 0;
      for(int i=0;i<3;i++) {
        Document doc2 = searcher.doc(hits[i].doc);
        Field f = doc2.getField("id");
        if (f.stringValue().equals("id1"))
          result |= 1;
        else if (f.stringValue().equals("id2"))
          result |= 2;
View Full Code Here

  // ensure that queries return expected results without DateFilter first
        ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
  assertEquals(1, hits.length);

         doAssert(searcher.doc(hits[0].doc), true);
         searcher.close();
    }

    private Document makeDocumentWithFields()
    {
View Full Code Here

      // ensure that queries return expected results without DateFilter first
      ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
      assertEquals(3, hits.length);
      int result = 0;
      for(int i=0;i<3;i++) {
        Document doc2 = searcher.doc(hits[i].doc);
        Field f = doc2.getField("id");
        if (f.stringValue().equals("id1"))
          result |= 1;
        else if (f.stringValue().equals("id2"))
          result |= 2;
View Full Code Here

      long startTime = System.currentTimeMillis();
      sort = sort == null ? new Sort() : sort;
      TopFieldDocs topFielsDocs = searcher.search(query, filter, end, sort);
      log.info("Searched for: " + query + " in  " + (System.currentTimeMillis() - startTime) + " ms");
      for (int i = start; i < topFielsDocs.scoreDocs.length; i++) {
        String gidString = searcher.doc(topFielsDocs.scoreDocs[i].doc).getField(GID).stringValue();
        EOKeyGlobalID gid = ERXKeyGlobalID.fromString(gidString).globalID();
        result.addObject(gid);
      }
            log.info("Returning " + result.count() + " after " + (System.currentTimeMillis() - startTime) + " ms");
      return result;
View Full Code Here

          queryString = scan.nextLine().trim();

          Query query = qp.parse(queryString);
          TopDocs results = searcher.search(query, null, 10);
          for (ScoreDoc sd : results.scoreDocs) {
            Document doc = searcher.doc(sd.doc);
            System.out.println(queryString + "  " + doc.get("id"));
          }
        }

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