SearchAdapter
The SearchAdapter abstract class is a class from which all custom search adapters inherit from. The default SearchAdapter is the CommerceSearchAdapter which connects the client to our NodeJS search endpoints.
import { SearchAdapter } from '@archibald/search';
export class ProjectCustomSearchAdapter extends SearchAdapter {}
Options
| Name | Type | Description | Default |
|---|---|---|---|
| config | DefaultAppApiConfig | null | undefined | The api config whcih is needed to make Http requests | undefined |
| client | SearchClient | null | undefined | The search client instance | undefined |
extractHeaders
This method returns the relevant Headers we need for subsequent requests, it takes it from the provided request instance.
this.extractHeaders();
onSearch
This method is being called when a search from the useSearchTerm and useSearchCategory hooks is initiated.
export class ProjectCustomSearchAdapter extends SearchAdapter {
public override async onSearch<T extends SearchResponseBase>() {
return Promise.resolve({});
}
}