Function loadJSONIndex

  • Deserializes a JSON index (serialized with JSON.stringify(index)) and instantiates a SearchIndex instance. It should be given the same options originally used when serializing the index.

    Usage:

    // If the index was serialized with:
    let index = createIndex({ fields: ['title', 'text'] })

    addAll(index, documents)

    const json = JSON.stringify(index)
    // It can later be deserialized like this:
    index = loadJSONIndex(json, { fields: ['title', 'text'] })

    Type Parameters

    • Document = any

    • ID = any

    Parameters

    Returns SearchIndex<Document, ID>

    An instance of SearchIndex deserialized from the given JSON.

Generated using TypeDoc