Package org.apache.lucene.search

Examples of org.apache.lucene.search.Collector


      try {
        final Query phraseQuery = new SpanNearQuery(new SpanQuery[] {
            new SpanTermQuery(new Term(FIELD, "fox")),
            new SpanTermQuery(new Term(FIELD, "jumped")) }, 0, true);
        final OpenBitSet bitset = new OpenBitSet();
        indexSearcher.search(phraseQuery, new Collector() {
          private int baseDoc;

          @Override
          public boolean acceptsDocsOutOfOrder() {
            return true;
View Full Code Here


    final int totalMaxDocs = searcher.maxDoc();
    final int maxDocs = Math.min( n, totalMaxDocs );

    final TopDocsCollector<?> topDocCollector;
    final TotalHitCountCollector hitCountCollector;
    Collector collector = null;
    if ( maxDocs != 0 ) {
      topDocCollector = createTopDocCollector( maxDocs );
      hitCountCollector = null;
      collector = topDocCollector;
      collector = optionallyEnableFieldCacheOnTypes( collector, totalMaxDocs, maxDocs );
View Full Code Here

  private Collector optionallyEnableFacetingCollectors(Collector collector) {
    if ( facetRequests == null || facetRequests.isEmpty() ) {
      return collector;
    }
    facetCollectors = new ArrayList<FacetCollector>();
    Collector nextInChain = collector;
    for ( FacetingRequestImpl entry : facetRequests.values() ) {
      FacetCollector facetCollector = new FacetCollector( nextInChain, entry );
      nextInChain = facetCollector;
      facetCollectors.add( facetCollector );
    }
View Full Code Here

    }
    return timeoutAt0;
  }

  private Collector decorateWithTimeOutCollector(Collector collector) {
    Collector maybeTimeLimitingCollector = collector;
    if ( timeoutManager.getType() == TimeoutManager.Type.LIMIT ) {
      final Long timeoutLeft = timeoutManager.getTimeoutLeftInMilliseconds();
      if ( timeoutLeft != null ) {
        Counter counter = timeoutManager.getLuceneTimeoutCounter();
        maybeTimeLimitingCollector = new TimeLimitingCollector( collector, counter, timeoutLeft);
View Full Code Here

    IndexSearcher searcher = null;
    try{
      readerList = zoie.getIndexReaders();
      MultiReader reader = new MultiReader(readerList.toArray(new IndexReader[readerList.size()]), false);
      searcher = new IndexSearcher(reader);
      searcher.search(q, new Collector(){
        ZoieIndexReader<IndexReader> zoieReader = null;
        int base = 0;
        @Override
        public boolean acceptsDocsOutOfOrder() {
          return true;
View Full Code Here

                            continue;
                        }
                        if (scopePhase.scope() != null) {
                            searchContext.searcher().processingScope(scopePhase.scope());
                        }
                        Collector collector = collectorPhase.collector();
                        searchContext.searcher().search(collectorPhase.query(), collector);
                        collectorPhase.processCollector(collector);
                        if (collectorPhase.scope() != null) {
                            // we mark the scope as processed, so we don't process it again, even if we need to rerun the query...
                            searchContext.searcher().processedScope();
View Full Code Here

        if (_sort == null) {
          collector = TopScoreDocCollector.create(_numHitsToCollect, after, true);
        } else {
          collector = TopFieldCollector.create(_sort, _numHitsToCollect, (FieldDoc) after, true, true, false, true);
        }
        Collector col = new StopExecutionCollector(collector, _running);
        if (_runSlow) {
          col = new SlowCollector(col);
        }
        _searcher.search(_query, col);
        _totalHitsRef.totalHits.set(collector.getTotalHits());
View Full Code Here

            hits = collector.topDocs();
          } else {
            hits = searcher.search(q, numHits);
          }
        } else {
          Collector collector = createCollector();
          searcher.search(q, null, collector);
          //hits = collector.topDocs();
        }

        final String printHitsField = getRunData().getConfig().get("print.hits.field", null);
View Full Code Here

      try {
        final Query phraseQuery = new SpanNearQuery(new SpanQuery[] {
            new SpanTermQuery(new Term(FIELD, "fox")),
            new SpanTermQuery(new Term(FIELD, "jumped")) }, 0, true);
        final FixedBitSet bitset = new FixedBitSet(indexReader.maxDoc());
        indexSearcher.search(phraseQuery, new Collector() {
          private int baseDoc;

          @Override
          public boolean acceptsDocsOutOfOrder() {
            return true;
View Full Code Here

    TopScoreDocCollector topDocsCollector = TopScoreDocCollector.create(
        searcher.getIndexReader().maxDoc(), true);
    FacetsCollector facetsCollector = new FacetsCollector(
        facetSearchParams, searcher.getIndexReader(), taxonomyReader);
    Collector mColl = MultiCollector.wrap(topDocsCollector, facetsCollector);
   
    collectors[0] = topDocsCollector;
    collectors[1] = facetsCollector;

    searcher.search(new MatchAllDocsQuery(), mColl);
View Full Code Here

TOP

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

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.