Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

port of setfilterrange function

  • Loading branch information...
commit b1e229e5729b29d94adddf42971ce210e928b8f3 1 parent 0539a99
@touv authored
Showing with 23 additions and 2 deletions.
  1. +23 −2 lib/sphinxapi.js
View
25 lib/sphinxapi.js
@@ -336,7 +336,9 @@ SphinxClient.prototype.SetIDRange = function (minid, maxid) {
};
SphinxClient.prototype.SetFilter = function (attribute, values, exclude) {
var self = this
- if (exclude == undefined) exclude = 0;
+ if (exclude === undefined) {
+ exclude = 0
+ }
assert.equal(typeof attribute, 'string')
forEach(values, function (item, index) {
assert.equal(typeof item, 'number')
@@ -347,7 +349,26 @@ SphinxClient.prototype.SetFilter = function (attribute, values, exclude) {
'exclude': exclude,
'values': values
})
-};
+ };
+SphinxClient.prototype.SetFilterRange = function (attribute, min_, max_, exclude) {
+ var self = this
+ if (exclude === undefined) {
+ exclude = 0
+ }
+ assert.equal(typeof attribute, 'string')
+ assert.equal(typeof min_, 'number')
+ assert.equal(typeof max_, 'number')
+ assert(min_<=max_)
+
+ self._filters.push({
+ 'type': SphinxClient.SPH_FILTER_RANGE
+ , 'attr': attribute
+ , 'exclude': exclude
+ , 'min': min_
+ , 'max': max_
+ } )
+ }
+
SphinxClient.prototype.SetGeoAnchor = function (attrlat, attrlong, latitude, longitude) {
var self = this
assert.equal(typeof attrlat, 'string')

0 comments on commit b1e229e

Please sign in to comment.
Something went wrong with that request. Please try again.