search-sdk
Advanced tools
Comparing version 0.2.4 to 0.3.0
(function() { | ||
var AzureSearch, Promise, Search, _, | ||
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | ||
slice = [].slice; | ||
@@ -15,2 +16,6 @@ | ||
url = arg.url, key = arg.key, this.index = arg.index, this.facets = arg.facets; | ||
this.suggest = bind(this.suggest, this); | ||
this.find = bind(this.find, this); | ||
this.remove = bind(this.remove, this); | ||
this.save = bind(this.save, this); | ||
this.client = Promise.promisifyAll(new AzureSearch({ | ||
@@ -43,26 +48,37 @@ url: url, | ||
count: true | ||
}, query)).spread(function(items, response) { | ||
var __ignoreType, count, facets, next; | ||
__ignoreType = function(value, key) { | ||
return _.endsWith(key, "@odata.type"); | ||
}; | ||
next = _(response["@search.nextPageParameters"]).omit(__ignoreType).value(); | ||
facets = _(response["@search.facets"]).omitBy(__ignoreType).entries().map(function(arg) { | ||
var key, value; | ||
key = arg[0], value = arg[1]; | ||
}, query)).spread((function(_this) { | ||
return function(items, response) { | ||
var __ignoreType, count, facets, next; | ||
__ignoreType = function(value, key) { | ||
return _.endsWith(key, "@odata.type"); | ||
}; | ||
next = _(response["@search.nextPageParameters"]).omit(__ignoreType).value(); | ||
facets = _(response["@search.facets"]).omitBy(__ignoreType).entries().map(function(arg) { | ||
var key, value; | ||
key = arg[0], value = arg[1]; | ||
return { | ||
key: key, | ||
value: value | ||
}; | ||
}).value(); | ||
count = response["@odata.count"]; | ||
return { | ||
key: key, | ||
value: value | ||
items: items, | ||
facets: facets, | ||
next: next, | ||
count: count | ||
}; | ||
}).value(); | ||
count = response["@odata.count"]; | ||
return { | ||
items: items, | ||
facets: facets, | ||
next: next, | ||
count: count | ||
}; | ||
}); | ||
})(this)); | ||
}; | ||
Search.prototype.suggest = function(query) { | ||
if (query == null) { | ||
query = {}; | ||
} | ||
return this.client.suggestAsync(this.index, _.merge({ | ||
suggesterName: "sg" | ||
}, query)).get("0"); | ||
}; | ||
return Search; | ||
@@ -69,0 +85,0 @@ |
{ | ||
"name": "search-sdk", | ||
"version": "0.2.4", | ||
"version": "0.3.0", | ||
"description": "search-sdk", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
78
5186
7
1