Skip to main content

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

NameTypeDescriptionDefault
configDefaultAppApiConfig | null | undefinedThe api config whcih is needed to make Http requestsundefined
clientSearchClient | null | undefinedThe search client instanceundefined

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({});
}
}