Skip to main content

SearchService

The SearchService service is used handle the interactions with the external systems. It can be extended and overridden if needed. A normal project shouldn't need to provide its own service and achieve all customizations through custom search provider.

import { SearchService } from '@archibald/search';

In order to use the SearchService service, you need to inject it by using the Inject decorator function.

@Inject()
protected authService: AuthService;

searchByTerm

This method calls searchByTerm method defined on a provided search provider and returns response.

const response = this.searchService.searchByTerm();

searchByCategory

This method calls searchByCategory method defined on a provided search provider and returns response.

const response = this.searchService.searchByCategory();

response

NameTypeDescriptionDefault
breadcrumbsBreadcrumbItem[]Breadcrumbs for the search results
currentQueryCurrentSearchQuery | undefinedThe current URL and the search query
paginationPaginationContains information about current page, number of pages, products per page and number of products
productsProduct[]List of products or search results