Guide
Smart Search
V1 (deprecated)
4 min
the v1 apis are now deprecated! if you are building a new implementation, we strongly recommend using api version 2 by going through v2 overview docid\ czeodl0skcuv 18ipuplr depending on what details you want klevu search servers to return in response, you can use one of the following api methods to search in your index for the “search as you type” sort of interface where you need query suggestions, matching categories, cms pages and product suggestions, please use the “search as you type” method for the search results landing page, if you only need a list of ids of records relevant to your query, use the id search method in addition to record ids, if you want klevu search to return other details such as name, description, price, etc , use the record search method both the id search and the record search methods have parameters that allow you to fetch filters/facets as well search as you type tab examples url https cloudsearchurl cloud search n search search name search as you type method get request pathparameters queryparameters kind required name ticket type string description this is your klevu js api key kind required name term type string description the actual term or a phrase searched by the shopper kind required name sv type string description the sv parameter is used for indicating which version of the klevu magento plugin you are using e g 1 2 5 in case of a non magento store please use the constant value 20 0 0 kind optional name autocomplete type boolean description if true the autosuggestions matching the submitted query terms are returned ndefault value is false t kind optional name typeofsuggestions type string description used for specifying the kind of non product suggestions e g cms category etc needed to be fetched use as a separator possible values cms category kind optional name noofresults type integer description indicates the number of records to be fetched for each type of suggestions for example if set to 3 then 3 products 3 categories and 3 cms pages will be returned kind optional name noofresultsac type integer description number of autocomplete suggestions to return kind optional name enablepartialsearch type boolean description if true the partial search is enabled for example searching for let may fetch both letter as well as tablet kind optional name sortorder type string description if you want to sort results in certain order please use one of the following values n rel for relevance n lth for price low to high n htl for price high to low kind optional name showoutofstockproducts type boolean description true to include out of stock products in the search result set false otherwise kind optional name pricefieldsuffix type string description if you are a shopify plus customer with the multicurrency feature enabled you can now provide a currency other than the base currency of your store to fetch prices in that currency if in case the prices are not available in the supplied currency klevu will return prices in the base currency of the store e g pricefieldsuffix usd kind optional name visibility type string description always set this parameter to search to include products with the visibility of search to be included in the result set kind optional name resultforzero type number description in case the original query does not produce any result setting this parameter to value 1 will bring products that are most popular on the site or are popular in the recentcategory as below kind optional name recentcategory type string description name of a category whose product was clicked most recently this parameter is used in conjuction with resultforzero parameter to produce suggestions in case no result is found for the query kind optional name noofresultszero type integer description if the fallback results are enabled for when there is no result found for a query this parameter tells how many results should be retrieved kind optional name optionalfilters type string description a parameter to enable personalisation it instructs klevu to boost products with the filter values specified here in case of multiple filters please use the double semicolon ;; as a delimiter n nwith each filter value one can assign a boost score n nfor example if in past a user was seen preferring green color products over any other color and brand to be nike one can specify the optionalfilters as the following n ne g color green 10;;brand nike 3 0 n nhere use ;; as a delimiter between two filter values and a score between 1 and 100 to boost filter options n nvalues provided here should be the strings taken from the value attribute of the option element under the filters kind optional name responsetype type string description type of response to be returned possible values are xml or json headerparameters bodydataparameters formdataparameters results languages id ddxomvwnislr jx48ghqd code n meta n layoutid n layouttype n noofresults 2 n paginationstartfrom 0 n powerdbylogo n totalresultsfound 404 n typeofquery wildcard and n storebasecurrency gbp n notificationcode 1 n term r n excludeids null n ispersonalised false n idsusedforpersonalisation null n n result n n discount n hidegroupprices n type fitness equipment n itemgroupid 4384059883582 n freeshipping n storebasecurrency gbp n price 19 00 n toprice n imageurl https cdn shopify com s files 1 0116 9457 1582 products ug05 gr 0 e8c85261 d103 4b09 9460 d8e0a2db97f5 medium jpg?v 1575478397 n currency gbp n instock yes n id 31366497206334 n imagehover n sku 24 ug05 n brand ksd n startprice n image https cdn shopify com s files 1 0116 9457 1582 products ug05 gr 0 e8c85261 d103 4b09 9460 d8e0a2db97f5 medium jpg?v 1575478397 n deliveryinfo n hideaddtocart n saleprice 19 0 n oldprice 19 0 n swatches n swatch n lowestprice n numberofadditionalvariants n n weight n klevu category klevu product;products;;accessories;;fitness equipment ku kucategory ku n totalvariants 0 n groupprices n url https jsv2 shopify demo ksearchmisc com products go getr pushup grips n tags durable grips pushup n name go get r pushup grips n shortdesc the go get r pushup grips safely provide the extra range of motion you need for a deep dip routine targeting core shoulder chest and arm strength do fewer pushups using more energy getting better results faster than the standard floor level te n category accessories;;fitness equipment n typeofrecord klevu product n n n discount n hidegroupprices n type jackets n itemgroupid 4384032915518 n freeshipping n storebasecurrency gbp n price 60 00 n toprice n imageurl https cdn shopify com s files 1 0116 9457 1582 products wj05 red main f6c5dcb4 59e1 42cd aeb6 3faf067c4935 medium jpg?v 1575477999 n currency gbp n instock yes n id 31366455066686 n imagehover n sku wj05 xs red n brand kke n startprice n image https cdn shopify com s files 1 0116 9457 1582 products wj05 red main f6c5dcb4 59e1 42cd aeb6 3faf067c4935 medium jpg?v 1575477999 n deliveryinfo n hideaddtocart n saleprice 60 0 n oldprice 60 0 n swatches n swatch n lowestprice n numberofadditionalvariants n n weight n klevu category klevu product;products;;jackets ku kucategory ku n totalvariants 0 n groupprices n url https jsv2 shopify demo ksearchmisc com products riona full zip jacket red n tags comfort machine royal running zipped n size medium n name riona full zip jacket n shortdesc the riona basic zip jacket makes the perfect extra layer for cold weather workouts it features amazing breathability and moisture management but full length zipper lets you moderate your core temperature even more brown heather full zi n category jackets n typeofrecord klevu product n n n filters n price n min n max n start n end n n autocomplete n popularterm n pages n n discount n hidegroupprices n type pages n itemgroupid page 50756288574 n freeshipping n storebasecurrency eur n price 0 0 n toprice n imageurl n currency eur n instock yes n id page 50756288574 n imagehover n startprice n image n deliveryinfo n hideaddtocart n saleprice 0 0 n oldprice 0 0 n swatches n swatch n lowestprice n numberofadditionalvariants n n weight n klevu category klevu cms ku kucategory ku n totalvariants 0 n groupprices n url https jsv2 shopify demo ksearchmisc com pages recipe fish chips n name recipe fish chips n shortdesc just a test recipe for fish chips n typeofrecord klevu cms n n n discount n hidegroupprices n type pages n itemgroupid page 53478424638 n freeshipping n storebasecurrency eur n price 0 0 n toprice n imageurl n currency eur n instock yes n id page 53478424638 n imagehover n startprice n image n deliveryinfo n hideaddtocart n saleprice 0 0 n oldprice 0 0 n swatches n swatch n lowestprice n numberofadditionalvariants n n weight n klevu category klevu cms ku kucategory ku n totalvariants 0 n groupprices n url https jsv2 shopify demo ksearchmisc com pages search results n name search results n shortdesc n typeofrecord klevu cms n n n categories n popularproducts n recentlyviewedproducts n ranges n error n errormessage n n language 200 customlabel selectedlanguageid ddxomvwnislr jx48ghqd examples languages id ewnrzcoksk8s4pdjfvhym code ?php n n curl curl init ; n ncurl setopt array curl array n curlopt url https eucs15 ksearchnet com cloud search n search search?ticket klevu 156925593843210765 term r sv 20 0 0 autocomplete false autocompletefilters category cms noofresults 2 showoutofstockproducts false responsetype json n curlopt returntransfer true n curlopt encoding n curlopt maxredirs 10 n curlopt timeout 0 n curlopt followlocation true n curlopt http version curl http version 1 1 n curlopt customrequest post n ; n n response curl exec curl ; n ncurl close curl ; necho response; n language curl customlabel selectedlanguageid ewnrzcoksk8s4pdjfvhym description use this api endpoint to build a search as you type solution it produces query suggestions category suggestions cms page suggestions and products matching the customer query n currentnewparameter label query parameter value queryparameters record search tab examples url https cloudsearchurl cloud search n search search name record search method get request pathparameters queryparameters kind required name ticket type string description this is your klevu js api key kind required name term type string description the actual term or a phrase searched by the shopper kind required name sv type string description the sv parameter is used for indicating which version of the klevu magento plugin you are using e g 1 2 5 in case of a non magento store please use the constant 20 0 0 kind optional name paginationstartsfrom type integer description index of the first record to be fetched if for example showing 12 results per page use the index 12 for the second page and 24 for the third page and so on default value is 0 kind optional name noofresults type number description indicates the number of records to be fetched if for example paginationstartsfrom is set to 0 it will obtain results from 0 default value is 12 kind optional name enablepartialsearch type boolean description if true the partial search is enabled for example searching for let may fetch letter as well as tablet default value is false kind optional name category type string description to filter results by specific category n nto fetch only products use klevu product as a value nto fetch only category pages use klevu category as a value nto fetch only cms pages use klevu cms as a value n nuse as a delimiter when supplying more than one values n ne g klevu product electronics furniture n nthis will search for products where the category is either electronics or furniture kind optional name enablefilters type boolean description if set to true filters relevant to the search results are retrieved and included in the response the default value is false kind optional name enablemultiselectfilters type boolean description if set to true we treat different values of a filter as checkboxes otherwise if set to false they are treated as radio buttons n ne g color green;;color white;;brand nike nwhen set to true it finds products with either green or white color with the brand nike when set to false it finds products with both green and white color and brand nike default value is false kind optional name applyfilters type string description tells klevu which filters to apply on the search results in case of multiple filters please use the double semicolon ;; as the delimiter n nvalues provided here should be the strings taken from the value attribute of the option element under the filters n ne g color green;;color white;;brand nike kind optional name maxnoofvaluesinafilter type integer description number of values to return for each filter the default is 50 kind optional name sortorder type string description if you want to sort results in certain order please use one of the following values n rel for relevance n lth for price low to high n htl for price high to low nthe default value is rel kind optional name showoutofstockproducts type boolean description true to include out of stock products in the search result set false otherwise the default value is false kind optional name fetchminmaxprice type boolean description if set to true it returns the minimum and maximum prices found for the obtained search results this can be used for example for displaying price slider if set to false klevu will return price ranges e g 0 500 500 1000 etc the price range intervals are dynamically generated by klevu the default value is false kind optional name pricefieldsuffix type string description if you are a shopify plus customer with the multicurrency feature enabled you can now provide a currency other than the base currency of your store to fetch prices in that currency if in case the prices are not available in the supplied currency klevu will return prices in the base currency of the store e g pricefieldsuffix usd kind optional name visibility type string description always set this parameter to search to include products with the visibility of search to be included in the result set the default value is search kind optional name resultforzero type integer description in case the original query does not produce any result setting this parameter to value 1 will bring products that are most popular on the site or are popular in the recentcategory as below the default value is 0 kind optional name recentcategory type string description name of a category whose product was clicked most recently this parameter is used in conjuction with resultforzero parameter to produce suggestions in case no result is found for the query kind optional name noofresultszero type integer description if the fallback results are enabled for when there is no result found for a query this parameter tells how many results should be retrieved the default value is 5 kind optional name optionalfilters type string description a parameter to enable personalisation it instructs klevu to boost products with the filter values specified here in case of multiple filters please use the double semicolon ;; as a delimiter n nwith each filter value one can assign a boost score n nfor example if in past a user was seen preferring green color products over any other color and brand to be nike one can specify the optionalfilters as the following n ne g color green 10;;brand nike 3 0 n nhere use ;; as a delimiter between two filter values and a score between 1 and 100 to boost filter options n nvalues provided here should be the strings taken from the value attribute of the option element under the filters kind optional name responsetype type string description type of response to be returned possible values are xml or json the default value is xml kind optional name lsqt type string description when you receive a response for a search query look at the value of the typeofquery element under the metadata section when you fire a subsequent query e g to apply additional filters or to obtain results for the next page pass this value as the value of the lsqt last search query type parameter possible values are wildcard and fuzzy and or fuzzy or kind optional name fl type string description when klevu returns search results the response has certain fields for each record included if you like to retrieve only a set of selected filters use a list of comma separated field names headerparameters bodydataparameters formdataparameters results languages id ddxomvwnislr jx48ghqd code n meta n layoutid n layouttype n noofresults 2 n paginationstartfrom 0 n powerdbylogo n totalresultsfound 448 n typeofquery wildcard and n storebasecurrency gbp n notificationcode 1 n term a n excludeids null n ispersonalised false n idsusedforpersonalisation null n n result n n discount n hidegroupprices n type watches klevu n itemgroupid 4384059326526 n freeshipping n storebasecurrency gbp n price 45 00 n toprice n imageurl https cdn shopify com s files 1 0116 9457 1582 products mg04 bk 0 b0a2adf9 f0c0 4814 8aa7 e421120afb06 medium jpg?v 1575478388 n currency gbp n instock yes n id 31366496616510 n imagehover https cdn shopify com s files 1 0116 9457 1582 products mg04 bk 0 1024x1024 1 cb15759f 9c8c 4899 a68a e379c5fe3735 medium jpg?v 1575478388 n sku 24 mg04 n brand ksd n startprice n image https cdn shopify com s files 1 0116 9457 1582 products mg04 bk 0 b0a2adf9 f0c0 4814 8aa7 e421120afb06 medium jpg?v 1575478388 n deliveryinfo n hideaddtocart n saleprice 45 0 n oldprice 45 0 n swatches n swatch n lowestprice n numberofadditionalvariants n n weight n klevu category klevu product;products;;watches ku kucategory ku n totalvariants 0 n groupprices n url https jsv2 shopify demo ksearchmisc com products aim analog watch n tags analog strap fit watch n size free size n name aim analog watch n shortdesc stay light years ahead of the competition with our aim analog watch the flexible rubberized strap is contoured to conform to the shape of your wrist for a comfortable all day fit the face features three illuminated hands a digital read out of n category watches n typeofrecord klevu product n n n discount n hidegroupprices n type watches n itemgroupid 4384058933310 n freeshipping n storebasecurrency gbp n price 55 00 n toprice n imageurl https cdn shopify com s files 1 0116 9457 1582 products mg05 br 0 5300c0c5 9008 480a ab61 cd7a670d18e0 medium jpg?v 1575478382 n currency gbp n instock yes n id 31366496124990 n imagehover n sku 24 mg05 n brand ksd n startprice n image https cdn shopify com s files 1 0116 9457 1582 products mg05 br 0 5300c0c5 9008 480a ab61 cd7a670d18e0 medium jpg?v 1575478382 n deliveryinfo n hideaddtocart n saleprice 55 0 n oldprice 55 0 n swatches n swatch n lowestprice n numberofadditionalvariants n n weight n klevu category klevu product;products;;watches ku kucategory ku n totalvariants 0 n groupprices n url https jsv2 shopify demo ksearchmisc com products cruise dual analog watch n tags analog cruise leather band watch n size free size n name cruise dual analog watch n shortdesc whether you re traveling or wish you were you ll never let time zones perplex you again with the cruise dual analog watch the thick adjustable band promises a comfortable personalized fit to this classy modern time piece two dia n category watches n typeofrecord klevu product n n n filters n price n min n max n start n end n n autocomplete n popularterm n pages n categories n popularproducts n recentlyviewedproducts n ranges n error n errormessage n n language 200 customlabel selectedlanguageid ddxomvwnislr jx48ghqd examples languages id uq140yeowlcssb8z1tfzr code ?php n n curl curl init ; n ncurl setopt array curl array n curlopt url https eucs15 ksearchnet com cloud search n search search?ticket klevu 156925593843210765 term a sv 20 0 0 paginationstartsfrom 0 noofresults 2 enablepartialsearch false category klevu product enablefilters false enablemultiselectfilters false showoutofstockproducts true responsetype json n curlopt returntransfer true n curlopt encoding n curlopt maxredirs 10 n curlopt timeout 0 n curlopt followlocation true n curlopt http version curl http version 1 1 n curlopt customrequest post n ; n n response curl exec curl ; n ncurl close curl ; necho response; n language curl customlabel selectedlanguageid uq140yeowlcssb8z1tfzr description use this api method if you want not only the record ids but also other details associated with the matching records the method allows you to retrieve facets and autosuggestions as well n currentnewparameter label query parameter value queryparameters id search tab examples url https cloudsearchurl cloud search n search idsearch name id search method get request pathparameters queryparameters kind required name ticket type string description this is your klevu js api key kind required name term type string description the actual term or a phrase searched by the shopper kind required name sv type string description the sv parameter is used for indicating which version of the klevu magento plugin you are using e g 1 2 5 in case of a non magento store please use the constant 20 0 0 kind optional name paginationstartsfrom type integer description index of the first record to be fetched if for example showing 12 results per page use the index 12 for the second page and 24 for the third page and so on default value is 0 kind optional name noofresults type number description indicates the number of records to be fetched if for example paginationstartsfrom is set to 0 it will obtain results from 0 default value is 12 kind optional name enablepartialsearch type boolean description if true the partial search is enabled for example searching for let may fetch letter as well as tablet default value is false kind optional name category type string description to filter results by specific category n nto fetch only products use klevu product as a value nto fetch only category pages use klevu category as a value nto fetch only cms pages use klevu cms as a value n nuse as a delimiter when supplying more than one values n ne g klevu product electronics furniture n nthis will search for products where the category is either electronics or furniture kind optional name enablefilters type boolean description if set to true filters relevant to the search results are retrieved and included in the response the default value is false kind optional name enablemultiselectfilters type boolean description if set to true we treat different values of a filter as checkboxes otherwise if set to false they are treated as radio buttons n ne g color green;;color white;;brand nike nwhen set to true it finds products with either green or white color with the brand nike when set to false it finds products with both green and white color and brand nike default value is false kind optional name applyfilters type string description tells klevu which filters to apply on the search results in case of multiple filters please use the double semicolon ;; as the delimiter n nvalues provided here should be the strings taken from the value attribute of the option element under the filters n ne g color green;;color white;;brand nike kind optional name maxnoofvaluesinafilter type integer description number of values to return for each filter the default is 50 kind optional name sortorder type string description if you want to sort results in certain order please use one of the following values n rel for relevance n lth for price low to high n htl for price high to low nthe default value is rel kind optional name showoutofstockproducts type boolean description true to include out of stock products in the search result set false otherwise the default value is false kind optional name fetchminmaxprice type boolean description if set to true it returns the minimum and maximum prices found for the obtained search results this can be used for example for displaying price slider if set to false klevu will return price ranges e g 0 500 500 1000 etc the price range intervals are dynamically generated by klevu the default value is false kind optional name pricefieldsuffix type string description if you are a shopify plus customer with the multicurrency feature enabled you can now provide a currency other than the base currency of your store to fetch prices in that currency if in case the prices are not available in the supplied currency klevu will return prices in the base currency of the store e g pricefieldsuffix usd kind optional name visibility type string description always set this parameter to search to include products with the visibility of search to be included in the result set the default value is search kind optional name resultforzero type integer description in case the original query does not produce any result setting this parameter to value 1 will bring products that are most popular on the site or are popular in the recentcategory as below the default value is 0 kind optional name recentcategory type string description name of a category whose product was clicked most recently this parameter is used in conjuction with resultforzero parameter to produce suggestions in case no result is found for the query kind optional name noofresultszero type integer description if the fallback results are enabled for when there is no result found for a query this parameter tells how many results should be retrieved the default value is 5 kind optional name optionalfilters type string description a parameter to enable personalisation it instructs klevu to boost products with the filter values specified here in case of multiple filters please use the double semicolon ;; as a delimiter n nwith each filter value one can assign a boost score n nfor example if in past a user was seen preferring green color products over any other color and brand to be nike one can specify the optionalfilters as the following n ne g color green 10;;brand nike 3 0 n nhere use ;; as a delimiter between two filter values and a score between 1 and 100 to boost filter options n nvalues provided here should be the strings taken from the value attribute of the option element under the filters kind optional name responsetype type string description type of response to be returned possible values are xml or json the default value is xml kind optional name lsqt type string description when you receive a response for a search query look at the value of the typeofquery element under the metadata section when you fire a subsequent query e g to apply additional filters or to obtain results for the next page pass this value as the value of the lsqt last search query type parameter possible values are wildcard and fuzzy and or fuzzy or kind optional name fl type string description when klevu returns search results the response has certain fields for each record included if you like to retrieve only a set of selected filters use a list of comma separated field names headerparameters bodydataparameters formdataparameters results languages id ddxomvwnislr jx48ghqd code n meta n layoutid n layouttype n noofresults 2 n paginationstartfrom 0 n powerdbylogo n totalresultsfound 398 n typeofquery wildcard and n storebasecurrency n notificationcode 1 n term r n excludeids null n ispersonalised false n idsusedforpersonalisation null n n result n n id 31366497206334 n itemgroupid 4384059883582 n n n id 31366455066686 n itemgroupid 4384032915518 n n n filters n price n min n max n start n end n n autocomplete n popularterm n pages n categories n popularproducts n recentlyviewedproducts n ranges n error n errormessage n n language 200 customlabel selectedlanguageid ddxomvwnislr jx48ghqd examples languages id uq140yeowlcssb8z1tfzr code ?php n n curl curl init ; n ncurl setopt array curl array n curlopt url https eucs15 ksearchnet com cloud search n search idsearch?ticket klevu 156925593843210765 term r sv 20 0 0 paginationstartsfrom 0 noofresults 2 enablepartialsearch false category klevu product enablefilters false enablemultiselectfilters false showoutofstockproducts false responsetype json n curlopt returntransfer true n curlopt encoding n curlopt maxredirs 10 n curlopt timeout 0 n curlopt followlocation true n curlopt http version curl http version 1 1 n curlopt customrequest post n ; n n response curl exec curl ; n ncurl close curl ; necho response; n language curl customlabel selectedlanguageid uq140yeowlcssb8z1tfzr description use this api method if you require only the ids of the records matching your query the method also allows you to retrieve facets associated with the search results currentnewparameter label query parameter value queryparameters