Github user shebiki commented on the pull request:

    https://github.com/apache/lucene-solr/pull/40#issuecomment-38165595
  
    Mikhail,
    
    I have a similar use case and opted for creating the `BooleanScorer2` 
directly instead of trying to associate each child `Scorer` with the drilldown 
id. I chose not to use the 
[QueryWrapper](https://github.com/apache/lucene-solr/blob/lucene_solr_4_6/lucene/facet/src/java/org/apache/lucene/facet/search/DrillSideways.java#L352)
 pattern from `DrillSideways` in 4.6.0 because I felt it would prevent future 
optimizations and it was no longer in use in 4.7. I didn't consider the idea of 
just comparing `scorer.getWeight().getQuery()` but it's essentially the same 
work flow.
    
    The reason that I felt that prevented further optimization is that it 
prevents a `Weight` instance from returning an already created child `Scorer`. 
For example:
    
    * A `BooleanQuery` consisting of just `SHOULD` clauses with `disableCoord` 
set to `true`. If a segment only has one non-null scorer then 
`BooleanWeight.scorer()` should be able to return just that child scorer 
instead of having to wrap it with another.
    * Introduction of a extra scoring metadata (imagine decorating each score 
with an additional `boolean`). In this case a composing query (variant of 
`BooleanQuery`, ``DisjunctionMaxQuery`, etc) would want to aggregated this 
extra metadata at scoring time. If the metadata has a decent default value then 
only some of the child `Scorer`s will be able to provide it. If non of the 
child `Scorer`s provide this metadata then it's calculation can probably be 
short circuited and it can just return a `BooleanScorer`, `ConjunctionScorer`, 
or `DisjunctionScorer` as needed. This would be more efficient than making it 
wrap unconditionally.
    
    Quick question about your particular drillsideways query. Do you call 
`score()`, `freq()`, or something else to ensure the `SHOULD` `Scorer`s are 
correctly positioned? Do you optimize for when `BooleanQuery` returns a 
`DisjunctionScorer` and the child `Scorer`s are already positioned?
    
    --Terry



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to