[ 
https://issues.apache.org/jira/browse/LUCENE-1345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662823#action_12662823
 ] 

Uwe Schindler commented on LUCENE-1345:
---------------------------------------

Paul Elschot:

Just for clarification: I do not want to completely convert Filters to 
ConstantScoreQueries. The idea was to combine Queries and Filters in such a 
way, that every Filter can automatically be used at all places where a Query 
can be used (e.g. also alone a search query without any other constraint). For 
that, the abstract Query methods must be implemented and return a "default" 
weight for Filters which is the current ConstantScore Logic. If the filter is 
used as a real filter (where the API wants a Filter), the getDocIdSet part 
could be directly used, the weight is useless (as it is currently, too). The 
constant score default implementation is only used when the Filter is used as a 
Query (e.g. as direct parameter to Searcher.search()). For the special case of 
BooleanQueries combining Filters and Queries the idea is, to optimize the 
BooleanQuery logic in such a way, that it detects if a BooleanClause is a 
Filter (using instanceof) and then directly uses the Filter API and not take 
the burden of the ConstantScoreQuery. There is only one special case: If the 
Filter is used alone in the BooleanQuery, then it must be executed as a 
ConstantScoreQuery, but only in this case. The problems with sorting are in my 
opinion not relevant: If score is identical (e.g. 1.0f) the results come in 
index order (this is how it appears to me). In this case TopDocs first list the 
docs with lower docIds.

For the user this has the main advantage: That he can construct his query using 
a simplified API without thinking about Filters oder Queries, you can just 
combine clauses together. The scorer/weight logic then identifies the cases to 
use the filter or the query weight API. Just like the query optimizer of a RDB 
:-)

Is this clear now?

> Allow Filter as clause to BooleanQuery
> --------------------------------------
>
>                 Key: LUCENE-1345
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1345
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>            Reporter: Paul Elschot
>            Priority: Minor
>             Fix For: 2.9
>
>         Attachments: booleansetperf.txt, DisjunctionDISI.java, 
> DisjunctionDISI.patch, DisjunctionDISI.patch, 
> LUCENE-1345-Filter+Query-merge.patch, LUCENE-1345.patch, LUCENE-1345.patch, 
> OpenBitSetIteratorExperiment.java, TestIteratorPerf.java, 
> TestIteratorPerf.java
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to