Table of Contents

Class QueryRewriteResult

Namespace
Mythosia.AI.Rag
Assembly
Mythosia.AI.Rag.Abstractions.dll

The result of rewriting a query into retrieval-ready form, including optional retrieval-oriented keywords and a search gate decision.

public class QueryRewriteResult
Inheritance
QueryRewriteResult
Inherited Members

Constructors

QueryRewriteResult(string, bool, IReadOnlyList<string>?)

public QueryRewriteResult(string query, bool needsSearch, IReadOnlyList<string>? keywords = null)

Parameters

query string
needsSearch bool
keywords IReadOnlyList<string>

Properties

Keywords

Optional retrieval-oriented search terms extracted from the query for text/keyword search. When set, the hybrid search text leg uses these shaped keywords instead of the raw query, helping lexical retrieval handle language-particle and formatting mismatches. Null when the rewriter does not provide keyword shaping.

public IReadOnlyList<string>? Keywords { get; }

Property Value

IReadOnlyList<string>

NeedsSearch

Whether the query requires document search. When false, the RAG pipeline should be skipped entirely.

public bool NeedsSearch { get; }

Property Value

bool

Query

The semantic query to use for retrieval. When NeedsSearch is false, this is the original query unchanged.

public string Query { get; }

Property Value

string

Methods

Pass(string)

Creates a result indicating the query should bypass document search.

public static QueryRewriteResult Pass(string originalQuery)

Parameters

originalQuery string

Returns

QueryRewriteResult

Search(string)

Creates a result with a (possibly rewritten) semantic query that needs document search.

public static QueryRewriteResult Search(string query)

Parameters

query string

Returns

QueryRewriteResult

Search(string, IReadOnlyList<string>?)

Creates a result with a semantic query and retrieval-oriented keywords for text search.

public static QueryRewriteResult Search(string query, IReadOnlyList<string>? keywords)

Parameters

query string
keywords IReadOnlyList<string>

Returns

QueryRewriteResult