I don’t want to use the “=” (model=book) and “&” (model=book&model=cds) signs, but I need pair values (model:book) and the “+” sign (model:book+model:cds).
Hi,
“model” is a parameter and “book” , “cds” etc it’s values. Unfortunately for me, this is the syntax that the search engine I have chosen is accepting
what do you mean 'build'? do you have some list of these models/books/cds etc.? or you need just 1 string? is it a page with some fields to input all thiese params? you question is not clear
use [code]YOUR CODE GOES HERE[/code] or burn in Hell
<script type="text/javascript">
var surl = "http://localhost:8080/solr/select/?q=";
var pre = "&fq=";
var value = "*:*";
var a = "member";
var b = "new_member";
var c = "book";
var d = "journal";
var e = "cds";
var f = "pdfs";
serialize = function(obj) {
var str = [];
for(var p in obj)
str.push(encodeURIComponent(p) + ":" + encodeURIComponent(obj[p]));
return str.join("+");
}
serialize_1 = function(obj, prefix) {
var str = [];
for(var p in obj) {
var k = prefix ? prefix + "[" + p + "]" : p, v = obj[p];
str.push(typeof v == "object" ?
serialize(v, k) :
encodeURIComponent(k) + "=" + encodeURIComponent(v));
}
return str.join("+");
}
var enc = serialize_1([{model: a},{model: b},{model: c},{model: d},{model: e},{model: f}]);
var query = surl + value + pre + enc;
console.log(query);
</script>
Bookmarks