Solr
  1. Solr
  2. SOLR-6565

SolrRequest support for query params

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0, 6.0
    • Component/s: SolrJ
    • Labels:
      None

      Description

      Today, queryParams (sending params via the queryString) is only supported at the HttpSolrServer level. In an effort to make SolrRequests more generally useful (a la SOLR-6543), it would be nice if you could set the queryParams on a per-request basis.

      1. SOLR-6565.patch
        10 kB
        Gregory Chanan
      2. SOLR-6565.patch
        10 kB
        Gregory Chanan

        Activity

        Hide
        Gregory Chanan added a comment -

        Here's a small patch that implements this and adds a test to BasicHttpSolrServerTest

        Show
        Gregory Chanan added a comment - Here's a small patch that implements this and adds a test to BasicHttpSolrServerTest
        Hide
        Mark Miller added a comment -

        +1

        Show
        Mark Miller added a comment - +1
        Hide
        Gregory Chanan added a comment -

        Trivial change to get rid of an unused value. Going to commit soon if no objections.

        Show
        Gregory Chanan added a comment - Trivial change to get rid of an unused value. Going to commit soon if no objections.
        Hide
        Yonik Seeley added a comment -

        Can you show an example of how this works?
        I see this:

        +  public void setQueryParams(Set<String> queryParams) {
        +    this.queryParams = queryParams;
        +  }
        

        But query params normally have keys and values so I would have expected an argument more along the lines of
        SolrParams or Map<String,String[]> or something...

        Show
        Yonik Seeley added a comment - Can you show an example of how this works? I see this: + public void setQueryParams(Set< String > queryParams) { + this .queryParams = queryParams; + } But query params normally have keys and values so I would have expected an argument more along the lines of SolrParams or Map<String,String[]> or something...
        Hide
        Gregory Chanan added a comment -

        Yonik,

        It's a set of param keys; if the request has a SolrParam with that key it is guaranteed to be output in the queryString rather than the message body (either b/c it's a GET and we always send the params as the queryString, or because of our special logic for PUT/POST methods). I originally had it the way you suggest (actually used SolrParams), but HttpSolrServer already does it the Set<String> way so it seemed better to be consistent.

        Show
        Gregory Chanan added a comment - Yonik, It's a set of param keys; if the request has a SolrParam with that key it is guaranteed to be output in the queryString rather than the message body (either b/c it's a GET and we always send the params as the queryString, or because of our special logic for PUT/POST methods). I originally had it the way you suggest (actually used SolrParams), but HttpSolrServer already does it the Set<String> way so it seemed better to be consistent.
        Hide
        Yonik Seeley added a comment -

        if the request has a SolrParam with that key it is guaranteed to be output in the queryString rather than the message body

        Ah, got it. Thanks!

        Show
        Yonik Seeley added a comment - if the request has a SolrParam with that key it is guaranteed to be output in the queryString rather than the message body Ah, got it. Thanks!
        Hide
        ASF subversion and git services added a comment -

        Commit 1627898 from gchanan@apache.org in branch 'dev/trunk'
        [ https://svn.apache.org/r1627898 ]

        SOLR-6565: SolrRequest support for query params

        Show
        ASF subversion and git services added a comment - Commit 1627898 from gchanan@apache.org in branch 'dev/trunk' [ https://svn.apache.org/r1627898 ] SOLR-6565 : SolrRequest support for query params
        Hide
        ASF subversion and git services added a comment -

        Commit 1627899 from gchanan@apache.org in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1627899 ]

        SOLR-6565: SolrRequest support for query params

        Show
        ASF subversion and git services added a comment - Commit 1627899 from gchanan@apache.org in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1627899 ] SOLR-6565 : SolrRequest support for query params
        Hide
        Anshum Gupta added a comment -

        Bulk close after 5.0 release.

        Show
        Anshum Gupta added a comment - Bulk close after 5.0 release.

          People

          • Assignee:
            Gregory Chanan
            Reporter:
            Gregory Chanan
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development