@ -38,14 +38,14 @@
winston.error('Unable to initialize Level DB! Is Level DB installed? Error :' + err.message);
process.exit();
}
if (db) {
if(typeof callback === 'function') {
callback();
return;
db = levelup(nconf.get('level:database'), {
valueEncoding: 'json'
@ -77,6 +77,10 @@
};
module.close = function(callback) {
db.close(callback);
var helpers = {};
helpers.iterator = function(fn, keys, value, callback) {
@ -5,10 +5,6 @@ var nconf = require('nconf'),
module.exports = function(db, module) {
var helpers = module.helpers.level;
module.searchIndex = function(key, content, id) {
// o.O
@ -45,7 +45,7 @@
winston.error('Unable to initialize MongoDB! Is MongoDB installed? Error :' + err.message);
mongoClient.connect('mongodb://'+ nconf.get('mongo:host') + ':' + nconf.get('mongo:port') + '/' + nconf.get('mongo:database'), function(err, _db) {
if(err) {
winston.error("NodeBB could not connect to your Mongo database. Mongo returned the following error: " + err.message);
@ -105,6 +105,11 @@
});
module.close = function() {
db.close();
helpers.findItem = function(data, key) {
if(!data) {
@ -4,10 +4,7 @@ var winston = require('winston');
var helpers = module.helpers.mongo;
var data = {
@ -101,5 +101,10 @@
redisClient.quit();
}(exports));
@ -1,10 +1,6 @@
"use strict";
module.exports = function(redisClient, module) {
if (key === 'post') {
module.postSearch.index(content, id);