Calling the Personalized Searc...
Auto-Suggestions
an auto suggestions request returns suggested search terms as the customer types each character in their search term therefore, a personalized search api call is made each time the customer types a new character personalized search is both typo tolerant and word order–tolerant, so it can return suggestions even when the customer misspells one or more words (for example, headlites instead of headlights ) or puts the words of a search term in an unusual order (for example, chairs outdoor instead of outdoor chairs ) the recommended interval to wait between auto suggestions request calls is 250 ms on key presses and 30 ms on focus { "name" "auto suggestions request", "method" "post", "url" "https //engine monetate net/api/search/v1/site search/{name}/{instance}/{domain}/search", "description" "", "tab" "examples", "examples" { "languages" \[ { "id" "5mn85rzvqdiozku2cgr1k", "language" "json", "code" "{\n \\"searchtoken\\" \\"monetate 156925593843210765\\",\n \\"suggestions\\" \[\n {\n \\"id\\" \\"mysuggestionsquery1\\",\n \\"typeofrequest\\" \\"auto suggestions\\",\n \\"query\\" \\"shirt\\",\n \\"limit\\" 2\n },\n {\n \\"id\\" \\"mysuggestionsquery2\\",\n \\"typeofrequest\\" \\"auto suggestions\\",\n \\"query\\" \\"short\\",\n \\"limit\\" 3,\n \\"hlstartelem\\" \\"\<span style='color\ red'>\\",\n \\"hlendelem\\" \\"\</span>\\"\n }\n ]\n}", "customlabel" "example auto suggestions request" } ], "selectedlanguageid" "5mn85rzvqdiozku2cgr1k" }, "results" { "languages" \[ { "id" "dvgajmba4nesxqqvts7iv", "language" "200", "customlabel" "", "code" "{\n \\"suggestionresults\\" \[\n {\n \\"id\\" \\"mysuggestionsquery1\\",\n \\"suggestions\\" \[\n {\n \\"suggest\\" \\"sweatshirt\\"\n },\n {\n \\"suggest\\" \\"street sweatshirt\\"\n }\n ]\n },\n {\n \\"id\\" \\"mysuggestionsquery2\\",\n \\"suggestions\\" \[\n {\n \\"suggest\\" \\"\<span style='color\ red'>short\</span>\\"\n },\n {\n \\"suggest\\" \\"\<span style='color\ red'>short\</span>s\\"\n },\n {\n \\"suggest\\" \\"\<span style='color\ red'>short\</span> sleeve\\"\n }\n ]\n }\n ]\n}" } ], "selectedlanguageid" "dvgajmba4nesxqqvts7iv" }, "request" { "pathparameters" \[ { "name" "name", "kind" "required", "type" "string", "description" "the client's account (for example, \\"a 1db61f7a\\") as it appears in the value of channel used in the engine api request to obtain the search token ", "" "the client's account (for example, \\"a 1db61f7a\\") as it appears in the value of channel used in the engine api request to obtain the search token " }, { "name" "instance", "kind" "required", "type" "string", "description" "the client's account environment the value must either be \\"p\\" for production or \\"d\\" for development ", "" "the client's account environment the value must either be \\"p\\" for production or \\"d\\" for development " }, { "name" "domain", "kind" "required", "type" "string", "description" "the client's domain (for example, \\"product monetate me\\") as it appears in the value of channel used in the engine api request to obtain the search token ", "" "the client's domain (for example, \\"product monetate me\\") as it appears in the value of channel used in the engine api request to obtain the search token " } ], "queryparameters" \[], "headerparameters" \[ { "name" "content type", "kind" "required", "type" "string", "description" "the value must be \\"application/json \\"", "" "the value must be \\"application/json \\"" } ], "bodydataparameters" \[ { "name" "searchtoken", "kind" "required", "type" "string", "description" "a token used to authenticate the search request obtained by sending a request to the engine api see \\"obtaining a search token\\" in \\"calling the personalized search api\\" for more information ", "" "required" }, { "name" "suggestions", "kind" "required", "type" "object", "description" "the set of parameters that define an auto suggestions request ", "children" \[ { "name" "id", "kind" "required", "type" "string", "description" "a unique identifier associated with a suggestion request " }, { "name" "typeofrequest", "kind" "required", "type" "string", "description" "the type of query request use \\"auto suggestions\\" for the value " }, { "name" "query", "kind" "required", "type" "string", "description" "the search term the customer input " }, { "name" "limit", "kind" "required", "type" "number", "description" "the maximum number of suggestions to return " }, { "name" "hlstartelem", "kind" "optional", "type" "string", "description" "an html element applied at the start of the part of the auto suggestion result that matches what the customer typed to highlight the match if you don't specify this parameter, a value of \<b> is automatically applied to make the match boldface " }, { "name" "hlendelem", "kind" "optional", "type" "string", "description" "an html element applied at the end of the part of the auto suggestion result that matches what the customer typed if you don't specify this parameter, a value of \</b> is automatically applied " } ], "schema" \[ { "name" "id", "kind" "required", "type" "string", "description" "a unique identifier associated with a suggestion request " }, { "name" "typeofrequest", "kind" "required", "type" "string", "description" "the type of query request use \\"auto suggestions\\" for the value " }, { "name" "query", "kind" "required", "type" "string", "description" "the search term the customer input " }, { "name" "limit", "kind" "required", "type" "number", "description" "the maximum number of suggestions to return " }, { "name" "hlstartelem", "kind" "optional", "type" "string", "description" "an html element applied at the start of the part of the auto suggestion result that matches what the customer typed to highlight the match if you don't specify this parameter, a value of \<b> is automatically applied to make the match boldface " }, { "name" "hlendelem", "kind" "optional", "type" "string", "description" "an html element applied at the end of the part of the auto suggestion result that matches what the customer typed if you don't specify this parameter, a value of \</b> is automatically applied " } ] } ], "formdataparameters" \[] }, "currentnewparameter" { "label" "body parameter", "value" "bodydataparameters" }, "hastryitout" false } displaying both search terms and products personalized search can return products along with suggested search terms as the customer types their search query showing customers products alongside suggested search terms is available not only to personalized search clients that have personalized site search in their contract but also to clients that only have personalized category pages in their contract to display both suggested search terms and products before the customer finishes typing their full search query, the request must contain both the suggestions object and the recordqueries object, with the value of its typeofrequest key defined as "search" here's an example of an request that includes both auto suggestions and product search example auto suggestions and product search request { "searchtoken" "monetate 156925593843210765", "suggestions" \[ { "id" "autosuggestion", "query" "guitars", "typeofrequest" "auto suggestions", "limit" 5 } ], "recordqueries" \[ { "id" "productsearch", "typeofrequest" "search", "settings" { "query" { "term" "guitars" }, "limit" 5, "typeofrecords" \[ "monetate product" ] } } ] } refer to the recordqueries definition in personalized site search queries for more information about its required and optional parameters