Skip to content
Browse files

wired in new search route on registry

  • Loading branch information...
1 parent f7cfaf8 commit 1ba5f79b50b2e1dd648693827c2b2dfcb64bde5f @mbrevoort mbrevoort committed with isaacs May 3, 2011
Showing with 14 additions and 3 deletions.
  1. +14 −3 lib/search.js
View
17 lib/search.js
@@ -59,9 +59,20 @@ function search (args, silent, staleness, cb_) {
}
function getFilteredData (staleness, args, notArgs, cb) {
- registry.get("/-/all", null, staleness, function (er, data) {
- if (er) return cb(er)
- return cb(null, filter(data, args, notArgs))
+ var leftToRun = args.length
+ var aggregateData = {}
+
+ args.forEach(function (it) {
+ var u = "/-/search/\"" + it + "\"/\"" + it + "\"/25"
+ registry.get(u, null, staleness, function (er, data) {
+ if (er) return cb(er)
+ Object.keys(data).forEach(function (key) {
+ aggregateData[key] = data[key]
+ })
+ if (--leftToRun == 0) {
+ return cb(null, filter(aggregateData, args, notArgs))
+ }
+ })
})
}

0 comments on commit 1ba5f79

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