Guide

Modifier Functions

1min

Modifier functions are helpers that change the way query functions work. They are place in the end of query functions that support them. Almost all query functions support modifier functions. There can be any amount of modifer functions placed in one query function.

Here is short description of every modifer function. Full reference can be found from @klevu/core reference documentation.

Modifier

Description

listFilters()

List all filters that given search result has

applyFilters()

Applies selected filters to query

applyFilterWithManager()

Applies filters that's state is managed by FilterManager

fallback()

When query returns less results than fallback treshold then additional fallback query is sent

boostWithKeywords()

Boost or deboost results with keywords

boostWithRecords()

Boost or deboost certain products in the result by id

boostWithFilters()

Boost or deboost results based on a filters

boostWithFilterManager()

Boost or deboost results based in selection in filter manager

personalisation()

Enable personalisation to the query. Automatically applies last visited products

include()

Force include given id's in the result

top()

Force return given id's as first items on results

sendSearchEvent()

When user takes action to search something this should be used

sendMerchandisingViewEvent()

Should be used with categoryMerchandising() query to send view event of merchandising

sendRecommendationViewEvent()

Should be used with all recommendation queries. Send a analytical data about recommendation to Klevu

debug()

Prints query results to console

raw()

Send any request to Klevu API. Check API documentation for properties.