flexsearch
Advanced tools
Changelog
v0.7.0
append
under the hood to provide a unique relevance context for each entry)These features have been removed:
index.info()
offset
)The "async" options was removed, instead you can call each method in its async version, e.g.
index.addAsync
orindex.searchAsync
.
Define document fields as object keys is not longer supported due to the unification of all option payloads.
A full configuration example for a context-based index:
var index = new Index({
tokenize: "strict",
resolution: 9,
minlength: 3,
optimize: true,
fastupdate: true,
cache: 100,
context: {
depth: 1,
resolution: 3,
bidirectional: true
}
});
The resolution
could be set also for the contextual index.
A full configuration example for a document based index:
const index = new Document({
tokenize: "forward",
optimize: true,
resolution: 9,
cache: 100,
worker: true,
document: {
id: "id",
tag: "tag",
store: [
"title", "content"
],
index: [{
field: "title",
tokenize: "forward",
optimize: true,
resolution: 9
},{
field: "content",
tokenize: "strict",
optimize: true,
resolution: 9,
minlength: 3,
context: {
depth: 1,
resolution: 3
}
}]
}
});
A full configuration example for a document search:
index.search({
enrich: true,
bool: "and",
tag: ["cat", "dog"],
index: [{
field: "title",
query: "some query",
limit: 100,
suggest: true
},{
field: "content",
query: "same or other query",
limit: 100,
suggest: true
}]
});
Old Syntax:
const result = index.where({
cat: "comedy",
year: "2018"
});
Equivalent Syntax (0.7.x):
const data = Object.values(index.store);
The line above retrieves data from the document store (just useful when not already available in your runtime).
const result = data.filter(function(item){
return item.cat === "comedy" && item.year === "2018";
});
Also considering using the <a href="https://github.com/nextapps-de/flexsearch#tags">Tag-Search</a> feature, which partially replaces the Where-Clause with a huge performance boost.