---
url: /nestjs-odata/api/generated/interfaces/ISearchProvider.md
---
# Interface: ISearchProvider

Defined in: [interfaces/search.interface.ts:17](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/interfaces/search.interface.ts#L17)

Interface for translating a parsed $search expression into a SQL condition.

Implementations are adapter-specific (e.g., TypeOrmSearchProvider).
Core uses this interface without importing any ORM code.

Returns null if the search cannot be applied (e.g., no searchable fields defined).

## Methods

### buildSearchCondition()

> **buildSearchCondition**(`searchNode`, `entitySetName`, `alias`): { `condition`: `string`; `params`: `Record`<`string`, `unknown`>; } | `null`

Defined in: [interfaces/search.interface.ts:27](https://github.com/cberd1509/nestjs-odata/blob/a42974292d62fe5da337a603d3b22d57c08cbf68/packages/core/src/interfaces/search.interface.ts#L27)

Build a SQL WHERE condition fragment from a parsed $search expression.

#### Parameters

##### searchNode

[`SearchNode`](../type-aliases/SearchNode.md)

The parsed $search AST node

##### entitySetName

`string`

The entity set being queried

##### alias

`string`

The query builder alias for the entity table

#### Returns

{ `condition`: `string`; `params`: `Record`<`string`, `unknown`>; } | `null`

An object with the SQL condition string and named parameters,
or null if search cannot be applied
