AJAX调用jQuery构建的查询字符串与重复键

Mar*_*k L 6 javascript jquery solr

Apache Solr要求发送到其端点的GET参数之一是重复的名称:

facet.range=price&facet.range=age
Run Code Online (Sandbox Code Playgroud)

文档在这里:

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

在jQuery中,如何将查询字符串参数(facet.range)包含两次?我不能用重复键创建一个对象,但这是我需要做的事情:

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) {
        ...
    }
});
Run Code Online (Sandbox Code Playgroud)

geo*_*org 13

使用'facet.range': ['price', 'age']你的params对象和设置traditional,以真正的Ajax调用执行参数的"传统"的系列化,这是foo=1&foo=2不是foo[]=1&foo[]=2.