Skip to content

Commit

Permalink
Added script to search blog
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmerfield committed Nov 11, 2019
1 parent 87e4bc6 commit 1fcde73
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions scripts/blog/search.js
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,17 @@
var Entry = require("entry");
var reds = require("reds");
var transliterate = require("transliteration");
var get = require("../get/blog");

get(process.argv[2], function(err, user, blog) {
if (err) throw err;
var string = process.argv[3];
var search = reds.createSearch("blog:" + blog.id + ":search");

search.query(transliterate(string)).end(function(err, ids) {
console.log(ids);
Entry.get(blog.id, ids, function(entries) {
console.log("found", entries.length, "entries");
});
});
});

0 comments on commit 1fcde73

Please sign in to comment.