In my application I'm POSTing into the Solr for querying, and need to specify any number of "constraints" (which correspond to BitSet filters that get combined into a BitDocSet as a filter on the query). Rather than have the client uniquely name each of the parameters, I want to name them all "constraint" in the request. The servlet API supports this, but SolrQueryRequest currently does not. I've patched my local copy with the following and it all works fine. For LocalSolrQueryRequest, since it is using a Map for the arguments anyway, I simply added the new getParams method to return a single item array.

Any objections to me committing this?

Thanks,
        Erik



Index: src/java/org/apache/solr/request/LocalSolrQueryRequest.java
===================================================================
--- src/java/org/apache/solr/request/LocalSolrQueryRequest.java (revision 395947) +++ src/java/org/apache/solr/request/LocalSolrQueryRequest.java (working copy)
@@ -70,6 +70,10 @@
     return (String)args.get(name);
   }
+  public String[] getParams(String name) {
+    return new String[] {(String)args.get(name)};
+  }
+
   public String getQueryString() {
     return query;
   }
Index: src/java/org/apache/solr/request/SolrQueryRequest.java
===================================================================
--- src/java/org/apache/solr/request/SolrQueryRequest.java (revision 395947) +++ src/java/org/apache/solr/request/SolrQueryRequest.java (working copy)
@@ -31,6 +31,8 @@
   public String getParam(String name);
+  public String[] getParams(String name);
+
   public String getQueryString();
   // signifies the syntax and the handler that should be used
Index: src/webapp/src/org/apache/solr/servlet/SolrServletRequest.java
===================================================================
--- src/webapp/src/org/apache/solr/servlet/ SolrServletRequest.java (revision 395947) +++ src/webapp/src/org/apache/solr/servlet/ SolrServletRequest.java (working copy)
@@ -25,7 +25,11 @@
     return req.getParameter(name);
   }
+  public String[] getParams(String name) {
+    return req.getParameterValues(name);
+  }
+
   public String getParamString() {
     StringBuilder sb = new StringBuilder(128);
     try {

Reply via email to