You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Hoss Man (JIRA)" <ji...@apache.org> on 2015/03/18 19:32:38 UTC

[jira] [Commented] (SOLR-6663) decide rules & syntax for computing stats/ranges/queries only at certain levels of a pivot

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

Hoss Man commented on SOLR-6663:
--------------------------------

Ok, after mulling this over a bit, i think there's a way to provide very robust support for "pair-wise" matching comma seperated tags to correspond with the comma seperated field names in a pivot -- but still have a syntax that is simple and (mostly) intuitive in the common cases:

* a comma separated list of tag names can be specified that is the same length as the list of fields being pivoted on (or shorter)
* each position in the tag list corresponds with the same position in the list of fields
* and empty string in the tag list means "compute nothing for this field in the pivot"
* if the list of tags is longer then the list of fields, that's an error
* if the list of tags is shorter then the list of fields, the last tag in the list is used for each position not accounted for in the list of fields (1)
* a single "*" may be used as a sentinel value in the list of tags.  It's effect is that all tag values that come after it (if any) will be "right aligned" with the list of field names, and acts as if all the felds prior to those that correspond with the specified tag names have been mapped to an empty string tag.

Note that because of "(1)" above, this approach means that in the case of a single tag name (which the only thing supported at the moment) the behavior would degrade to match the existing behavior: all of the tagged stats computed for all of the fields in the pivot.


To give some concrete examples/test cases of what that would look like, assume the following request:

{noformat}
  facet.pivot={!stats=$stags}fV,fW,fX,fY,fZ
  stags=....
{noformat}

Here's what stats (by tag name) would be computed for each field in the pivot based on the value of the {{stags}} param...

||stags||fV||fW||fX||fY||fZ||
||tA,tB,tC,tD,tE|tA|tB|tC|tD|tE|
||tA,tB|tA|tB|tB|tB|tB|
||tA,,tB|tA|-|tB|tB|tB|
||tA,,tB,,tC|tA|-|tB|-|tC|
||tA,*,tB,tC|tA|-|-|tB|tC|
||tA|tA|tA|tA|tA|tA|
||tA,*|tA|-|-|-|-|
||*,tA|-|-|-|-|tA|


Note that the last 3 rows in that table show what i expect would typically be the most common cases.

What do folks think of this approach?  Are the common cases straight forward enough? Is there any usage we should support that isn't covered here?


> decide rules & syntax for computing stats/ranges/queries only at certain levels of a pivot
> ------------------------------------------------------------------------------------------
>
>                 Key: SOLR-6663
>                 URL: https://issues.apache.org/jira/browse/SOLR-6663
>             Project: Solr
>          Issue Type: Sub-task
>            Reporter: Hoss Man
>
> [~smolloy] asked a great question in SOLR-6351...
> bq. One more question around this, which applies for SOLR-6353 and SOLR-4212 as well. Should we have a syntax to apply stats/queries/ranges only at specific levels in the pivot hierarchy? It would reduce amount of computation and size of response for cases where you only need it at a specific level (usually last level I guess). 
> I'm splitting this off into it's own Sub-task for further discussion.
> ----
> For now, the "stats" localparam must be a single tag, and the "work around" is to add a common tag to all stats you want to use.
> ie, this will cause an error...
> {noformat}
> stats.field={!tag=tagA}price
> stats.field={!tag=tagB}popularity
> stats.field={!tag=tagB}clicks
> facet.pivot={!stats=tagA,tagB}xxx,yyy,zz
> {noformat}
> but this will work...
> {noformat}
> stats.field={!tag=tagA,tagPivot}price
> stats.field={!tag=tagB,tagPivot}popularity
> stats.field={!tag=tagB,tagPivot}clicks
> facet.pivot={!stats=tagPivot}xxx,yyy,zz
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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