
Semantics3 node
Limestone (source code), a Node.js connector to Sphinx search server, is a quite handy library written by Serge Shirokov.
In using Limestone for some of my work recently, though, I found that it was missing proper support for geosearch, i.e., searching by distance given latitude-longitude pairs. I’ve augmented the library to support a geo-search only application that I recently built.
Clone my fork of Limestone from:
Sample code:
var filter_floatrange = { 'type':2, //FLOATRANGE 'min':0, 'max': mymiles * 1.161 * 1000, // converted to km 'attr':'@geodist' } var ganchor = { 'attrlat':'latitude', 'attrlong':'longitude', 'lat': mylat * (3.14159265/180), // mylat and mylon in degrees 'long': mylon *(3.14159265/180) } var sort = 4; // Extended search var sortby = '@geodist ASC'; limestone.connect(9312, function(err) { if (!err) { limestone.query({'query':'Robbery', sort: sort, sortby: sortby, indices:'geo', anchor:[ganchor], filters:[filter_floatrange]}, function(err, answer){ if (!err) { console.log("Extended search yielded " + answer.match_count + " results: " + JSON.stringify(answer)); } else { console.log('Request error: ' + err); } }); } else { console.log('Error on search: ' + err); } });
You might also like


Word Meaning and Montague Grammar: The Semantics of Verbs and Times in Generative Semantics and in Montague's PTQ (Studies in Linguistics and Philosophy, Vol. 7) Book (D. Reidel Publishing Company)
|