-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Description
Background
In PR #13384, @roji suggested that the LINQ expression processing path should be the primary internal code path in the web search connectors, rather than converting LINQ expressions back into the legacy TextSearchFilter format for processing.
Currently, the generic ITextSearch<TRecord> methods convert LINQ expressions into the legacy TextSearchFilter intermediate, then process that filter to build HTTP requests. This means the new LINQ path depends on the old TextSearchFilter infrastructure.
Problem
This dependency direction is backwards. When the legacy ITextSearch interface is eventually retired:
- The core filter-processing logic is entangled with the legacy
TextSearchFilter/FilterClausetypes - Removing the old interface would require rewriting the filter-to-HTTP conversion logic
- The LINQ path — which is the future — is treated as a second-class citizen
Proposed Change
Invert the relationship so that:
- LINQ is the primary path: Generic
ITextSearch<TRecord>methods process LINQ expressions directly into a raw internal format (e.g.,List<(string FieldName, object Value)>) - Legacy is a thin shim: The old
ITextSearchmethods convertTextSearchFilterinto that same raw format, then delegate to the shared core - Core methods are filter-type-agnostic: HTTP/JSON-building methods consume the raw format, with no dependency on
TextSearchFilterorFilterClause
This way, when the legacy ITextSearch interface is retired, removing it is just deleting the shim layer (ExtractFiltersFromLegacy) — no rewriting needed.
Affected connectors
BingTextSearch.csGoogleTextSearch.csBraveTextSearch.csTavilyTextSearch.cs
Acceptance criteria
- LINQ expression processing produces raw
(FieldName, Value)pairs directly — no intermediateTextSearchFilter - Legacy
ITextSearchmethods convertTextSearchFilterinto the same raw format via a shim - Core HTTP/request-building methods consume raw parameters, not
TextSearchFilter - All existing TextSearch unit tests pass
- Full solution builds with 0 errors, 0 warnings