Options
All
  • Public
  • Public/Protected
  • All
Menu

This class is responsible for indexing all documents available in the world and storing them in a word tree structure that allows for fast searching.

Hierarchy

  • DocumentIndex

Index

Constructors

Accessors

  • get ready(): Promise<void>
  • Returns a Promise that resolves when the indexing process is complete.

    Returns Promise<void>

Methods

  • index(): Promise<void>
  • Index all available documents in the world and store them in a word tree.

    Returns Promise<void>

  • lookup(prefix: string, [options]?: { documentTypes: string[]; limit: number }): any
  • Return entries that match the given string prefix.

    Parameters

    • prefix: string

      The prefix.

    • [options]: { documentTypes: string[]; limit: number } = {}

      Additional options to configure behaviour.

      • documentTypes: string[]
      • limit: number

    Returns any

    A number of entries that have the given prefix, grouped by document type.

  • addDocument(doc: Document): void
  • Add an entry to the index.

    Parameters

    • doc: Document

      The document entry.

    Returns void

  • removeDocument(doc: Document): void
  • Remove an entry from the index.

    Parameters

    • doc: Document

      The document entry.

    Returns void

  • replaceDocument(doc: Document): void
  • Replace an entry in the index with an updated one.

    Parameters

    • doc: Document

      The document entry.

    Returns void

  • Add a leaf node to the word tree index.

    Parameters

    Returns void

  • Aggregate the compendium index and add it to the word tree index.

    Parameters

    Returns void

  • _indexEmbeddedDocuments(parent: Document): void
  • Add all of a parent document's embedded documents to the index.

    Parameters

    • parent: Document

      The parent document.

    Returns void

  • _indexWorldCollection(documentName: string): void
  • Aggregate all documents and embedded documents in a world collection and add them to the index.

    Parameters

    • documentName: string

      The name of the documents to index.

    Returns void

Properties

#ready: Promise<void> = null

While we are indexing, we store a Promise that resolves when the indexing is complete.