Skip to main content

SearchStrategy

SearchStrategy

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

info

This is configured via the searchStrategy property of the DefaultSearchPluginInitOptions.

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>>;
}

getSearchResults

method
(ctx: RequestContext, input: SearchInput, enabledOnly: boolean) => Promise<SearchResult[]>

getTotalCount

method
(ctx: RequestContext, input: SearchInput, enabledOnly: boolean) => Promise<number>

getFacetValueIds

method
(ctx: RequestContext, input: SearchInput, enabledOnly: boolean) => Promise<Map<ID, number>>

getCollectionIds

method
(ctx: RequestContext, input: SearchInput, enabledOnly: boolean) => Promise<Map<ID, number>>