Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

ReaderChunkSearchIndex

OfficeIMO.Reader

Namespace
OfficeIMO.Reader
Assembly
OfficeIMO.Reader.Core
Source revision
0eef6a5756b9 with working tree changes
Modifiers
sealed

In-memory BM25 index over ReaderChunk values: chunk text as the body and the heading path as a weighted heading field. Queries accept words, "quoted phrases", prefix*, AND, OR and parentheses.

Inheritance

  • object
  • ReaderChunkSearchIndex

Remarks

Words are found with Unicode (UAX #29) word boundaries, normalized to NFKC and case folded. Equal scores rank in the order the chunks were given. Build the index once and search it as often as needed; it keeps references to the chunks, not copies.

Constructors

public ReaderChunkSearchIndex(IEnumerable<ReaderChunk> chunks, OfficeDocumentRankingOptions? ranking = null) #

Indexes chunks in order.

Parameters

chunks System.Collections.Generic.IEnumerable<OfficeIMO.Reader.ReaderChunk> required
ranking OfficeIMO.Reader.OfficeDocumentRankingOptions? = null optional

Methods

public ReaderChunkSearchResult Search(string query, int maximumResults = 100) #

Returns up to maximumResults chunks, best first.

Parameters

query string required
maximumResults int = 100 optional

Properties

public int Count { get; } #

Number of indexed chunks.

public bool LimitReached { get; } #

True when OfficeDocumentRankingOptions.MaximumIndexedTokens cut indexing short.