Hi,

The ConstantScoreQuery part is just overhead. If scores are not requested, they 
should not be calculated - but CSQ cannot prevent this from happening at all. 
It just prevent's the collector from seeing the scores. As the counting 
collector does not request any scores, you just add a useless additional 
wrapper around the query's scorer.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de


> -----Original Message-----
> From: Nicola Buso [mailto:nb...@ebi.ac.uk]
> Sent: Wednesday, September 18, 2013 5:21 PM
> To: java-user
> Subject: TotalHitCountCollector performance
> 
> 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


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to