Hoss Man created SOLR-10157:
-------------------------------

             Summary: JSON Facets should give more helpful error msg when users 
attempt to an unknown aggregation
                 Key: SOLR-10157
                 URL: https://issues.apache.org/jira/browse/SOLR-10157
             Project: Solr
          Issue Type: Improvement
      Security Level: Public (Default Security Level. Issues are Public)
            Reporter: Hoss Man


Sample question from a confused solr-user email...

{noformat}
> I'm getting this error when I tried to do a division in JSON Facet.
>
>   "error":{
>     "msg":"org.apache.solr.search.SyntaxError: Unknown aggregation agg_div in 
> ('div(4,2)', pos=4)",
>     "code":400}}
>
>
> Is this division function supported in JSON Facet?
{noformat}

And the subsequent followup from the same user...

bq. I found that we can't put div(4,2) directly, as it wouldn't work.

bq. It will work if I put something like max(div(4,2)).

----

It seems like a better error handline code path for 
{{FunctionQParser.parseAgg}} (once we've confirmed no such aggregation exists) 
would be:

* attempt to parse the original string as a regular (non-Agg)ValueSource) 
function
** if that succeeds, give the user an error indicating that this ValueSource 
must be wrapped in an aggregation
** if it fails, continue to throw the original error
* either way, any error thrown should refer to the _original_ {{id}} before 

For example: 
* {{div(price,popularity)}} should throw an error with a msg along the lines 
of: {{'div' is a per-document function, not a multi-document aggregation 
function, input: div(price,popularity)}}
*  {{HOSS(price,popularity)}} on the other hand should throw an error such as: 
{{Unknown aggregation HOSS in ('HOSS(price,populaity)' ...}}
** note the message cites {{HOSS}} not {{agg_HOSS}}






--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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

Reply via email to