Пример #1
0
    app.get(/\/find$/, function(req, res) {
        var query = url.parse(req.url, true).query;
        var text = query.q;

        // Solr search options
        var start = query.start || 0;
        var options = { "fl" : "title,id,path,when,icon,size,mime_type",
            "defType" : "edismax",
            "qf" : "title text",
            "hl" : "on",
            "hl.fl" : "*",
            "start" : start,
            host : process.env.SOLR_HOST,
            port : process.env.SOLR_PORT
        };
        text = formatSearchQuery(text);
        solr.createClient().query(text, options, function(err, reply) {
            if (err) {
                console.log(err);
                res.writeHead(500);
            } else {
                res.write(reply);
            }
            res.end();
        });
    });
Пример #2
0
// Main loop
function main() {
    solrClient = solr.createClient();
    dboxClient = dbox.client(login_token);

    setInterval(function() { dequeueFile(dboxClient); }, 1000);

    processFiles(dboxClient, rootPath);
}
Пример #3
0
function start(port) {
    if(port === undefined)
    {
        port = 8888;
    }

    solr_client = solr.createClient('ausearchwebdev1','8080','/StockFundUniverse','/ausearch');


    load_authlist('./tests/data/auth_list.json');
    console.log('auth list has ' + authorized_clients.length + ' members');

    var app = express.createServer();
    app.get('/lookup/:client/:query', handleRequest);
    app.listen(port, "10.61.200.101");
    console.log("mstar_solr is listening on port " + +port);
}
Пример #4
0
var nconf      = require( 'nconf' );
nconf.argv().env().file( { file:  __dirname + '/config.json' } );
var solr       = require( 'solr' );
var solrClient = solr.createClient( nconf.get('solr') );


solrClient.del(null, '*:*', function(err, response) {
    if (err) throw err;
    console.log('Deleted all docs');
    solrClient.commit();
});
Пример #5
0
var solr = require('solr');

var client = solr.createClient({
  core: "/tweets"
});

// solrClient.autoCommit = true;

module.exports = client;
Пример #6
0
    v = vector(0.57,-1.01,0.66,0.11)
    q = {!boost b=$b defType=dismax v=$qq}

**/


var solr = require('solr');
var request = require('request');
var readline = require('readline');

var solrConf = {
    core:'/imdb',
    port:8080
};

var client = solr.createClient(solrConf);

function movieContent(name, callback) {
    path = '/?type=json&plot=full&episode=1&limit=1&yg=0&mt=none&lang=en-US&offset=&aka=simple&release=simple&business=0&tech=0';
    if (name.match(/^tt/)) {
      path += '&ids=' + name;
    } else {
      path += '&title='+ encodeURIComponent(name.replace(/^.*\((.*)\) (\(\d{4}\))$/, '$1 $2'))
    }
//    console.info(path);
    request({url: 'http://imdbapi.org' + path, json:true}, function (error, response, body) {
	if (!error && response.statusCode == 200 && typeof body.code == 'undefined') {
	    callback(body[0])
	} else {
	    console.log("Movie '" + name + "' wasn't found " + body.code)
	}
Пример #7
0
var solr = require('solr');

var client = solr.createClient();
var doc1 = {
    id: '1',
    title_t: 'Foo bar',
    text_t: 'Fizz buzz frizzle'
};
var doc2 = {
    id: '2',
    title_t: 'Far boo',
    text_t: 'Wuzz fizz drizzle'
};

client.add(doc1, function(err) {
    if (err) throw err;
});
Пример #8
0
var config = require("./config/config.js"),
    amqp_config = require("./config/amqp.js"),
    syslogParser = require('glossy').Parse,
    dgram = require('dgram'),
    solr = require('solr'),
    riak = require('riak-js'),
    crypto = require('crypto'),
    amqp = require('amqp');


var db = riak.getClient(config)
var solrc = solr.createClient(config.solr_params);

function houseKeeping() {

	v = db.get('system_config', 'SystemAttr', function(err, d, meta) {
		if (err) {
			return;
		}
		data  = JSON.parse(d);
		days = parseInt(data.housekeeping_days);
		if (days > 0) {
			//console.log("house keeping " + days);
			solrc.del(null, "timestamp:[NOW-5YEAR TO NOW-"+ days + "DAY]", function() { solrc.commit() });
		}


	});


}
Пример #9
0
delete module.moduleCache[module.id];

helper = require('./helper');

var sys = require('sys');
var solr = require("solr");
var search_fields = ['text', 'hashtag', 'mentions', 'in_reply_to_screen_name', 'url'];

var solr_client = solr.createClient();

exports.handle = function(req, res, username) {
  var query_param = req.param('q');
  if (query_param && query_param !== '*' && query_param !== '<enter search terms>') {
    var query = [];
    search_fields.forEach(function(value){
      query.push(value + ":(" + query_param + ") ");
       // TODO: ~ = Fuzzy search
    });
    query = query.join(' OR ');
  }
  else {
    query = '*';
  }
  
  var options = {
    fq: "screen_name:" + username
  };

  solr_client.query(query, options, function(i, data){
    if (data) {
      data = JSON.parse(data);
Пример #10
0
var config = require("./config/config.js");
var amqp = require("amqp");
//var memcache = require('memcache');
//var uuid = require('simple-uuid');
var crypto = require('crypto');
var redis = require('redis');
var packs = Array();


//var redisc = redis.createClient(null, '172.16.185.8', 6379);
var redisc = redis.createClient(config.redis_port, config.redis_ip);


var client = solr.createClient(
{ host: config.solr_ip,
  port: config.solr_port,
  core: config.solr_core
});

setInterval(function() { client.commit();  }, 1000);

//var mcache = new memcache.Client(11211, 'localhost');
//mcache.port = 11211;
//mcache.host = 'localhost';

//mcache.connect();




function setup() {