New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

orchestrate

Package Overview
Dependencies
Maintainers
3
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

orchestrate - npm Package Compare versions

Comparing version

to
0.3.9

5

lib/client.js

@@ -163,5 +163,6 @@ // Copyright 2013 Bowery Software, LLC

*/
Client.prototype.search = function (collection, query) {
Client.prototype.search = function (collection, query, options) {
assert(collection && query, 'Collection and query required.')
return this._get(this.generateApiUrl([collection], {query: query}))
options.query = query;
return this._get(this.generateApiUrl([collection], options))
}

@@ -168,0 +169,0 @@

2

lib/event.js

@@ -90,3 +90,3 @@ // Copyright 2013 Bowery Software, LLC

EventBuilder.prototype.ordinal = function (order) {
assert(typeof order == 'number', 'Ordinal must be a number.')
assert(['number', 'string'].indexOf(typeof(order)) !== -1, 'Ordinal must be a number or a string.')
this.order = order

@@ -93,0 +93,0 @@ return this

@@ -65,3 +65,5 @@ // Copyright 2013 Bowery Software, LLC

assert(!!~['asc','desc'].indexOf(order), 'valid order required')
this._sort = 'value.' + field + ':' + order
var _sort = 'value.' + field + ':' + order
if (this._sort) this._sort = [this._sort, _sort].join(',')
else this._sort = _sort
return this

@@ -68,0 +70,0 @@ }

@@ -28,3 +28,3 @@ {

},
"version": "0.3.8",
"version": "0.3.9",
"main": "index",

@@ -31,0 +31,0 @@ "tags": [

@@ -192,6 +192,10 @@ # orchestrate.js [![Build Status](https://travis-ci.org/orchestrate-io/orchestrate.js.png)](https://travis-ci.org/orchestrate-io/orchestrate.js) [![Coverage Status](https://coveralls.io/repos/orchestrate-io/orchestrate.js/badge.png)](https://coveralls.io/r/orchestrate-io/orchestrate.js)

To run a quick search, you can simply provide the collection you'd like to search within, and your query. Orchestrate supports any type of query including lucene queries.
To run a quick search, you can simply provide the collection you'd like to search within, your query, and optionally, any query parameters like a `list` or `sort` argument. Currently, Orchestrate supports the [Lucene query syntax](http://lucene.apache.org/core/2_9_4/queryparsersyntax.html).
```javascript
db.search('collection', 'query')
db.search('collection', 'query', {
sort: 'value.sort:desc',
limit: 5,
offset: 2
})
.then(function (result) {

@@ -205,3 +209,3 @@

If you want to include a limit or offset, the more verbose `SearchBuilder` is available:
The more verbose `SearchBuilder` is also available for a more stately approach:

@@ -213,5 +217,9 @@ ```javascript

.offset(10)
.sort('name', 'desc')
.sort('age', 'asc')
.query('steve')
```
For more information about Orchestrate search, [read the docs](http://orchestrate.io/docs/apiref#search).
## Graphs

@@ -218,0 +226,0 @@ An awesome feature Orchestrate includes is the ability to generate graphs between collections. For example, consider the collections `users` and `movies`. Some user Steve will `like` a variety of movies. We can generate this relationship:

@@ -25,3 +25,3 @@ // Copyright 2013 Bowery Software, LLC

var fakeOrchestrate = nock('https://api.orchestrate.io/')
.get('/v0/users?query=new%20york')
.get('/v0/users?sort=value.name%3Aasc&query=new%20york')
.reply(200, {

@@ -55,3 +55,5 @@ "results": [

test('Get value by query', function (done) {
db.search('users', 'new york')
db.search('users', 'new york', {
sort: 'value.name:asc'
})
.then(function (res) {

@@ -62,2 +64,3 @@ assert.equal(200, res.statusCode)

})
.fail(done)
})

@@ -64,0 +67,0 @@

@@ -21,3 +21,3 @@ // Copyright 2013 Bowery Software, LLC

"timestamp": 1369832019085,
"ordinal": 9,
"ordinal_str": "9",
"ref": "ae3dfa4325abe21e"

@@ -37,3 +37,3 @@ },

"timestamp": 1369832019080,
"ordinal": 7,
"ordinal_str": "7",
"ref": "f8a86a25029a907b"

@@ -83,3 +83,3 @@ },

.time(1369832019085)
.ordinal(9)
.ordinal('9')
.type('update')

@@ -86,0 +86,0 @@ .get()

@@ -73,2 +73,4 @@ // Copyright 2013 Bowery Software, LLC

.reply(204)
.get('/v0/users?query=new%20york&sort=value.name%3Adesc%2Cvalue.age%3Aasc')
.reply(200)

@@ -111,2 +113,15 @@ suite('Search', function () {

})
test('Multiple field sort', function (done) {
db.newSearchBuilder()
.collection('users')
.sort('name', 'desc')
.sort('age', 'asc')
.query('new york')
.then(function (res) {
assert.equal(200, res.statusCode)
done()
})
.fail(done)
})
})