[
https://issues.apache.org/jira/browse/LUCENE-6754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14727307#comment-14727307
]
Adrien Grand commented on LUCENE-6754:
--------------------------------------
bq. How about adding a method to the query class that can be "optionally"
implemented to return a count?
I would really like to avoid adding new methods for that.
There is another change that I have been thinking about recently, that would
add a `boolean needsScores` parameter to Query.rewrite. This could be useful
eg. to flatten boolean queries when scores are not needed so that we make a
better use of the cost API. In the context of this issue, this means that
queries could rewrite to a MatchAllDocsQuery or to a TermQuery if scores are
not needed so that this optimization would apply. Would it work for you?
Unwrapping CSQ would not be necessary anymore as a CSQ would return the inner
query in Query.rewrite if scores are not needed.
> Optimize IndexSearcher.count for simple queries
> -----------------------------------------------
>
> Key: LUCENE-6754
> URL: https://issues.apache.org/jira/browse/LUCENE-6754
> Project: Lucene - Core
> Issue Type: Improvement
> Reporter: Adrien Grand
> Assignee: Adrien Grand
> Priority: Minor
> Fix For: 5.4
>
> Attachments: LUCENE-6754.patch
>
>
> IndexSearcher.count currently always create a collector to compute the number
> of hits, but it could optimize some queries like MatchAllDocsQuery or
> TermQuery.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]