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 2017/11/29 21:50:00 UTC

[jira] [Commented] (SOLR-11706) JSON FacetModule can't compute stats (min,max,etc...) on multivalued fields

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

Hoss Man commented on SOLR-11706:
---------------------------------

Trivial steps to reproduce...

{noformat}
bin/solr -e techproducts
...
curl -H 'Content-Type: application/json' --data-binary '[{"id":"x","foo_is":42,"foo_is":666},{"id":"y","foo_is":55}'] 'http://localhost:8983/solr/techproducts/update?commit=true'
...
{noformat}

Note that {{stats.field}} has no problems with {{foo_is}}...
{noformat}
curl 'http://localhost:8983/solr/techproducts/query?&stats=true&stats.field=foo_is&q=*:*&rows=0&omitHeader=true'
{
  "response":{"numFound":34,"start":0,"docs":[]
  },
  "stats":{
    "stats_fields":{
      "foo_is":{
        "min":42.0,
        "max":666.0,
        "count":3,
        "missing":32,
        "sum":763.0,
        "sumOfSquares":448345.0,
        "mean":254.33333333333334,
        "stddev":356.5730406709589}}}}
{noformat}

But the JSON FacetModule can't compute similar stats...
{noformat}
curl http://localhost:8983/solr/techproducts/query -d 'q=*:*&rows=0&omitHeader=true&json.facet=
{ min:"min(foo_is)", max:"max(foo_is)", sum:"sum(foo_is)",
  // count and missing not supported, see SOLR-11695
  sumOfSquares:"sumsq(foo_is)", mean:"avg(foo_is)", stddev:"stddev(foo_is)"
}'
{
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","org.apache.solr.common.SolrException"],
    "msg":"can not use FieldCache on multivalued field: foo_is",
    "code":400}}
{noformat}

stack trace from logs...

{noformat}
ERROR - 2017-11-29 21:40:30.417; [   x:techproducts] org.apache.solr.common.SolrException; org.apache.solr.common.SolrException: can not use FieldCache on multivalued field: foo_is
        at org.apache.solr.schema.SchemaField.checkFieldCacheSource(SchemaField.java:190)
        at org.apache.solr.schema.IntPointField.getValueSource(IntPointField.java:149)
        at org.apache.solr.search.FunctionQParser.parseValueSource(FunctionQParser.java:384)
        at org.apache.solr.search.FunctionQParser.parseValueSource(FunctionQParser.java:237)
        at org.apache.solr.search.ValueSourceParser$86.parse(ValueSourceParser.java:977)
        at org.apache.solr.search.FunctionQParser.parseAgg(FunctionQParser.java:421)
        at org.apache.solr.search.facet.FacetParser.parseStringStat(FacetRequest.java:429)
        at org.apache.solr.search.facet.FacetParser.parseStringFacetOrStat(FacetRequest.java:422)
        at org.apache.solr.search.facet.FacetParser.parseFacetOrStat(FacetRequest.java:352)
        at org.apache.solr.search.facet.FacetParser.parseSubs(FacetRequest.java:332)
        at org.apache.solr.search.facet.FacetTopParser.parse(FacetRequest.java:601)
        at org.apache.solr.search.facet.FacetTopParser.parse(FacetRequest.java:590)
        at org.apache.solr.search.facet.FacetModule.prepare(FacetModule.java:102)
        at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:269)
        at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:177)
        at org.apache.solr.core.SolrCore.execute(SolrCore.java:2484)
 
{noformat}


(some other testing suggests that this problem exists regardless of whether TrieInt or IntPoint fields are used ... i didn't explicitly test float/long/double/etc... but based on a quick glance at the code i don't see any reason why they wouldn't all be equally affected)

> JSON FacetModule can't compute stats (min,max,etc...) on multivalued fields
> ---------------------------------------------------------------------------
>
>                 Key: SOLR-11706
>                 URL: https://issues.apache.org/jira/browse/SOLR-11706
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Hoss Man
>
> While trying to write some tests demonstrating equivalences between the StatsComponent and the JSON FacetModule i discovered that the FacetModules stat functions (min, max, etc...) don't seem to work on multivalued fields.
> Based on the stack traces, i gather the problem is because the FacetModule seems to rely exclusively on using the "Function" parsers to get a value source -- apparently w/o any other method of accumulating numeric stats from multivalued (numeric) DocValues?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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