Package org.apache.lucene.search

Examples of org.apache.lucene.search.ScoreDoc


            this.scorer = scorer;
        }

        @Override public void collect(int doc) throws IOException {
            if (counter >= from) {
                docs.add(new ScoreDoc(docBase + doc, trackScores ? scorer.score() : 0f));
            }
            counter++;
            if (counter >= to) {
                throw StopCollectingException;
            }
View Full Code Here


                limit = docs.totalHits;
            }
            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) {
View Full Code Here

    ScoreDocQueue(int size) {
      initialize(size);
    }
   
    protected final boolean lessThan(Object a, Object b) {
      ScoreDoc hitA = (ScoreDoc)a;
      ScoreDoc hitB = (ScoreDoc)b;
      if (hitA.score == hitB.score)
        return hitA.doc > hitB.doc;
      else
        return hitA.score < hitB.score;
    }
View Full Code Here

        int doc = termDocs.doc();
        float score =
          similarity.tf(termDocs.freq()) * similarity.decodeNorm(norms[doc]);

        if (score > minScore) {
          sdq.put(new ScoreDoc(doc, score));
          if (sdq.size() > count) {               // if sdq overfull
            sdq.pop();                            // remove lowest in sdq
            minScore = ((ScoreDoc)sdq.top()).score; // reset minScore
          }
        }
View Full Code Here

    IterablePaging itPaging = paging.skipTo(90).gather(20).totalHits(totalHitsRef).progress(progressRef);
    BlurIterator<ScoreDoc, BlurException> iterator = itPaging.iterator();
    int position = 90;
    int searches = 1;
    while (iterator.hasNext()) {
      ScoreDoc sd = iterator.next();
      assertEquals(position, progressRef.currentHitPosition());
      assertEquals(searches, progressRef.searchesPerformed());
      System.out.println("time [" + progressRef.queryTime() + "] " + "total hits [" + totalHitsRef.totalHits() + "] "
          + "searches [" + progressRef.searchesPerformed() + "] " + "position [" + progressRef.currentHitPosition()
          + "] " + "doc id [" + sd.doc + "] " + "score [" + sd.score + "]");
View Full Code Here

          null, deepPagingCache);
      IterablePaging itPaging = paging.skipTo(position).totalHits(totalHitsRef).progress(progressRef);
      BlurIterator<ScoreDoc, BlurException> iterator = itPaging.iterator();

      while (iterator.hasNext()) {
        ScoreDoc sd = iterator.next();
        assertEquals(position, progressRef.currentHitPosition());
        System.out.println("time [" + progressRef.queryTime() + "] " + "total hits [" + totalHitsRef.totalHits() + "] "
            + "searches [" + progressRef.searchesPerformed() + "] " + "position [" + progressRef.currentHitPosition()
            + "] " + "doc id [" + sd.doc + "] " + "score [" + sd.score + "]");
        position++;
View Full Code Here

    IterablePaging itPaging = paging.skipTo(90).gather(20).totalHits(totalHitsRef).progress(progressRef);
    BlurIterator<ScoreDoc, BlurException> iterator = itPaging.iterator();
    int position = 90;
    int searches = 1;
    while (iterator.hasNext()) {
      ScoreDoc sd = iterator.next();
      assertEquals(position, progressRef.currentHitPosition());
      assertEquals(searches, progressRef.searchesPerformed());
      System.out.println("time [" + progressRef.queryTime() + "] " + "total hits [" + totalHitsRef.totalHits() + "] "
          + "searches [" + progressRef.searchesPerformed() + "] " + "position [" + progressRef.currentHitPosition()
          + "] " + "doc id [" + sd.doc + "] " + "score [" + sd.score + "]");
View Full Code Here

        if(collector!=null){
          ScoreDoc[] sds = collector.topDocs().scoreDocs;
          List<LazyDynaBean> queryResult = new ArrayList<LazyDynaBean>();
          for (int i = 0; i < countno && (offsetno + i) < total; i++) {
            int index = offsetno + i;
            ScoreDoc sd = sds[index];
            Document document = LuceneSupport.findDoc(sd.doc);
            LazyDynaBean rbean = new LazyDynaBean();
            LuceneSupport.convertDocument2Bean(rbean,document,true);
            queryResult.add(rbean);
          }
View Full Code Here

    int totalHits = docCollector.getTotalHits();
    if(totalHits>0){
      TopScoreDocCollector docCollectors = LuceneSupport.firstSearch(totalHits, null, query);
      ScoreDoc[] sds = docCollectors.topDocs().scoreDocs;
      for(int i=0;i<sds.length;i++){
        ScoreDoc sd = sds[i];
        Document doc = LuceneSupport.findDoc(sd.doc);
        List<Fieldable> fields = doc.getFields();
        System.out.println("****************"+(i+1)+"****************");
        for(Fieldable field:fields){
          System.out.println(field.name()+":"+field.stringValue());
View Full Code Here

    String queryS = LuceneSupport.makeQuery(query);
    System.out.println("start normal string:"+queryS);
    TopScoreDocCollector result1 = LuceneSupport.firstSearch(10, null,queryS);
    ScoreDoc[] sds = result1.topDocs().scoreDocs;
    for (int i = 0; i < sds.length; i++) {
      ScoreDoc sd = sds[i];
      Document document = LuceneSupport.findDoc(sd.doc);
      System.out.println("**********************"+(i+1)+"*********************");
      LuceneSupport.printDocument(document);
    }
//    String hqueryS = LuceneSupport.makeHierachyQuery(hquery);
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.ScoreDoc

Copyright © 2018 www.massapicom. 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.