InvertedIndex.inMemory constructor

InvertedIndex.inMemory({
  1. required TextAnalyzer analyzer,
  2. required int collectionSize,
  3. Map<String, int>? dictionary,
  4. Map<String, Map<String, Map<String, List<int>>>>? postings,
  5. KeywordPostingsMap? keywordPostings,
  6. Map<String, Set<String>>? kGramIndex,
  7. int k = 2,
  8. NGramRange? nGramRange,
  9. Map<String, double> zones = const <String, double>{},
})

A factory constructor that returns an InMemoryIndex instance.

  • analyzer is the TextAnalyzer used to tokenize text for the index.
  • collectionSize is the size of the indexed collection.
  • tokenFilter is a filter function that returns a subset of a collection of Tokens.
  • k is the length of k-gram entries in the k-gram index.
  • nGramRange is the range of N-gram lengths to generate. If nGramRange is null, only keyword phrases are generated.
  • zones is a hashmap of zone names to their relative weight in the index.
  • dictionary is the in-memory term dictionary for the indexer. Pass a DftMap instance at instantiation, otherwise an empty DftMap will be initialized.
  • kGramIndex is the in-memory KGramsMap for the index. Pass a KGramsMap instance at instantiation, otherwise an empty KGramsMap will be initialized.
  • postings is the in-memory postings hashmap for the indexer. Pass a PostingsMap instance at instantiation, otherwise an empty PostingsMap will be initialized.

Implementation

factory InvertedIndex.inMemory(
        {required TextAnalyzer analyzer,
        required int collectionSize,
        // TokenFilter? tokenFilter,
        Map<String, int>? dictionary,
        Map<String, Map<String, Map<String, List<int>>>>? postings,
        KeywordPostingsMap? keywordPostings,
        Map<String, Set<String>>? kGramIndex,
        int k = 2,
        NGramRange? nGramRange,
        Map<String, double> zones = const <String, double>{}}) =>
    InMemoryIndex(
        collectionSize: collectionSize,
        analyzer: analyzer,
        // tokenFilter: tokenFilter,
        dictionary: dictionary,
        postings: postings,
        keywordPostings: keywordPostings,
        kGramIndex: kGramIndex,
        k: k,
        nGramRange: nGramRange,
        zones: zones);