Table of Contents

Method ReadSearchVectorTextSearchConfigurationAsync

Namespace
MailFathom.Application.Persistence
Assembly
MailFathom.Application.dll

ReadSearchVectorTextSearchConfigurationAsync(CancellationToken)

Reads the text search configuration the database compiled into the search vector's generated column.

Task<string> ReadSearchVectorTextSearchConfigurationAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Cancels the read.

Returns

Task<string>

The configuration name the schema actually uses.

Remarks

The name is part of the schema rather than of a query: it decides how every indexed word is stemmed and which words are dropped, and it is frozen into a stored generated column when the table is created. A migration is therefore generated for one configuration and cannot be reused for another, and a running deployment that is configured for a second one would query with stemming the stored lexemes were never built with — which shows up as missing search results, not as an error.

Comparing migration identifiers cannot catch that, because the identifiers are the same either way. This reads what PostgreSQL actually holds, so the answer does not depend on which configuration the migration was generated from or on whether anyone remembered to regenerate it.

A caller reaches this only once every migration is applied, and the migration that creates the search document table creates the generated column with it. A database that then reports no column, no expression, or an expression naming no configuration is not one of ours, so it is unreadable rather than a name absent for a benign reason. Returning nothing for it would hand the caller a state it could only treat as agreement.

Exceptions

DatabaseSchemaStateUnreadableException

Thrown when the catalogue cannot be read at all, and when it is read but identifies no configuration: the column is absent, it carries no stored expression, or that expression names no registered configuration.