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

Ability to specify a query with a parameter name (in facet filter)

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.4, 7.0
    • Component/s: Facet Module
    • Security Level: Public (Default Security Level. Issues are Public)
    • Labels:
      None

      Description

      Currently, "filter" only supports query strings (examples at http://yonik.com/solr-json-request-api/ )

      It would be nice to be able to reference a param that would be parsed as a lucene/solr query. Multi-valued parameters should be supported.

      We should keep in mind (and leave room for) a future "JSON Query Syntax" and chose labels appropriately.

      1. SOLR-9682.patch
        6 kB
        Yonik Seeley

        Issue Links

          Activity

          Hide
          yseeley@gmail.com Yonik Seeley added a comment - - edited

          example:

          curl 'http://localhost:8983/solr/query?myfilter=user:Yonik+rating:5' -d '
          {
            query : "awesome",
            limit : 10,
            filter : { param : myfilter }
          }'
          

          When we finally get around to specifying a complete query language in JSON, we'll want this to slide right in. So think of "queryParam" as the type of the query. The value is retrieved from "params" and parsed as a lucene/solr query. paramToSolrQuery would be more exact/descriptive, but too long and awkward to remember exactly.
          "deref" or "dereference" ?

          Show
          yseeley@gmail.com Yonik Seeley added a comment - - edited example: curl 'http: //localhost:8983/solr/query?myfilter=user:Yonik+rating:5' -d ' { query : "awesome" , limit : 10, filter : { param : myfilter } }' When we finally get around to specifying a complete query language in JSON, we'll want this to slide right in. So think of "queryParam" as the type of the query. The value is retrieved from "params" and parsed as a lucene/solr query. paramToSolrQuery would be more exact/descriptive, but too long and awkward to remember exactly. "deref" or "dereference" ?
          Hide
          yseeley@gmail.com Yonik Seeley added a comment -

          Here's a patch that adds the ability to use "param" in a filter list in faceting, per the example above.

          It is not implemented for non-faceting (the top-level filter parameter) since that currently works in a back-compat manner through "fq" parameters. I'll probably separate that out to it's own issue.

          Show
          yseeley@gmail.com Yonik Seeley added a comment - Here's a patch that adds the ability to use "param" in a filter list in faceting, per the example above. It is not implemented for non-faceting (the top-level filter parameter) since that currently works in a back-compat manner through "fq" parameters. I'll probably separate that out to it's own issue.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 4b3e7f2fe2bb7d3bdcd4a2e2d8d786caa281040d in lucene-solr's branch refs/heads/master from Yonik Seeley
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=4b3e7f2 ]

          SOLR-9682: add param query type to facet filter

          Show
          jira-bot ASF subversion and git services added a comment - Commit 4b3e7f2fe2bb7d3bdcd4a2e2d8d786caa281040d in lucene-solr's branch refs/heads/master from Yonik Seeley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=4b3e7f2 ] SOLR-9682 : add param query type to facet filter
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit b157e43b9a2afc7724c343c8ea8fff62b606cbf9 in lucene-solr's branch refs/heads/branch_6x from Yonik Seeley
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=b157e43 ]

          SOLR-9682: add param query type to facet filter

          Show
          jira-bot ASF subversion and git services added a comment - Commit b157e43b9a2afc7724c343c8ea8fff62b606cbf9 in lucene-solr's branch refs/heads/branch_6x from Yonik Seeley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=b157e43 ] SOLR-9682 : add param query type to facet filter
          Hide
          dsmiley David Smiley added a comment -

          What about filter : "$myFilterParam" – thus have certain value resolution support dollar sign references, consistent with local-params? That way we needn't make some parameters support structured values unnecessarily, requiring more names (i.e. "param").

          Show
          dsmiley David Smiley added a comment - What about filter : "$myFilterParam" – thus have certain value resolution support dollar sign references, consistent with local-params? That way we needn't make some parameters support structured values unnecessarily, requiring more names (i.e. "param").
          Hide
          yseeley@gmail.com Yonik Seeley added a comment -

          I considered that, but he long view is that a filter is a list of queries in JSON Query Syntax (there's an old issue open, never got to finish it),
          and a string is a query in lucene/solr syntax. So for maximum consistency, one would then want to change lucene/solr syntax to accept "$myFilterParam" as well.
          If not, one would then need to escape queries differently depending on if they will be used in something like "fq" vs "filter".

          Show
          yseeley@gmail.com Yonik Seeley added a comment - I considered that, but he long view is that a filter is a list of queries in JSON Query Syntax (there's an old issue open, never got to finish it), and a string is a query in lucene/solr syntax. So for maximum consistency, one would then want to change lucene/solr syntax to accept "$myFilterParam" as well. If not, one would then need to escape queries differently depending on if they will be used in something like "fq" vs "filter".
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 4b3e7f2fe2bb7d3bdcd4a2e2d8d786caa281040d in lucene-solr's branch refs/heads/apiv2 from Yonik Seeley
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=4b3e7f2 ]

          SOLR-9682: add param query type to facet filter

          Show
          jira-bot ASF subversion and git services added a comment - Commit 4b3e7f2fe2bb7d3bdcd4a2e2d8d786caa281040d in lucene-solr's branch refs/heads/apiv2 from Yonik Seeley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=4b3e7f2 ] SOLR-9682 : add param query type to facet filter

            People

            • Assignee:
              yseeley@gmail.com Yonik Seeley
              Reporter:
              yseeley@gmail.com Yonik Seeley
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development