Package org.apache.lucene.search

Examples of org.apache.lucene.search.IndexSearcher.maxDoc()


    @Override
    @SuppressWarnings({ "rawtypes" })
    public SearchResult call() throws Exception {
      final IndexSearcher indexSearcher = getSearcherByShard(_shardName);
      int nDocs = Math.min(_limit, indexSearcher.maxDoc());

      TopDocsCollector resultCollector;
      if (_sort != null) {
        boolean fillFields = true;// see IndexSearcher#search(...)
        boolean fieldSortDoTrackScores = false;
View Full Code Here


      LuceneTaxonomyReader tr = new LuceneTaxonomyReader(tDir);

      // Get all of the documents and run the query, then do different
      // facet counts and compare to control
      Query q = new TermQuery(new Term("content", "alpha"));
      ScoredDocIdCollector scoredDoc = ScoredDocIdCollector.create(is.maxDoc(), true);

      // Collector collector = new MultiCollector(scoredDoc);
      is.search(q, scoredDoc);

      CountFacetRequest cfra23 = new CountFacetRequest(
View Full Code Here

    if(reader == null) {
      Directory directory = FSDirectory.open(new File("/tmp/test"));
      reader = IndexReader.open(directory);
    }
    IndexSearcher searcher = new IndexSearcher(reader);
    for(int i = 0; i < searcher.maxDoc() && i < 10; i++) {
      Document doc = searcher.doc(i);
      // log.info(doc);
    }
    Query query = null;
    String key = "ipse".toLowerCase();
View Full Code Here

    IndexSearcher searcher = null;
    try {
     
      // initialize
      searcher = getIndexAdapter().newSearcher();
      this.maxDoc = searcher.maxDoc();
      boolean bExecuteQuery = true;
      boolean bProcessHits = true;
      RequestContext reqContext = this.getIndexAdapter().getRequestContext();
      BooleanQuery rootQuery = new BooleanQuery();
      DiscoveryFilter discoveryFilter = discoveryQuery.getFilter();
View Full Code Here

       
      // execute the query and process the hits if required
     
      // set the sort option
      Sort sortOption = null;
      if (bProcessHits && (searcher.maxDoc() > 0)) {
        sortOption = makeSortOption(discoveryQuery);
      }
     
      // filters
      Filter filter = null;
View Full Code Here

  @Override
  public int countDocuments() throws CatalogIndexException {
    IndexSearcher searcher = null;
    try {
      searcher = newSearcher();
      return searcher.maxDoc();
    } catch (Exception e) {
      String sMsg = "Error accessing index:\n "+Val.chkStr(e.getMessage());
      throw new CatalogIndexException(sMsg,e);
    } finally {
      closeSearcher(searcher);
View Full Code Here

      DirectoryTaxonomyReader tr = new DirectoryTaxonomyReader(tDir);

      // Get all of the documents and run the query, then do different
      // facet counts and compare to control
      Query q = new TermQuery(new Term("content", "alpha"));
      ScoredDocIdCollector scoredDoc = ScoredDocIdCollector.create(is.maxDoc(), true);

      // Collector collector = new MultiCollector(scoredDoc);
      is.search(q, scoredDoc);

      CountFacetRequest cfra23 = new CountFacetRequest(
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.