Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-10157

JSON Facets should give more helpful error msg when users attempt to an unknown aggregation

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 8.6
    • Facet Module
    • None

    Description

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

      > 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?
      

      And the subsequent followup from the same user...

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

      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

      Attachments

        1. SOLR-10157.patch
          4 kB
          Munendra S N
        2. SOLR-10157.patch
          4 kB
          Munendra S N

        Activity

          People

            munendrasn Munendra S N
            hossman Chris M. Hostetter
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: