summaryrefslogtreecommitdiff
path: root/bucky/search/lexicon.js
diff options
context:
space:
mode:
Diffstat (limited to 'bucky/search/lexicon.js')
-rw-r--r--bucky/search/lexicon.js12
1 files changed, 5 insertions, 7 deletions
diff --git a/bucky/search/lexicon.js b/bucky/search/lexicon.js
index dc1d7ab..ea99535 100644
--- a/bucky/search/lexicon.js
+++ b/bucky/search/lexicon.js
@@ -1,10 +1,8 @@
require('dotenv').load();
var STOPWORDS = require('./stopwords')
-var bdb = require('./bdb')
var db = require('../db')
-
-var search_db = bdb('search')
+var redisClient = require('./redis-client');
var lexicon = {}
var lex_counts = {}
@@ -26,6 +24,7 @@ function build_index(cb) {
return { total, unique }
})
}
+
function parse_threads() {
return db.Thread.where('id', '>', 1).fetchAll().then( (threads) => {
console.log('got threads', threads.length)
@@ -41,8 +40,7 @@ function parse_comments() {
return db.Comment.where('thread', '>', 1).fetchAll().then( (comments) => {
console.log('got comments', comments.length)
comments.forEach( (comment) => {
- total += parse_terms({
- string: comment.get('comment').toString(),
+ total += parse_terms({ string: comment.get('comment').toString(),
thread: comment.get('thread'),
comment: comment.get('id'),
})
@@ -107,7 +105,7 @@ function lexicon_store () {
put_total += 1
// if (put_total > 10) return
// console.log(term)
- search_db.put(term, serialized)
+ redisClient.set(term, serialized)
})
}
function serialize_matches (term) {
@@ -126,4 +124,4 @@ function serialize_matches (term) {
})
if (!serialized_matches.length) return
return serialized_matches.join(',')
-} \ No newline at end of file
+}