Querylight TS Demo

TextFieldIndex

Lexical field index with analyzers, ranking, phrase matching, prefix lookup, and aggregations.

Back to docs search

Reference Entry

TextFieldIndex

API Reference · foundation · order 15

Lexical field index with analyzers, ranking, phrase matching, prefix lookup, and aggregations.

TextFieldIndex

Lexical field index with analyzers, ranking, phrase matching, prefix lookup, and aggregations.

Declaration

class TextFieldIndex

Constructors

constructor

```ts constructor(analyzer: Analyzer, queryAnalyzer: Analyzer, rankingAlgorithm: RankingAlgorithm, bm25Config: Bm25Config, termCounts: Map, reverseMap: Map, termDocPositions: Map>, totalTermCount: number, trie: SimpleStringTrie): TextFieldIndex ``` Parameters: - `analyzer: Analyzer` - `queryAnalyzer: Analyzer` - `rankingAlgorithm: RankingAlgorithm` - `bm25Config: Bm25Config` - `termCounts: Map` - `reverseMap: Map` - `termDocPositions: Map>` - `totalTermCount: number` - `trie: SimpleStringTrie`

Members

analyzer

```ts analyzer: Analyzer ```

queryAnalyzer

```ts queryAnalyzer: Analyzer ```

rankingAlgorithm

```ts rankingAlgorithm: RankingAlgorithm ```

bm25Config

```ts bm25Config: Bm25Config ```

indexState

```ts get indexState(): TextFieldIndexState ```

loadState

```ts loadState(fieldIndexState: IndexState): FieldIndex ``` Parameters: - `fieldIndexState: IndexState`

add

```ts add(docId: string, text: string): void ``` Parameters: - `docId: string` - `text: string`

indexValue

```ts indexValue(docId: string, value: string): void ``` Parameters: - `docId: string` - `value: string`

searchTerm

```ts searchTerm(term: string, allowPrefixMatch: boolean): Hits ``` Parameters: - `term: string` - `allowPrefixMatch: boolean`

searchPhrase

```ts searchPhrase(terms: string[], slop: number): Hits ``` Parameters: - `terms: string[]` - `slop: number`

searchPrefix

```ts searchPrefix(prefix: string): Hits ``` Parameters: - `prefix: string`

termMatches

```ts termMatches(term: string): TermPos[] | undefined ``` Parameters: - `term: string`

terms

```ts terms(): string[] ```

highlightValue

```ts highlightValue(field: string, valueIndex: number, value: string, clauses: HighlightClause[], fragmentSize: number, numberOfFragments: number): HighlightFragment[] ``` Parameters: - `field: string` - `valueIndex: number` - `value: string` - `clauses: HighlightClause[]` - `fragmentSize: number` - `numberOfFragments: number`

filterTermsByRange

```ts filterTermsByRange(__namedParameters: { lt?: string; lte?: string; gt?: string; gte?: string }): Hits ``` Parameters: - `__namedParameters: { lt?: string; lte?: string; gt?: string; gte?: string }`

documentCount

```ts get documentCount(): number ```

totalIndexedTermCount

```ts get totalIndexedTermCount(): number ```

wordCount

```ts wordCount(docId: string): number ``` Parameters: - `docId: string`

significantTermsAggregation

```ts significantTermsAggregation(n: number, subsetDocIds: Set): SignificantTermsBucket[] ``` Parameters: - `n: number` - `subsetDocIds: Set`

termsAggregation

```ts termsAggregation(n: number, subsetDocIds?: Set): Record ``` Parameters: - `n: number` - `subsetDocIds?: Set`