Apache Solr要求发送到其端点的GET参数之一是重复的名称:
facet.range=price&facet.range=age
文档在这里:
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) {
...
}
});
解决方法
在params对象中使用’facet.range’:[‘price’,’age’]并在ajax调用中将Traditional设置为true,以强制执行参数的“传统”序列化,即foo = 1& foo = 2 of foo [] = 1& foo [] = 2.