Modules
klevubasequerysettings
2min
ƭ klevubasequerysettings object type declaration name type description advancedsorting? { key string ; order advancedsortingdiretion enums/advancedsortingdiretion md ; type "field" }\[] if sort has been set to advanced sort then following object is used to define sorting campaignforcatnav? string in kmc the user is able to create campaigns for collections; which are specific rules that are tied to a start and end date this allows a user to create rules that assist in promoting or demoting products during a sale, event, season, etc this parameter allows a user to pass in the id of a campaign into a search the implementation can be handled any way the user chooses url paramters, cookie, localstorage, session, db, etc context? { recentobjects? { records { id string }\[] ; typeofrecord klevuanytypeofrecord docid\ ktm5wqto44nqfuwumtxje }\[] ; sourceobjects? { records ({ itemgroupid string } | { id string } | { url string })\[] ; typeofrecord klevuanytypeofrecord docid\ ktm5wqto44nqfuwumtxje }\[] } context recentobjects? { records { id string }\[] ; typeofrecord klevuanytypeofrecord docid\ ktm5wqto44nqfuwumtxje }\[] @todo rewrite this doc describe how personalisation works use this object to specify the records (e g products, categories, etc ) that were recently interacted with by a customer please only specify one recentobject object per record type, one for all klevu product entries, another for all klevu cms pages visited, etc each recentobject object may contain multiple record objects (e g 5 recently viewed products) the most recently clicked record should be the first element in the array context sourceobjects? { records ({ itemgroupid string } | { id string } | { url string })\[] ; typeofrecord klevuanytypeofrecord docid\ ktm5wqto44nqfuwumtxje }\[] used with visually similar recommendation search customandquery? string the custom query you would like to fire, which klevu automatically converts into an appropriate query to be included with the request use a character before the parenthesis to exclude records matching the contained condition this is advanced usage of our api and you may need some help with building these queries, so when you need support please reach out to us via the community forum excludeids? { key string ; value string }\[] use this field to exclude certain records from the search results you can specify a record id to control this at variant level, or an itemgroupid to control this at compound level fallbackqueryid? string the id of another query which should be fired if the current query yields too few results fallbackwhencountlessthan? number use this parameter to specify the criteria for when a fallback query will be fired for example, if you would like a fallback query to fire when you have two results or less, specify a value of '3' fields? klevurecordfields docid 0gjgfiuirmy4bkybkakqe \[] groupby? "id" | "name" the groupby parameter takes the name of a field indexed in the klevu search backend and ensures that there is only one record for each unique value of this field in the search results by default, the groupby operation is performed on the itemgroupid field when querying for klevu category or klevu cms records, it is recommended to use name as the groupby parameter value groupcondition? klevugroupconditions the groupcondition object can be used for applying the advance filtering conditions so your customers can fine tune their results based on relevant attributes here is an example of how to use the groupcondition object "groupcondition" { "groupoperator" "any of", "conditions" \[ { "key" "klevu price", "valueoperator" "include", "singleselect" true, "excludevaluesinresult" true, "values" \["20 25"] }, { "key" "itemgroupid", "valueoperator" "exclude", "singleselect" false, "values" \["4384028262462"] }, { "key" "size", "valueoperator" "exclude", "singleselect" false, "values" \["small", "large"] } ] } includeids? { key string ; value string }\[] specify any records which should be included with the results, even if the klevu search query did not match them you can specify a record id to control this at variant level, or a itemgroupid to control this at compound item level limit? number specify the number of record you would like to display per page offset? number specify the index at which to start counting the number of results from the index of the first record in a result set is 0 thus, if you want to start from the 6th result, use an offset of 5 personalisation? { enablepersonalisation true ; fields? klevurecordfields docid 0gjgfiuirmy4bkybkakqe \[] } when a customer enters a physical shop, they may express their preferences to an in store assistant by highlighting the colours they like, the brands they prefer and what they have purchased before the in store assistant would then use this information to show the customer products they are most likely interested in first, before showing them any others that still may be suitable klevu a i is your online assistant this personalisation can be provided in two ways including some information about the customer's browsing history with each request defining your own boosting rules based on information you already know about the customer you can read more about how this works in our personalisation guide https //help klevu com/support/solutions/articles/5000871361 do you offer apis for personalisation personalisation enablepersonalisation true this must be set to 'true' for enabling personalisation on a particular request if set to 'false', the recent objects within the context object will be ignored personalisation fields? klevurecordfields docid 0gjgfiuirmy4bkybkakqe \[] this is an optional field by default, klevu will analyse all attributes of the records the customer has interacted with, in order to determine the common patterns if you prefer to focus on particular aspects, for example brand or price, specify those attributes within this object pricefieldsuffix? string if you have multiple currency support enabled for your store, this parameter can be used to retrieve prices for a specific currency for example, if the data you have indexed with klevu includes prices for a base currency gbp and an additional currency usd, a value of 'gbp' or 'usd' here will display the relevant currency values for your records query? klevubasequerysettingsquery docid\ h8sc81d2rtm9hyundahzn searchprefs? klevusearchpreference enums/klevusearchpreference md \[] there are a number of preferences available for fine tuning your queries for example you can control whether or not to allow fuzzy search for spelling mistakes on a query by query basis the available searchprefs are detailed below sort? klevusearchsorting enums/klevusearchsorting md the default sorting of results is relevance, which uses klevu a i to determine the order there are various other options available which you can provide to your customers as required topids? { key string ; value string }\[] specify any records which should always be displayed at the top of the result set you can specify a record id to control this at variant level, or a itemgroupid to control this at compound item level note that this is only applicable when the sort order is by 'relevance' typeofrecords? klevuanytypeofrecord docid\ ktm5wqto44nqfuwumtxje \[] in addition to products, categories and cms pages, klevu apiv2 allows you to search for custom entities for example if you want to display results for recipes, articles or physical stores within your search you can do so by utilising the typeofrecords parameter typeofsearch? klevutypeofsearch enums/klevutypeofsearch md the typeofsearch parameter defines the behaviour when identifying matches for a searched term for example, whether all or just one of the entered words must be matched, whether to allow spelling mistakes, etc visibilitygroupid? string a common b2b requirement is different product visibility and prices based on a customer group with klevu apiv2 you can specify parameters to filter out products which a particular customer should not see, and also show them specific prices if they differ from the base price when specifying a value for pricefieldsuffix, the following fields in your response data will be replaced with the value indexed with klevu for the corresponding currency and group price, saleprice, currency when specifying a value for visibilitygroupid, any records that do not belong to that group will be excluded from the results in the example to the right, the same product is indexed with data for currencies 'gbp' and 'usd' it's visibility is set to groups 'my group 1' and 'my group 3', but not 'my group 2' defined in models/klevubasequerysettings ts 11 https //github com/klevultd/frontend sdk/blob/492d3760/packages/klevu core/src/models/klevubasequerysettings ts#l11