Alex Rivera | Logout

AJAX call having jQuery-built query string with duplicate keys

Asked 2012-09-21T14:22:01.080
8

Apache Solr asks that one of the GET parameters sent to it's endpoint is a name duplicated:

facet.range=price&facet.range=age

Documentation here:

http://wiki.apache.org/solr/SimpleFacetParameters#facet.range

In jQuery, how can I include that query string parameter (facet.range) twice? I cannot make an object with duplicate keys, but this is along the lines of what I need to do:

context = {
    'facet.range': 'price',
    'facet.range': 'age', // This will be the only element in this dictionary as the key names are the same
}

$.ajax({
    type: "get",
    url: 'http://127.0.0.1:8983/solr/select',
    dataType:"jsonp",
    contentTypeString: 'application/json',
    jsonp:"json.wrf",
    data: context,
    success:function (data) {
        ...
    }
});
Edit
Report

1 Answer

-1

I am unfamiliar with Apache Solr but I know you can just re-create the URL to pass the parameters

$.ajax({
    type: "get",
    url: 'http://127.0.0.1:8983/solr/select?'+ "facet.range=price&facet.range=age",
    success:function (data) {
        ...
    }
});
answered 2012-09-21T14:29:56.207

Your Answer