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

Marvin Humphrey commented on LUCENE-1345:
-----------------------------------------

Paul Elschot:

> To prepare searching in Lucene the following 'transformations' are done:
>
>   Query -> Weight -> Scorer
>   and
>   Filter -> DocIdSetIterator
> 
> I've never seen the KS classes

KS's Search classes used to be pretty direct ports from the Lucene Search
hierarchy -- because when I was doing the work I had so much trouble grokking
it that I felt there was no choice but to cargo cult. :)

Since then, many changes have been made.  Here are some that are germane to
this discussion:

* Filter has been eliminated, and filtering subclasses have been made into
  subclasses of Query.
* Weight has been made a subclass of Query and renamed to "Compiler".
* BooleanQuery has been replaced by the foursome of ANDQuery, ORQuery,
  NOTQuery, and RequiredOptionalQuery, all of which descend from the common
  parent PolyQuery, and which compile to scorers roughly akin to those from
  Lucene's BooleanScorer2 (i.e. they implement Scorer.skipTo())..

By making both Filter and Weight/Compiler subclasses of Query, it became
possible to simplify the Searchable/Searcher interface considerably.

> the downside of using ANDQuery (KS) for filtering is that it has to provide
> a score value, which somehow must be ignored during search.

Good point, thanks!

Right now, QueryFilter, NOTQuery, MatchAllQuery, and such all
just provide a score of 0.0.  ANDScorer adds the scores of its subscorers
together, so there's no direct effect on the final score.  However, the
Similarity.coord() bonus is affected because the number of clauses has
increased.  That might be considered a bug.

Beyond that, there's Scorer-compile-time optimization work to do along the
lines of what Uwe proposes.



> 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