You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Shalin Shekhar Mangar (JIRA)" <ji...@apache.org> on 2014/02/24 18:04:25 UTC

[jira] [Commented] (SOLR-3177) Excluding tagged filter in StatsComponent

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

Shalin Shekhar Mangar commented on SOLR-3177:
---------------------------------------------

Thanks Nikolai and Vitaliy.

There is a bunch of code related to grouping copied from SimpleFacets which probably does not belong:
{code}
if (rb.grouping() && rb.getGroupingSpec().isTruncateGroups()) {
        Grouping grouping = new Grouping(searcher, null, rb.getQueryCommand(), false, 0, false);
        grouping.setGroupSort(rb.getGroupingSpec().getSortWithinGroup());
        if (rb.getGroupingSpec().getFields().length > 0) {
          grouping.addFieldCommand(rb.getGroupingSpec().getFields()[0], req);
        } else if (rb.getGroupingSpec().getFunctions().length > 0) {
          grouping.addFunctionCommand(rb.getGroupingSpec().getFunctions()[0], req);
        } else {
          this.base = base;
          return;
        }
        AbstractAllGroupHeadsCollector allGroupHeadsCollector = grouping.getCommands().get(0).createAllGroupCollector();
        searcher.search(new MatchAllDocsQuery(), base.getTopFilter(), allGroupHeadsCollector);
        int maxDoc = searcher.maxDoc();
        FixedBitSet fixedBitSet = allGroupHeadsCollector.retrieveGroupHeads(maxDoc);
        long[] bits = fixedBitSet.getBits();
        this.base = new BitDocSet(new FixedBitSet(bits, bits.length));
      }
{code}

If this is indeed what it takes to have StatsComponent play well with grouping then at a minimum we must have tests for it. In any case, adding support for grouping in stats computations warrants a new issue.

> Excluding tagged filter in StatsComponent
> -----------------------------------------
>
>                 Key: SOLR-3177
>                 URL: https://issues.apache.org/jira/browse/SOLR-3177
>             Project: Solr
>          Issue Type: Improvement
>          Components: SearchComponents - other
>    Affects Versions: 3.5, 3.6, 4.0-ALPHA, 4.1
>            Reporter: Mathias H.
>            Assignee: Shalin Shekhar Mangar
>            Priority: Minor
>              Labels: localparams, stats, statscomponent
>         Attachments: SOLR-3177.patch, SOLR-3177.patch
>
>
> It would be useful to exclude the effects of some "fq" params from the set of documents used to compute stats -- similar to 
> how you can exclude tagged filters when generating facet counts... 
> https://wiki.apache.org/solr/SimpleFacetParameters#Tagging_and_excluding_Filters
> So that it's possible to do something like this... 
> http://localhost:8983/solr/select?fq={!tag=priceFilter}price:[1 TO 20]q=*:*&stats=true&stats.field={!ex=priceFilter}price 
> If you want to create a price slider this is very useful because then you can filter the price ([1 TO 20) and nevertheless get the lower and upper bound of the unfiltered price (min=0, max=100):
> {noformat}
> |<-[-------]-------------->|
> $0 $1     $20            $100
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

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