Hello, I was going to use the TotalHitCountCollector in cases where I'm interested just in the number of results. Obviously I was hoping to gain in performances compared to a "scored" query. >From my tests it seam it's not so performant compare to the "scored" search. At this point I'm wondering if I'm doing some errors. I'm executing 1000 queries on an index with 167,424,681 entries: TotalHitCountCollector average is 2803.34 TopFieldCollector average is 2981.47
Below is part of the code I'm using with TotalHitCountCollector, with TopFieldCollector I'm not wrapping the query with ConstantScoreQuery Does these numbers resemble right to you guys? nb. --------- // prepare the lucene query. final org.apache.lucene.search.Query luceneQuery = new ConstantScoreQuery(getQuery(queryDomain, query.getQueryString())); try { final TotalHitCountCollector hitCountCollector = new TotalHitCountCollector(); long startTime = System.currentTimeMillis(); searcher.search(luceneQuery, hitCountCollector); if (log.isTraceEnabled()) { log.trace(String.format("getNumberOfResults query=%s, domainId=%s executed in: %s(ms)", query.getQueryString(), query.getDomainId(), System.currentTimeMillis() - startTime)); } return hitCountCollector.getTotalHits(); } catch (final IOException e) { throw new SearchFailedException("I/O [" + this.domain + "] " + e.getMessage(), e); } --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org