Guide
4min
the @klevu/core docid\ tcmctfiysjtujng05t4 d reference section will list all the available functions, enums, etc , for the library, but we wanted to call out a few of the most common and important ones here klevufetch as mentioned in the quickstart docid\ fi qigrfsn06qmlq6rcbs queries to klevu are made with the klevufetch function inside klevufetch you can provide any amount of query functions docid\ zuyefy2ecmhblyqusf0vk as parameters within the query functions you call, you are also able to pass any number of modifier functions docid 71mywvwez1pw nilxv79h for example within our react example, on the search landing page we pass in a search query function along with two modifier functions const result = await klevufetch( search( query get("q"), { id "search", limit 36, sort sorting, }, listfilters({ rangefiltersettings \[ { key "klevu price", minmax true, }, ], filtermanager manager, }), applyfilterwithmanager(manager) ), suggestions( query get("q"), { id suggestions, } ), ) const searchresult = result queriesbyid("search") clickmanager = searchresult getsearchclickmanager() setproducts(searchresult? records ?? \[]) setsuggestions( result suggestionsbyid("suggestions")? suggestions map((i) => i suggest) ?? \[] ) in the above example we pass in the search and suggestions query functions to klevufetch in the search query function we then pass in the search term, options (id, limit, sorting, type of search, etc), and two modifier functions (listfilters and applyfilterwithmanager) continue to the next section to learn more about query functions and modifier functions result object once you've made your queries through klevufetch, a single response object is returned because you are able to request more than one search, each search should have an id these ids can then be used to reference the results of each search using either queriesbyid or suggestionsbyid in the above code example, the result variable is the result object once you have the query you want to work with, you will find many helpful functions available to such as generating click handlers to send analytics back to klevu, or requesting more records/data when using a limit klevukmcsettings utility function every klevu account comes with a feature rich admin panel called kmc (klevu merchant center) in order to fetch many of the settings found in kmc, you call klevukmcsettings() asynchronously as shown below const kmcsettings = await klevukmcsettings(); console log(kmcsettings); json response { "root" { "klevu showbannerads" true, "klevu multiselectfilters" true, "klevu abtestactive" false, "klevu useranalyticsdomain" "stats ksearchnet com", "klevu uc useroptions" { "addtocartbutton" "add to cart", "showrolloverimage" false, "showproductswatches" false, "enablepersonalisationincatnav" false, "showratingscountoncategorypage" false, "noresultsoptions" { "messages" \[], "banners" \[] }, "noimageurl" "/klevu js v1/img 1 1/place holder jpg", "showratingsoncategorypage" true, "enablepersonalisationinsearch" false, "isfullimageurlprovided" false, "showsearchboxonlandingpage" true, "priceinterval" "500", "showratingscountonsearchresultslandingpage" false, "showrecentlyvieweditems" false, "showtrendingproducts" false, "showratingsonquicksearches" true, "showratingscountonquicksearches" false, "showratingsonsearchresultslandingpage" true, "landingfilterposition" "left", "showfiltersinmobile" true }, "klevu cmsanalyticsdomain" "stats ksearchnet com", "klevu showoutofstock" false, "klevu webstorelanguage" "en", "klevu logofreesearch" true, "klevu layoutview" "grid", "klevu showpopuralterms" false, "klevu showproductcode" false, "klevu showpopularsearches" true, "klevu cmsapikey" "klevu 164314778912414722", "klevu categorysearchenabled" true, "klevu showpriceslider" true, "klevu addtocartenabled" true, "klevu cmsenabled" true, "klevu filtersonleft" true, "klevu showprices" true, "klevu issearchactive" true, "klevu filtersenabled" true, "klevu fluidlayoutenabled" true, "klevu cmssearchdomain" "eucs28 ksearchnet com", "klevu lookfordatainsamefeed" true, "klevulayoutversion" " 1 1", "klevu loadmapfile" true, "klevu layouttype" "slim", "klevu apidomain" "api ksearchnet com", "klevu usersearchdomain" "eucs28 ksearchnet com", "klevu showrecentserches" true, "klevu userjavascriptdomain" "js klevu com" }, "banner" { "klevu banner" \[ { "showforterms" null, "showonlandingpage" true, "redirecturl" "https //uvalktopia myshopify com/pages/red shoes page", "showonquicksearch" false, "enddate" "", "bannername" "red shoes", "position" "bottom", "bannerref" 13757, "bannerimg" "https //cdn shopify com/s/files/1/0622/9039/5389/files/treesbg jpg?v=1678465037", "showoncategorypage" false, "startdate" "2023/3/10" } ] }, "maps" { "klevu autocorrectmap" \[], "klevu keywordurlmap" \[ { "keywords" \[ "red shoe" ], "url" "https //uvalktopia myshopify com/products/palladium pallatech hi tx chevron" } ] } } as you can see, not only do you get the majority of settings, you also get access to promotional banners, url redirects and more