Flexsearch v0.7.0 Release Notes

    • Bidirectional Context (the order of words can now vary, does not increase memory when using bidirectional context)
    • ๐Ÿ†• New memory-friendly strategy for indexes (switchable, saves up to 50% of memory for each index, slightly decrease performance)
    • ๐Ÿ‘ Better scoring calculation (one of the biggest concerns of the old implementation was that the order of arrays processed in the intersection has affected the order of relevance in the final result)
    • ๐Ÿ›  Fix resolution (the resolution in the old implementation was not fully stretched through the whole range in some cases)
    • Skip words (optionally, automatically skip words from the context chain which are too short)
    • ๐ŸŽ Hugely improves performance of long queries (up to 450x faster!) and also memory allocation (up to 250x less memory)
    • ๐Ÿ†• New fast-update strategy (optionally, hugely improves performance of all updates and removals of indexed contents up to 2850x)
    • ๐Ÿ‘Œ Improved auto-balanced cache (keep and expire cache by popularity)
    • Append contents to already existing entries (already indexed documents or contents)
    • ๐Ÿ†• New method "contain" to check if an ID was already indexed
    • Access documents directly from internal store (read/write)
    • Suggestions are hugely improved, falls back from context search all the way down to single term match
    • ๐Ÿ‘ Document descriptor has now array support (optionally adds array entries via the new append under the hood to provide a unique relevance context for each entry)
    • Document storage handler gets improved
    • Results from document index now grouped by field (this is one of the few bigger breaking changes which needs migrations of your old code)
    • Boolean search has a new concept (use in combination of the new result structure)
    • ๐Ÿ‘ท Node.js Worker Threads
    • ๐Ÿ‘Œ Improved default latin encoders
    • ๐Ÿ†• New parallelization model and workload distribution
    • ๐Ÿ‘Œ Improved Export/Import
    • ๐Ÿท Tag Search
    • Offset pagination
    • โœจ Enhanced Field Search
    • ๐Ÿ‘Œ Improved sorting by relevance (score)
    • โž• Added Context Scoring (context index has its own resolution)
    • โœจ Enhanced charset normalization
    • ๐Ÿ‘Œ Improved bundler (support for inline WebWorker)

    ๐Ÿšš These features have been removed:

    • Where-Clause
    • Index Information index.info()
    • Paging Cursor (was replaced by offset)

    Migration Quick Overview

    ๐Ÿšš > The "async" options was removed, instead you can call each method in its async version, e.g. index.addAsync or index.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
        }]
    });
    

    Where Clause Replacement

    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 Tag-Search feature, which partially replaces the Where-Clause with a huge performance boost.