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

Shai Erera commented on LUCENE-4750:
------------------------------------

About the two tests. This:

{{Query q3 = DrillDown.query(defaultParams, null, Occur.MUST, new 
CategoryPath("a"), new CategoryPath("b"));}}

Should be converted to two {{add()}}}?

The second test, instead of nuking it, make it testAndOfOrs? Not sure if we 
have any such test, so it would be a good idea anyway.

And yes, I think that we should just prevent across dimension ORs. It is still 
a helper class, someone can build his own such query if he wishes to. Unlike 
"OR between CPs of the same dim", I think that "OR between different dims" is 
not so common...

About the patch:

* I've wanted to do it for a long time -- can we have just one ctor with FSP? 
DDQ should be called from a search context, so passing FIP is odd. Can you 
check if there's any real code that needs to pass FIP?
** Same goes for the static term() method.

* This check in add() {{if (paths[0].length == 0)}} is odd, since you check it 
again for every CP later. Maybe move it to inside the {{paths.length==1}}?

* Regarding baseQuery, while reviewing LUCENE-4748 I wrote that DDQ should 
probably not take a baseQuery, but rather let the user wrap from the outside 
(while DDQ can have a static helper class). Do you not need it there?
** Or ... such users (like DrillSideways) can pass {{baseQuery=null}} in that 
case and do the final wrapping themselves? If that would work for sideways, 
then I think taking a baseQuery is good as it simplifies usage for apps.

That looks good, thanks for taking care of this!
                
> Convert DrillDown to DrillDownQuery
> -----------------------------------
>
>                 Key: LUCENE-4750
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4750
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: modules/facet
>            Reporter: Shai Erera
>            Assignee: Michael McCandless
>         Attachments: LUCENE-4750.patch
>
>
> DrillDown is a utility class for creating drill-down queries over a base 
> query and a bunch of categories. We've been asked to support AND, OR and AND 
> of ORs. The latter is not so simple as a static utility method though, so 
> instead we have some sample code ...
> Rather, I think that we can just create a DrillDownQuery (extends Query) 
> which takes a baseQuery in its ctor and exposes add(CategoryPath...), such 
> that every such group of categories is AND'ed with other groups, and 
> internally they are OR'ed. It's very similar to how you would construct a 
> BooleanQuery, only simpler and specific to facets.
> Internally, it would build a BooleanQuery and delegate rewrite, createWeight 
> etc to it.
> That will remove the need for the static utility methods .. or we can keep 
> static term() for convenience.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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

Reply via email to