In-memory Full-Text searching for Node.js
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.travis.yml
Parser.js
README.md
app.js
index.js
package.json
scratchpad.txt

README.md

Full-Text Search engine for NodeJS

Node-FT adds basic in-memory Full-Text search capabilities to Node. Supporting:

  • Document Indexing
  • Results Sorting
  • AND / OR Operations
  • Nested Expresions: First and (whole or world or (another word))

=======

Installation

npm install node-ft

NPM

======= Basic Usage

var nodeFT= require('node-ft');

var inx = nodeFT();

inx.index('1', "this is some text");
inx.index('2', "this is some more text");

var docs = inx.search("this");

Document storage

inx.index('1', "this is some text",
{ 
    value: 12,
    some: 'this is a doc' 
});

var docs = inx.search("this");

console.log(docs[0].doc.value);

Sort Results

var docs = inx.search("this", function(result) {
    return result.doc.sort;
});

Delete Document

inx.delete('2');

OR expressions

var docs = inx.search("this or that", function(result) {
    return result.doc.sort;
});

Nested Expressions

var docs = inx.search("this or (that and other)", function(result) {
    return result.doc.sort;
});

Clear Index

inx.clear();

Get Document Count

var docCount = inx.count();