Package org.apache.lucene.search

Examples of org.apache.lucene.search.TopFieldDocs


    List<LookupResult> results = null;
    try {
      //System.out.println("got searcher=" + searcher);
      searcher.search(finalQuery, c2);

      TopFieldDocs hits = (TopFieldDocs) c.topDocs();

      // Slower way if postings are not pre-sorted by weight:
      // hits = searcher.search(query, null, num, SORT);
      results = createResults(searcher, hits, num, key, doHighlight, matchedTokens, prefixToken);
    } finally {
View Full Code Here


                if(sort == null) {
                    sort = new Sort(sortSpecification.getSortFields());
                    sortCache.put(fieldKey, sort);
                }
                //searcher.setDefaultFieldSortScoring(true, true);
                TopFieldDocs topFieldDocs = searcher.search(booleanQuery, null, to, sort);
                hits = topFieldDocs.scoreDocs;
            } else {
                TopScoreDocCollector collector = TopScoreDocCollector.create(to, true);
                searcher.search(booleanQuery, collector);
                hits = collector.topDocs().scoreDocs;
View Full Code Here

      final int scoreDocsCount = UnsignedNumeric.readUnsignedInt(input);
      final ScoreDoc[] scoreDocs = new ScoreDoc[scoreDocsCount];
      for (int i=0; i<scoreDocsCount; i++) {
         scoreDocs[i] = (ScoreDoc) input.readObject();
      }
      return new TopFieldDocs(totalHits, scoreDocs, sortFields, maxScore);
   }
View Full Code Here

    logger.info("reverse:" + reverse);
    SortField sf = new SortField(sortProperty, SortField.STRING, reverse);

    Query query = new MatchAllDocsQuery();
   
    TopFieldDocs topDocs = searcher.search(query, (Filter) null, 1000000, new Sort(sf));
    logger.info("offset:" + offset);
    logger.info("limit:" + limit);
    logger.info("topDocs.totalHits:" + topDocs.totalHits);
   
    int start = offset;
View Full Code Here

   
    SortField sf = new SortField(sortProperty, SortField.STRING, reverse);
    logger.info("searchText:" + searchText);
    Query query = new QueryParser(Version.LUCENE_34, "contents", analyzer).parse(searchText+"*");
   
    TopFieldDocs topDocs = searcher.search(query, (Filter) null, 1000000, new Sort(sf));
    logger.info("offset:" + offset);
    logger.info("limit:" + limit);
    logger.info("topDocs.totalHits:" + topDocs.totalHits);
   
    int start = offset;
View Full Code Here

      query = mfqp.parse(entityName + " " + searchText + "*");
    }
   
    logger.info("query" + query);
   
    TopFieldDocs topDocs = searcher.search(query, (Filter) null, 1000000, new Sort(sf));
    logger.info("offset:" + offset);
    logger.info("limit:" + limit);
    logger.info("topDocs.totalHits:" + topDocs.totalHits);
   
    int start = offset;
View Full Code Here

    NSMutableArray<EOKeyGlobalID> result = new NSMutableArray<EOKeyGlobalID>();
    try {
      Searcher searcher = indexSearcher();
      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);
View Full Code Here

        : this.totalHits;
    ScoreDoc[] scoreDocs = new ScoreDoc[arraySize];
    for (int i = 0; i < this.nDocs; ++i) {
      scoreDocs[i] = this.pq.poll();
    }
    return new TopFieldDocs(this.totalHits, scoreDocs, this.fields, 0.0f);
  }
View Full Code Here

        }
        hits = tps.scoreDocs;
        searcher = result.getSearcher();
      } else {
        Search.TopFieldDocsSearchResult result = search.searchBySession(queryStr, startFrom, operator);
        TopFieldDocs tfd = result.getTopFieldDocs();
        if (tfd!=null){
          hits = tfd.scoreDocs;
       
        searcher = result.getSearcher();       
      }           
View Full Code Here

     
      Query query;
      query = parser.parse(queryStr);
      Sort sort = new Sort("summary",true);
           
      TopFieldDocs tfd = searcher.search(query,null,startFrom+10,sort);
      TopFieldDocsSearchResult result = new TopFieldDocsSearchResult(
          tfd, searcher);
      return result;
    } catch (ParseException e) {
      // TODO Auto-generated catch block
View Full Code Here

TOP

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

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.