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

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

{quote}
bq. In my opinion, the terms "Query" and "Filter" should be merged.

There is clear distinction between the two terms.
QueryWrapperFilter changes a Query into a Filter and ConstantScoreQuery changes 
a Filter into a Query.
The first one removes the scoring by upcasting a Scorer to a DocIdSetIterator, 
and the second one adds a constant score to a DocIdSetIterator to create a 
Scorer.
{quote}
You are right, but for a Lucene user there is always the problem of the 
distiction between both terms. When combining both, the user would get less 
burden on thinking about both. It would make life easier, and would hide some 
work for the user. The problem are the fine differences between the both, but 
for the general user who does not have such large indexes where the difference 
between both counts, it would makte things easier.

How about merging Filters and Queries and then thinking about optimizations in 
the code of BooleanQuery to identify use cases where the scoring can be removed 
and where a constant score is needed. There are two cases where the two 
different types make problems:

- user (A) wants to use my contrib TrieRangeQuery/-Filter and just execute a 
Query that returns documents that match the Range. The problem for this user 
is: How to implement this? User a MatchAllDocsQuery and filter the results with 
TrieRangeFilter or use ConstantScoreQuery to combine both? What is faster?
- user (B) wants to filter some documents using a normal Filter. If he uses the 
standard Query+Filter combination of Searcher.search() he must before 
distinguish what part of the combinations should be the filter and what should 
be the query. Maybe he got a TrieRangeQuery (the query one using a 
ConstantScore on the Filter) as query and want it combine with another query. 
With the new code that detects the type of both clauses, BooleanQuery code 
could choose to execute the TermQueries as normal scorer query and filter the 
results using the given Filter as clause.

Both tasks could be easily combined if Query and Filter would be the same. The 
user (A) would not need to create a constant score query on the Trie filter, he 
could just use it with Searcher.search() as a "Query". If he want to add some 
normal term queries from a query parser to it, he would use a BooleanQuery to 
combine both. The BooleanQuery code would then find out that one of the clauses 
is a Filter and would *not* use ConstantScore code to filter the result and 
just use the normal filter code. For the user it is simplier: He would always 
create a TrieRangeQueryFilter combination and would let BooleanQuery choose 
what query execution strategy to use.

> 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