-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsolrModule.js
More file actions
61 lines (55 loc) · 1.84 KB
/
Copy pathsolrModule.js
File metadata and controls
61 lines (55 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
var PostToSolr = function (query, filter, nofRows, facet) {
/*
*
* filter is always an array and depending on the number of arguments
* that have to be added to the filter query option its lentgth varies.
*/
var filterQuery;
if ( filter.length > 2 ) {
for ( var i = 0, ilen = filter.length; i < ilen; i++ ) {
if ( i !== ilen - 1) {
filterQuery += filter[i] + ' AND ';
}
}
} else if ( filter.length === 1 ) {
filterQuery = filter.pop();
} else {
filterQuery = null;
}
var data = {
'q' : query,
'fq' : filterQuery,
'wt' : 'json',
//'indent': 'true',
'rows' : nofRows.toString()
}
if ( facet ) {
data['json.facet'] = "{" +
"conditions : {" +
"terms : {" +
"field : 'condition_id'," +
"numBuckets : true," +
"limit : 0," +
"sort : { index: 'asc' }," +
"facet : {" +
"sum : 'sum(expression_value_d)'," +
"sumsq : 'sumsq(expression_value_d)'," +
"avg : 'avg(expression_value_d)'," +
"max : 'max(expression_value_d)'," +
"min : 'min(expression_value_d)'," +
"percentiles : 'percentile(expression_value_d, 25, 50, 75, 99, 99.9)'" +
"}" +
"}" +
"}" +
"}";
};
console.log(data);
return $.ajax({
url : 'http://localhost:8983/solr/circos/query',
method : 'POST',
datatype : 'jsonp',
jsonp : 'json.wrf',
data : data
});
var _privateMethod = function () {};
};