Query your levelup/leveldb engine using full text search phrases with INDEXES.
This is a plugin for level-queryengine.
Install through npm:
$ npm install fulltext-engine
var levelQuery =fulltextEngine =levelup =db = ;dbquery;// index the properties you want (the 'doc' property on objects in this case):db;db;
Currently only one index strategy is supported:
'fulltext'(default) - full text index the property defined by the
Note: if you want to index another property with a different name than the
indexName then pass the property path through to the constructor of the
dbquery;// index 'stringfield' property of objectsdb;// index the 'anotherName' property of objects but store it in the 'oneName' indexdb;
If a full text index is not present for a query, then it will result in a full leveldb "table" scan. You will get the same results as an index query, it will just take longer.
The result stream that gets returned from
db#query also emits
so you can tell if an index did or didn't get used.
Returns a full text engine query engine for use with
Note: you can pass an optional boolean parameter to the contructor of the fulltextEngine factory function if you want to use a "fuzzy" search similar sounding words will match; (eg. "for" and "fear" would match under the fuzzy match).
Returns a full text engine indexing strategy to use with
If not provided, the
ensureIndex will index the object path defined by the index name.
Will seach the object path
pathName for the presence of
default search is an AND (ie. all search terms must be present). You can also
'or' if you want to match any documents that have ANY of the search
This project is under active development. Here's a list of things I'm planning to add:
- indexing the frequency of words as well and use it to rank better matching documents higher.
- proper Information Retrieval ranking algorithms