---
title: "SearchStrategy"
generated: true
---
<GenerationInfo sourceFile="packages/core/src/plugin/default-search-plugin/search-strategy/search-strategy.ts" sourceLine="21" packageName="@vendure/core" />

This interface defines the contract that any database-specific search implementations
should follow.

:::info

This is configured via the `searchStrategy` property of
the <DocsLink href="/reference/typescript-api/default-search-plugin/default-search-plugin-init-options#defaultsearchplugininitoptions">DefaultSearchPluginInitOptions</DocsLink>.

:::

```ts title="Signature"
interface SearchStrategy extends InjectableStrategy {
    getSearchResults(ctx: RequestContext, input: SearchInput, enabledOnly: boolean): Promise<SearchResult[]>;
    getTotalCount(ctx: RequestContext, input: SearchInput, enabledOnly: boolean): Promise<number>;
    getFacetValueIds(ctx: RequestContext, input: SearchInput, enabledOnly: boolean): Promise<Map<ID, number>>;
    getCollectionIds(ctx: RequestContext, input: SearchInput, enabledOnly: boolean): Promise<Map<ID, number>>;
}
```
* Extends: <DocsLink href="/reference/typescript-api/common/injectable-strategy#injectablestrategy">`InjectableStrategy`</DocsLink>



<div className="members-wrapper">

### getSearchResults

<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, input: SearchInput, enabledOnly: boolean) => `Promise<SearchResult[]>``}   />


### getTotalCount

<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, input: SearchInput, enabledOnly: boolean) => `Promise<number>``}   />


### getFacetValueIds

<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, input: SearchInput, enabledOnly: boolean) => `Promise<Map<`<a href='/reference/typescript-api/common/id#id'>ID</a>`, number>>``}   />


### getCollectionIds

<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, input: SearchInput, enabledOnly: boolean) => `Promise<Map<`<a href='/reference/typescript-api/common/id#id'>ID</a>`, number>>``}   />




</div>
