Documentation ¶
Overview ¶
Package application in the search module provides a more explicit access to the domain searchservice, and combines the result with Paginations etc. The structs defined here can for example be used in the interface layers
Index ¶
- func BuildFilters(request SearchRequest, defaultPageSize int) []domain.Filter
- type SearchRequest
- type SearchResult
- type SearchService
- func (s *SearchService) Find(ctx context.Context, searchRequest SearchRequest) (map[string]*SearchResult, error)
- func (s *SearchService) FindBy(ctx context.Context, documentType string, searchRequest SearchRequest) (*SearchResult, error)
- func (s *SearchService) Inject(paginationInfoFactory *utils.PaginationInfoFactory, logger flamingo.Logger, ...) *SearchService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildFilters ¶
func BuildFilters(request SearchRequest, defaultPageSize int) []domain.Filter
BuildFilters creates a slice of search filters from the request data
Types ¶
type SearchRequest ¶
type SearchRequest struct { AdditionalFilter []domain.Filter PageSize int Page int SortBy string SortDirection string Query string PaginationConfig *utils.PaginationConfig }
SearchRequest is a simple DTO for the search query data
func (*SearchRequest) AddAdditionalFilter ¶
func (r *SearchRequest) AddAdditionalFilter(filter domain.Filter)
AddAdditionalFilter adds an additional filter
func (*SearchRequest) AddAdditionalFilters ¶
func (r *SearchRequest) AddAdditionalFilters(filters ...domain.Filter)
AddAdditionalFilters adds multiple additional filters
func (*SearchRequest) SetAdditionalFilter ¶
func (r *SearchRequest) SetAdditionalFilter(filterToAdd domain.Filter)
SetAdditionalFilter - adds or replaces the given filter
type SearchResult ¶
type SearchResult struct { Hits []domain.Document SearchMeta domain.SearchMeta Facets domain.FacetCollection Suggestions []domain.Suggestion PaginationInfo utils.PaginationInfo }
SearchResult is the DTO for the search result
type SearchService ¶
type SearchService struct {
// contains filtered or unexported fields
}
SearchService - Application service that offers a more explicit way to search for results - on top of the domain.ProductSearchService
func (*SearchService) Find ¶
func (s *SearchService) Find(ctx context.Context, searchRequest SearchRequest) (map[string]*SearchResult, error)
Find returns a Searchresult for all document types for the given Request
func (*SearchService) FindBy ¶
func (s *SearchService) FindBy(ctx context.Context, documentType string, searchRequest SearchRequest) (*SearchResult, error)
FindBy returns a SearchResult for the given Request
func (*SearchService) Inject ¶
func (s *SearchService) Inject( paginationInfoFactory *utils.PaginationInfoFactory, logger flamingo.Logger, optionals *struct { SearchService domain.SearchService `inject:",optional"` DefaultPageSize float64 `inject:"config:commerce.pagination.defaultPageSize,optional"` }) *SearchService
Inject dependencies