---
title: Configurations
slug: apis/smart-search-configurations
docTags: 
createdAt: 2022-04-25T06:53:02.000Z
---

:::hint{type="info"}
If you haven't gone through the prerequisites and the v2 structure, please have a look at [Overview](docId\:cZeodl0sKcuv-18IPupLr)&#x20;
:::

There are numerous settings, preferences, and configurations available with APIv2 to fine-tune your search and category merchandising queries. This section explores them in more detail.&#x20;

## Sorting

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.

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://{{hostname}}/cs/v2/search",
  "name": "Sort",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "optional",
        "name": "RELEVANCE",
        "type": "String",
        "description": "This is the default sort order, which uses a combination of Klevu A.I. and your own merchandising configuration to determine the order of the results. "
      },
      {
        "kind": "optional",
        "name": "PRICE_ASC",
        "type": "string",
        "description": "Sort the results in ascending order by the salePrice value of each record."
      },
      {
        "kind": "optional",
        "name": "PRICE_DESC",
        "type": "string",
        "description": "Sort the results in descending order by the salePrice value of each record."
      },
      {
        "kind": "optional",
        "name": "NAME_ASC",
        "type": "string",
        "description": "Sort the results in ascending by the name of each record, in alphabetical order."
      },
      {
        "kind": "optional",
        "name": "NAME_DESC",
        "type": "string",
        "description": "Sort the results in descending by the name of each record, in alphabetical order."
      },
      {
        "kind": "optional",
        "name": "RATING_ASC",
        "type": "string",
        "description": "Sort the results in ascending by each record's average rating, if this data has been indexed in your store."
      },
      {
        "kind": "optional",
        "name": "RATING_DESC",
        "type": "string",
        "description": "Sort the results in descending by each record's average rating, if this data has been indexed in your store."
      },
      {
        "kind": "optional",
        "name": "NEW_ARRIVAL_ASC",
        "type": "string",
        "description": "Sort your records in ascending order based on their published date. "
      },
      {
        "kind": "optional",
        "name": "NEW_ARRIVAL_DESC",
        "type": "string",
        "description": "Sort your records in descending order based on their published date. "
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "3XlvmT855lGkJOht0nPXg",
        "code": "{\n    \"meta\": {\n        \"qTime\": 18,\n        \"responseCode\": 200\n    },\n    \"queryResults\": [\n        {\n            \"id\": \"productSearch\",\n            \"meta\": {\n                \"qTime\": 17,\n                \"noOfResults\": 12,\n                \"totalResultsFound\": 105,\n                \"typeOfSearch\": \"WILDCARD_AND\",\n                \"offset\": 0,\n                \"debuggingInformation\": {},\n                \"notificationCode\": 1,\n                \"searchedTerm\": \"short\",\n                \"apiKey\": \"klevu-156925593843210765\",\n                \"isPersonalised\": false\n            },\n            \"records\": [\n                {\n                    \"score\": \"0.19684093\",\n                    \"salePrice\": \"24.00\",\n                    \"name\": \"Aero Daily Fitness Tee\",\n                    \"id\": \"31366478200894\"\n                },\n                {\n                    \"score\": \"0.19684093\",\n                    \"salePrice\": \"24.00\",\n                    \"name\": \"Aero Daily Fitness Tee\",\n                    \"id\": \"31366478364734\"\n                },\n                {\n                    \"score\": \"0.19684093\",\n                    \"salePrice\": \"24.00\",\n                    \"name\": \"Aero Daily Fitness Tee\",\n                    \"id\": \"31366478495806\"\n                },\n                {\n                    \"score\": \"1.0985985\",\n                    \"salePrice\": \"40.00\",\n                    \"name\": \"Ana Running Short\",\n                    \"id\": \"31366431768638\"\n                },\n                {\n                    \"score\": \"1.0985985\",\n                    \"salePrice\": \"40.00\",\n                    \"name\": \"Ana Running Short\",\n                    \"id\": \"31366431899710\"\n                },\n                {\n                    \"score\": \"1.0985984\",\n                    \"salePrice\": \"40.00\",\n                    \"name\": \"Ana Running Short\",\n                    \"id\": \"31366431834174\"\n                },\n                {\n                    \"score\": \"1.0985985\",\n                    \"salePrice\": \"42.00\",\n                    \"name\": \"Angel Light Running Short\",\n                    \"id\": \"31366434062398\"\n                },\n                {\n                    \"score\": \"1.0985985\",\n                    \"salePrice\": \"42.00\",\n                    \"name\": \"Angel Light Running Short\",\n                    \"id\": \"31366433177662\"\n                },\n                {\n                    \"score\": \"1.0985985\",\n                    \"salePrice\": \"42.00\",\n                    \"name\": \"Angel Light Running Short\",\n                    \"id\": \"31366433996862\"\n                },\n                {\n                    \"score\": \"1.0985929\",\n                    \"salePrice\": \"32.50\",\n                    \"name\": \"Apollo Running Short\",\n                    \"id\": \"31366465880126\"\n                },\n                {\n                    \"score\": \"1.0985985\",\n                    \"salePrice\": \"20.00\",\n                    \"name\": \"Arcadio Gym Short\",\n                    \"id\": \"31366462668862\"\n                },\n                {\n                    \"score\": \"1.0985985\",\n                    \"salePrice\": \"20.00\",\n                    \"name\": \"Arcadio Gym Short\",\n                    \"id\": \"31366462767166\"\n                }\n            ],\n            \"filters\": []\n        }\n    ]\n}",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "3XlvmT855lGkJOht0nPXg"
  },
  "examples": {
    "languages": [
      {
        "id": "jSU7DlYyJ_eUh63YSP682",
        "code": "{\n  \"recordQueries\": [\n    {\n      \"settings\": {\n        \"sort\": \"NAME_ASC\",\n        \"query\": {\n          \"term\": \"short\"\n        },\n        \"fields\": [\n          \"id\",\n          \"name\",\n          \"rating\",\n          \"salePrice\",\n          \"score\"\n        ]\n      },\n      \"id\": \"productSearch\"\n    }\n  ],\n  \"context\": {\n    \"apiKeys\": [\n      \"klevu-156925593843210765\"\n    ]\n  }\n}",
        "language": "json",
        "customLabel": "Request Body (JSON)"
      },
      {
        "id": "8Yg33Te4JzfoWp5yEbmJh",
        "code": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => 'https://eucs15v2.ksearchnet.com/cs/v2/search',\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  CURLOPT_POSTFIELDS =>'{\n  \"recordQueries\": [\n    {\n      \"settings\": {\n        \"sort\": \"NAME_ASC\",\n        \"query\": {\n          \"term\": \"short\"\n        },\n        \"fields\": [\n          \"id\",\n          \"name\",\n          \"rating\",\n          \"salePrice\",\n          \"score\"\n        ]\n      },\n      \"id\": \"productSearch\"\n    }\n  ],\n  \"context\": {\n    \"apiKeys\": [\n      \"klevu-156925593843210765\"\n    ]\n  }\n}',\n  CURLOPT_HTTPHEADER => array(\n    'Content-Type: application/json'\n  ),\n));\n\n$response = curl_exec($curl);\n\ncurl_close($curl);\necho $response;\n",
        "language": "php",
        "customLabel": ""
      },
      {
        "id": "WCDgTsSqAXfiwklk2V174",
        "code": "var data = JSON.stringify({\"recordQueries\":[{\"settings\":{\"sort\":\"NAME_ASC\",\"query\":{\"term\":\"short\"},\"fields\":[\"id\",\"name\",\"rating\",\"salePrice\",\"score\"]},\"id\":\"productSearch\"}],\"context\":{\"apiKeys\":[\"klevu-156925593843210765\"]}});\n\nvar xhr = new XMLHttpRequest();\nxhr.withCredentials = false;\n\nxhr.addEventListener(\"readystatechange\", function() {\n  if(this.readyState === 4) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"POST\", \"https://eucs15v2.ksearchnet.com/cs/v2/search\");\nxhr.setRequestHeader(\"Content-Type\", \"application/json\");\n\nxhr.send(data);",
        "language": "javascript",
        "customLabel": ""
      },
      {
        "id": "nPW0NIJe-j5R9I5W4BGN0",
        "code": "OkHttpClient client = new OkHttpClient().newBuilder()\n  .build();\nMediaType mediaType = MediaType.parse(\"application/json\");\nRequestBody body = RequestBody.create(mediaType, \"{\\n  \\\"recordQueries\\\": [\\n    {\\n      \\\"settings\\\": {\\n        \\\"sort\\\": \\\"NAME_ASC\\\",\\n        \\\"query\\\": {\\n          \\\"term\\\": \\\"short\\\"\\n        },\\n        \\\"fields\\\": [\\n          \\\"id\\\",\\n          \\\"name\\\",\\n          \\\"rating\\\",\\n          \\\"salePrice\\\",\\n          \\\"score\\\"\\n        ]\\n      },\\n      \\\"id\\\": \\\"productSearch\\\"\\n    }\\n  ],\\n  \\\"context\\\": {\\n    \\\"apiKeys\\\": [\\n      \\\"klevu-156925593843210765\\\"\\n    ]\\n  }\\n}\");\nRequest request = new Request.Builder()\n  .url(\"https://eucs15v2.ksearchnet.com/cs/v2/search\")\n  .method(\"POST\", body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .build();\nResponse response = client.newCall(request).execute();",
        "language": "java",
        "customLabel": ""
      },
      {
        "id": "0Ih7nieKhHFMl7CRY51j_",
        "code": "var request = require('request');\nvar options = {\n  'method': 'POST',\n  'url': 'https://eucs15v2.ksearchnet.com/cs/v2/search',\n  'headers': {\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"recordQueries\":[{\"settings\":{\"sort\":\"NAME_ASC\",\"query\":{\"term\":\"short\"},\"fields\":[\"id\",\"name\",\"rating\",\"salePrice\",\"score\"]},\"id\":\"productSearch\"}],\"context\":{\"apiKeys\":[\"klevu-156925593843210765\"]}})\n\n};\nrequest(options, function (error, response) {\n  if (error) throw new Error(error);\n  console.log(response.body);\n});\n",
        "language": "nodejs",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "WCDgTsSqAXfiwklk2V174"
  },
  "description": "This is an example how to set record sorting order. ",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "hasTryItOut": false,
  "autoGeneratedAnchorSlug": "sort",
  "legacyHash": "CcPLwsroBJn8JRJLHZ2ot"
}
```
:::

### Try it here!

:::Iframe{code="<iframe src=&#x22;https://codesandbox.io/embed/klevu-api-sendbox-4ktfrp?fontsize=14&hidenavigation=0&theme=dark&view=preview&initialpath=?payload=sorting&#x22;&#xA;     style=&#x22;width:100%; height:550px; border:0; border-radius: 4px; overflow:hidden;&#x22;&#xA;     title=&#x22;klevu_api sendbox&#x22;&#xA;     allow=&#x22;accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking&#x22;&#xA;     sandbox=&#x22;allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts&#x22;&#xA;     &#xA;   ></iframe>" iframeHeight="550"}

:::

## Pagination&#x20;

You may wish to split larger result sets over multiple pages. You can do this using pagination. Simply specify a page size for how many results each page should include, and an offset of which record to start each result set from.

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://{{hostname}}/cs/v2/search",
  "name": "Pagination",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "optional",
        "name": "limit",
        "type": "Integer",
        "description": "Specify the number of records you would like to display per page. If this field is not passed in the API, the default value is 12. You can fetch a maximum of 100 records when you pass the limit. In order to get more than 100 records, you must define the 'fields' in the API."
      },
      {
        "kind": "optional",
        "name": "offset",
        "type": "Integer",
        "description": "Specify the index at which to start counting the number of results from.\n\nThe 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."
      },
      {
        "kind": "optional",
        "name": "typeOfSearch",
        "type": "string",
        "description": "After the first has been retrieved, for subsequent pagination requests it is recommended to include the typeOfSearch value using the same value that came back in the meta data with the results of the first result. This will give a performance benefit since Klevu does not need to try different search types, and will also assure consistency of results across pages."
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "3XlvmT855lGkJOht0nPXg",
        "code": "{\n    \"meta\": {\n        \"qTime\": 12,\n        \"responseCode\": 200\n    },\n    \"queryResults\": [\n        {\n            \"id\": \"productSearch\",\n            \"meta\": {\n                \"qTime\": 11,\n                \"noOfResults\": 5,\n                \"totalResultsFound\": 105,\n                \"typeOfSearch\": \"WILDCARD_AND\",\n                \"offset\": 4,\n                \"debuggingInformation\": {},\n                \"notificationCode\": 1,\n                \"searchedTerm\": \"short\",\n                \"apiKey\": \"klevu-156925593843210765\",\n                \"isPersonalised\": false\n            },\n            \"records\": [\n                {\n                    \"name\": \"Hawkeye Yoga Short\",\n                    \"id\": \"31366465060926\"\n                },\n                {\n                    \"name\": \"Pierce Gym Short\",\n                    \"id\": \"31366462472254\"\n                },\n                {\n                    \"name\": \"Hawkeye Yoga Short\",\n                    \"id\": \"31366465191998\"\n                },\n                {\n                    \"name\": \"Hawkeye Yoga Short\",\n                    \"id\": \"31366465126462\"\n                },\n                {\n                    \"name\": \"Pierce Gym Short\",\n                    \"id\": \"31366462439486\"\n                }\n            ],\n            \"filters\": []\n        }\n    ]\n}",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "3XlvmT855lGkJOht0nPXg"
  },
  "examples": {
    "languages": [
      {
        "id": "jSU7DlYyJ_eUh63YSP682",
        "code": "{\n  \"recordQueries\": [\n    {\n      \"settings\": {\n        \"limit\": 5,\n        \"offset\": 4,\n        \"typeOfSearch\": \"WILDCARD_AND\",\n        \"query\": {\n          \"term\": \"short\"\n        },\n        \"fields\": [\n          \"id\",\n          \"name\"\n        ]\n      },\n      \"id\": \"productSearch\"\n    }\n  ],\n  \"context\": {\n    \"apiKeys\": [\n      \"klevu-156925593843210765\"\n    ]\n  }\n}",
        "language": "json",
        "customLabel": "Request Body (JSON)"
      },
      {
        "id": "8Yg33Te4JzfoWp5yEbmJh",
        "code": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => 'https://eucs15v2.ksearchnet.com/cs/v2/search',\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  CURLOPT_POSTFIELDS =>'{\n  \"recordQueries\": [\n    {\n      \"settings\": {\n        \"limit\": 5,\n        \"offset\": 4,\n        \"typeOfSearch\": \"WILDCARD_AND\",\n        \"query\": {\n          \"term\": \"short\"\n        },\n        \"fields\": [\n          \"id\",\n          \"name\"\n        ]\n      },\n      \"id\": \"productSearch\"\n    }\n  ],\n  \"context\": {\n    \"apiKeys\": [\n      \"klevu-156925593843210765\"\n    ]\n  }\n}',\n  CURLOPT_HTTPHEADER => array(\n    'Content-Type: application/json'\n  ),\n));\n\n$response = curl_exec($curl);\n\ncurl_close($curl);\necho $response;\n",
        "language": "php",
        "customLabel": ""
      },
      {
        "id": "WCDgTsSqAXfiwklk2V174",
        "code": "var data = JSON.stringify({\"recordQueries\":[{\"settings\":{\"limit\":5,\"offset\":4,\"typeOfSearch\":\"WILDCARD_AND\",\"query\":{\"term\":\"short\"},\"fields\":[\"id\",\"name\"]},\"id\":\"productSearch\"}],\"context\":{\"apiKeys\":[\"klevu-156925593843210765\"]}});\n\nvar xhr = new XMLHttpRequest();\nxhr.withCredentials = false;\n\nxhr.addEventListener(\"readystatechange\", function() {\n  if(this.readyState === 4) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"POST\", \"https://eucs15v2.ksearchnet.com/cs/v2/search\");\nxhr.setRequestHeader(\"Content-Type\", \"application/json\");\n\nxhr.send(data);",
        "language": "javascript",
        "customLabel": ""
      },
      {
        "id": "nPW0NIJe-j5R9I5W4BGN0",
        "code": "OkHttpClient client = new OkHttpClient().newBuilder()\n  .build();\nMediaType mediaType = MediaType.parse(\"application/json\");\nRequestBody body = RequestBody.create(mediaType, \"{\\n  \\\"recordQueries\\\": [\\n    {\\n      \\\"settings\\\": {\\n        \\\"limit\\\": 5,\\n        \\\"offset\\\": 4,\\n        \\\"typeOfSearch\\\": \\\"WILDCARD_AND\\\",\\n        \\\"query\\\": {\\n          \\\"term\\\": \\\"short\\\"\\n        },\\n        \\\"fields\\\": [\\n          \\\"id\\\",\\n          \\\"name\\\"\\n        ]\\n      },\\n      \\\"id\\\": \\\"productSearch\\\"\\n    }\\n  ],\\n  \\\"context\\\": {\\n    \\\"apiKeys\\\": [\\n      \\\"klevu-156925593843210765\\\"\\n    ]\\n  }\\n}\");\nRequest request = new Request.Builder()\n  .url(\"https://eucs15v2.ksearchnet.com/cs/v2/search\")\n  .method(\"POST\", body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .build();\nResponse response = client.newCall(request).execute();",
        "language": "java",
        "customLabel": ""
      },
      {
        "id": "0Ih7nieKhHFMl7CRY51j_",
        "code": "var request = require('request');\nvar options = {\n  'method': 'POST',\n  'url': 'https://eucs15v2.ksearchnet.com/cs/v2/search',\n  'headers': {\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"recordQueries\":[{\"settings\":{\"limit\":5,\"offset\":4,\"typeOfSearch\":\"WILDCARD_AND\",\"query\":{\"term\":\"short\"},\"fields\":[\"id\",\"name\"]},\"id\":\"productSearch\"}],\"context\":{\"apiKeys\":[\"klevu-156925593843210765\"]}})\n\n};\nrequest(options, function (error, response) {\n  if (error) throw new Error(error);\n  console.log(response.body);\n});\n",
        "language": "nodejs",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "WCDgTsSqAXfiwklk2V174"
  },
  "description": "This is an example how to paginate records. ",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "hasTryItOut": false,
  "autoGeneratedAnchorSlug": "pagination-1",
  "legacyHash": "kFUu5Gv3MJQdKVqAqy7PY"
}
```
:::

**Understanding response format**

| **Params**        | **Description**                                                    |   |
| ----------------- | ------------------------------------------------------------------ | - |
| noOfResults       | The number of results requested to be returned for this query.     |   |
| totalResultsFound | The total number of results found for this query.                  |   |
| offset            | The index of the first result returned in this response.           |   |
| typeOfSearch      | The query type that was executed by Klevu to retrieve the results. |   |

### Try it here!

:::Iframe{code="<iframe src=&#x22;https://codesandbox.io/embed/klevu-api-sendbox-4ktfrp?fontsize=14&hidenavigation=0&theme=dark&view=preview&initialpath=?payload=pagination&#x22;&#xA;     style=&#x22;width:100%; height:550px; border:0; border-radius: 4px; overflow:hidden;&#x22;&#xA;     title=&#x22;klevu_api sendbox&#x22;&#xA;     allow=&#x22;accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking&#x22;&#xA;     sandbox=&#x22;allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts&#x22;&#xA;     &#xA;   ></iframe>" iframeHeight="550"}

:::

## Fields

By default, Klevu will return most of the data available in a record. If you only need certain elements and want to keep the response size small for performance reasons, you can specify only the fields you are interested in.

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://{{hostname}}/cs/v2/search",
  "name": "Fields",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "optional",
        "name": "fields",
        "type": "Array",
        "description": "An array of the attribute IDs that you wish to retrieve, eg. \"id\", \"name\", \"salePrice\", etc. Please refer to Searching for Records to see all of the available fields."
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "3XlvmT855lGkJOht0nPXg",
        "code": "{\n    \"meta\": {\n        \"qTime\": 14,\n        \"responseCode\": 200\n    },\n    \"queryResults\": [\n        {\n            \"id\": \"productSearch\",\n            \"meta\": {\n                \"qTime\": 12,\n                \"noOfResults\": 12,\n                \"totalResultsFound\": 105,\n                \"typeOfSearch\": \"WILDCARD_AND\",\n                \"offset\": 0,\n                \"debuggingInformation\": {},\n                \"notificationCode\": 1,\n                \"searchedTerm\": \"short\",\n                \"apiKey\": \"klevu-156925593843210765\",\n                \"isPersonalised\": false\n            },\n            \"records\": [\n                {\n                    \"salePrice\": \"45.00\",\n                    \"name\": \"Erika Running Short\",\n                    \"id\": \"31366431146046\"\n                },\n                {\n                    \"salePrice\": \"45.00\",\n                    \"name\": \"Erika Running Short\",\n                    \"id\": \"31366431080510\"\n                },\n                {\n                    \"salePrice\": \"45.00\",\n                    \"name\": \"Erika Running Short\",\n                    \"id\": \"31366431014974\"\n                },\n                {\n                    \"salePrice\": \"32.50\",\n                    \"name\": \"Meteor Workout Short\",\n                    \"id\": \"31366465781822\"\n                },\n                {\n                    \"salePrice\": \"29.00\",\n                    \"name\": \"Hawkeye Yoga Short\",\n                    \"id\": \"31366465060926\"\n                },\n                {\n                    \"salePrice\": \"27.00\",\n                    \"name\": \"Pierce Gym Short\",\n                    \"id\": \"31366462472254\"\n                },\n                {\n                    \"salePrice\": \"29.00\",\n                    \"name\": \"Hawkeye Yoga Short\",\n                    \"id\": \"31366465191998\"\n                },\n                {\n                    \"salePrice\": \"29.00\",\n                    \"name\": \"Hawkeye Yoga Short\",\n                    \"id\": \"31366465126462\"\n                },\n                {\n                    \"salePrice\": \"27.00\",\n                    \"name\": \"Pierce Gym Short\",\n                    \"id\": \"31366462439486\"\n                },\n                {\n                    \"salePrice\": \"27.00\",\n                    \"name\": \"Pierce Gym Short\",\n                    \"id\": \"31366462373950\"\n                },\n                {\n                    \"salePrice\": \"32.00\",\n                    \"name\": \"Sol Active Short\",\n                    \"id\": \"31366463094846\"\n                },\n                {\n                    \"salePrice\": \"32.00\",\n                    \"name\": \"Sol Active Short\",\n                    \"id\": \"31366463029310\"\n                }\n            ],\n            \"filters\": []\n        }\n    ]\n}",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "3XlvmT855lGkJOht0nPXg"
  },
  "examples": {
    "languages": [
      {
        "id": "jSU7DlYyJ_eUh63YSP682",
        "code": "{\n  \"recordQueries\": [\n    {\n      \"settings\": {\n        \"fields\": [\n          \"id\",\n          \"name\",\n          \"salePrice\"\n        ],\n        \"query\": {\n          \"term\": \"short\"\n        }\n      },\n      \"id\": \"productSearch\"\n    }\n  ],\n  \"context\": {\n    \"apiKeys\": [\n      \"klevu-156925593843210765\"\n    ]\n  }\n}",
        "language": "json",
        "customLabel": "Request Body (JSON)"
      },
      {
        "id": "8Yg33Te4JzfoWp5yEbmJh",
        "code": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => 'https://eucs15v2.ksearchnet.com/cs/v2/search',\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  CURLOPT_POSTFIELDS =>'{\n  \"recordQueries\": [\n    {\n      \"settings\": {\n        \"fields\": [\n          \"id\",\n          \"name\",\n          \"salePrice\"\n        ],\n        \"query\": {\n          \"term\": \"short\"\n        }\n      },\n      \"id\": \"productSearch\"\n    }\n  ],\n  \"context\": {\n    \"apiKeys\": [\n      \"klevu-156925593843210765\"\n    ]\n  }\n}',\n  CURLOPT_HTTPHEADER => array(\n    'Content-Type: application/json'\n  ),\n));\n\n$response = curl_exec($curl);\n\ncurl_close($curl);\necho $response;\n",
        "language": "php",
        "customLabel": ""
      },
      {
        "id": "WCDgTsSqAXfiwklk2V174",
        "code": "var data = JSON.stringify({\"recordQueries\":[{\"settings\":{\"fields\":[\"id\",\"name\",\"salePrice\"],\"query\":{\"term\":\"short\"}},\"id\":\"productSearch\"}],\"context\":{\"apiKeys\":[\"klevu-156925593843210765\"]}});\n\nvar xhr = new XMLHttpRequest();\nxhr.withCredentials = false;\n\nxhr.addEventListener(\"readystatechange\", function() {\n  if(this.readyState === 4) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"POST\", \"https://eucs15v2.ksearchnet.com/cs/v2/search\");\nxhr.setRequestHeader(\"Content-Type\", \"application/json\");\n\nxhr.send(data);",
        "language": "javascript",
        "customLabel": ""
      },
      {
        "id": "nPW0NIJe-j5R9I5W4BGN0",
        "code": "OkHttpClient client = new OkHttpClient().newBuilder()\n  .build();\nMediaType mediaType = MediaType.parse(\"application/json\");\nRequestBody body = RequestBody.create(mediaType, \"{\\n  \\\"recordQueries\\\": [\\n    {\\n      \\\"settings\\\": {\\n        \\\"fields\\\": [\\n          \\\"id\\\",\\n          \\\"name\\\",\\n          \\\"salePrice\\\"\\n        ],\\n        \\\"query\\\": {\\n          \\\"term\\\": \\\"short\\\"\\n        }\\n      },\\n      \\\"id\\\": \\\"productSearch\\\"\\n    }\\n  ],\\n  \\\"context\\\": {\\n    \\\"apiKeys\\\": [\\n      \\\"klevu-156925593843210765\\\"\\n    ]\\n  }\\n}\");\nRequest request = new Request.Builder()\n  .url(\"https://eucs15v2.ksearchnet.com/cs/v2/search\")\n  .method(\"POST\", body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .build();\nResponse response = client.newCall(request).execute();",
        "language": "java",
        "customLabel": ""
      },
      {
        "id": "0Ih7nieKhHFMl7CRY51j_",
        "code": "var request = require('request');\nvar options = {\n  'method': 'POST',\n  'url': 'https://eucs15v2.ksearchnet.com/cs/v2/search',\n  'headers': {\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"recordQueries\":[{\"settings\":{\"fields\":[\"id\",\"name\",\"salePrice\"],\"query\":{\"term\":\"short\"}},\"id\":\"productSearch\"}],\"context\":{\"apiKeys\":[\"klevu-156925593843210765\"]}})\n\n};\nrequest(options, function (error, response) {\n  if (error) throw new Error(error);\n  console.log(response.body);\n});\n",
        "language": "nodejs",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "WCDgTsSqAXfiwklk2V174"
  },
  "description": "This is an example how to limit fields/attributes in search response. ",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "hasTryItOut": false,
  "autoGeneratedAnchorSlug": "fields-1",
  "legacyHash": "4Ikpba26FPvecDAjnnyZV"
}
```
:::

### Try it here!

:::Iframe{code="<iframe src=&#x22;https://codesandbox.io/embed/klevu-api-sendbox-4ktfrp?fontsize=14&hidenavigation=0&theme=dark&view=preview&initialpath=?payload=fields&#x22;&#xA;     style=&#x22;width:100%; height:550px; border:0; border-radius: 4px; overflow:hidden;&#x22;&#xA;     title=&#x22;klevu_api sendbox&#x22;&#xA;     allow=&#x22;accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking&#x22;&#xA;     sandbox=&#x22;allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts&#x22;&#xA;     &#xA;   ></iframe>" iframeHeight="550"}

:::

## Grouping

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.

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://{{hostname}}/cs/v2/search",
  "name": "Grouping Results",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "optional",
        "name": "groupBy",
        "type": "String",
        "description": "The key of the attribute to group by, for example 'name'. Currently the only supported values are id and name."
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "3XlvmT855lGkJOht0nPXg",
        "code": "{\n    \"meta\": {\n        \"qTime\": 19,\n        \"responseCode\": 200\n    },\n    \"queryResults\": [\n        {\n            \"id\": \"productSearch\",\n            \"meta\": {\n                \"qTime\": 17,\n                \"noOfResults\": 12,\n                \"totalResultsFound\": 1,\n                \"typeOfSearch\": \"WILDCARD_AND\",\n                \"offset\": 0,\n                \"debuggingInformation\": {},\n                \"notificationCode\": 1,\n                \"searchedTerm\": \"Adrienne Trek Jacket\",\n                \"apiKey\": \"klevu-156925593843210765\",\n                \"isPersonalised\": false\n            },\n            \"records\": [\n                {\n                    \"name\": \"Adrienne Trek Jacket\",\n                    \"id\": \"31366454378558\"\n                }\n            ],\n            \"filters\": []\n        }\n    ]\n}",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "3XlvmT855lGkJOht0nPXg"
  },
  "examples": {
    "languages": [
      {
        "id": "jSU7DlYyJ_eUh63YSP682",
        "code": "{\n  \"recordQueries\": [\n    {\n      \"settings\": {\n        \"groupBy\": \"name\",\n        \"query\": {\n          \"term\": \"Adrienne Trek Jacket\"\n        },\n        \"sort\": \"NAME_ASC\",\n        \"fields\": [\n          \"id\",\n          \"name\"\n        ]\n      },\n      \"id\": \"productSearch\"\n    }\n  ],\n  \"context\": {\n    \"apiKeys\": [\n      \"klevu-156925593843210765\"\n    ]\n  }\n}",
        "language": "json",
        "customLabel": "Request Body (JSON)"
      },
      {
        "id": "8Yg33Te4JzfoWp5yEbmJh",
        "code": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => 'https://eucs15v2.ksearchnet.com/cs/v2/search',\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  CURLOPT_POSTFIELDS =>'{\n  \"recordQueries\": [\n    {\n      \"settings\": {\n        \"groupBy\": \"name\",\n        \"query\": {\n          \"term\": \"Adrienne Trek Jacket\"\n        },\n        \"sort\": \"NAME_ASC\",\n        \"fields\": [\n          \"id\",\n          \"name\"\n        ]\n      },\n      \"id\": \"productSearch\"\n    }\n  ],\n  \"context\": {\n    \"apiKeys\": [\n      \"klevu-156925593843210765\"\n    ]\n  }\n}',\n  CURLOPT_HTTPHEADER => array(\n    'Content-Type: application/json'\n  ),\n));\n\n$response = curl_exec($curl);\n\ncurl_close($curl);\necho $response;\n",
        "language": "php",
        "customLabel": ""
      },
      {
        "id": "WCDgTsSqAXfiwklk2V174",
        "code": "var data = JSON.stringify({\"recordQueries\":[{\"settings\":{\"groupBy\":\"name\",\"query\":{\"term\":\"Adrienne Trek Jacket\"},\"sort\":\"NAME_ASC\",\"fields\":[\"id\",\"name\"]},\"id\":\"productSearch\"}],\"context\":{\"apiKeys\":[\"klevu-156925593843210765\"]}});\n\nvar xhr = new XMLHttpRequest();\nxhr.withCredentials = false;\n\nxhr.addEventListener(\"readystatechange\", function() {\n  if(this.readyState === 4) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"POST\", \"https://eucs15v2.ksearchnet.com/cs/v2/search\");\nxhr.setRequestHeader(\"Content-Type\", \"application/json\");\n\nxhr.send(data);",
        "language": "javascript",
        "customLabel": ""
      },
      {
        "id": "nPW0NIJe-j5R9I5W4BGN0",
        "code": "OkHttpClient client = new OkHttpClient().newBuilder()\n  .build();\nMediaType mediaType = MediaType.parse(\"application/json\");\nRequestBody body = RequestBody.create(mediaType, \"{\\n  \\\"recordQueries\\\": [\\n    {\\n      \\\"settings\\\": {\\n        \\\"groupBy\\\": \\\"name\\\",\\n        \\\"query\\\": {\\n          \\\"term\\\": \\\"Adrienne Trek Jacket\\\"\\n        },\\n        \\\"sort\\\": \\\"NAME_ASC\\\",\\n        \\\"fields\\\": [\\n          \\\"id\\\",\\n          \\\"name\\\"\\n        ]\\n      },\\n      \\\"id\\\": \\\"productSearch\\\"\\n    }\\n  ],\\n  \\\"context\\\": {\\n    \\\"apiKeys\\\": [\\n      \\\"klevu-156925593843210765\\\"\\n    ]\\n  }\\n}\");\nRequest request = new Request.Builder()\n  .url(\"https://eucs15v2.ksearchnet.com/cs/v2/search\")\n  .method(\"POST\", body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .build();\nResponse response = client.newCall(request).execute();",
        "language": "java",
        "customLabel": ""
      },
      {
        "id": "0Ih7nieKhHFMl7CRY51j_",
        "code": "var request = require('request');\nvar options = {\n  'method': 'POST',\n  'url': 'https://eucs15v2.ksearchnet.com/cs/v2/search',\n  'headers': {\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"recordQueries\":[{\"settings\":{\"groupBy\":\"name\",\"query\":{\"term\":\"Adrienne Trek Jacket\"},\"sort\":\"NAME_ASC\",\"fields\":[\"id\",\"name\"]},\"id\":\"productSearch\"}],\"context\":{\"apiKeys\":[\"klevu-156925593843210765\"]}})\n\n};\nrequest(options, function (error, response) {\n  if (error) throw new Error(error);\n  console.log(response.body);\n});\n",
        "language": "nodejs",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "WCDgTsSqAXfiwklk2V174"
  },
  "description": "This is an example how to group search results.",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "hasTryItOut": false,
  "autoGeneratedAnchorSlug": "grouping-results",
  "legacyHash": "TQ2sjLiscJsKR2KDAZyGr"
}
```
:::

### Try it here!&#x20;

:::Iframe{code="<iframe src=&#x22;https://codesandbox.io/embed/klevu-api-sendbox-4ktfrp?fontsize=14&hidenavigation=0&theme=dark&view=preview&initialpath=?payload=grouping&#x22;&#xA;     style=&#x22;width:100%; height:550px; border:0; border-radius: 4px; overflow:hidden;&#x22;&#xA;     title=&#x22;klevu_api sendbox&#x22;&#xA;     allow=&#x22;accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking&#x22;&#xA;     sandbox=&#x22;allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts&#x22;&#xA;     &#xA;   ></iframe>" iframeHeight="550"}

:::

## Type of search

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.

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://{{hostname}}/cs/v2/search",
  "name": "Type of search",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "optional",
        "name": "DEFAULT",
        "type": "String",
        "description": "When this value is specified, Klevu will go through a number of attempts to find matching records. The first type attempted is AND. If there aren't any results found, Klevu tries to find products with the FUZZY_AND query type.\n\nAs long as no matches are found, Klevu will continue to fire different query types in the following order:\n\nAND\nFUZZY_AND\nWILDCARD_AND\nFUZZY_WILDCARD_AND\nWILDCARD_OR\nFUZZY_OR\n\nNote that when a search term only contains a single word or more than six words, the 'OR' query types will be skipped.",
        "": "When this value is specified, Klevu will go through a number of attempts to find matching records. The first type attempted is AND. If there aren't any results found, Klevu tries to find products with the FUZZY_AND query type.\n\nAs long as no matches are found, Klevu will continue to fire different query types in the following order:\n\nAND\nFUZZY_AND\nWILDCARD_AND\nFUZZY_WILDCARD_AND\nWILDCARD_OR\nFUZZY_OR\n\nNote that when a search term only contains a single word or more than six words, the 'OR' query types will be skipped."
      },
      {
        "kind": "optional",
        "name": "AND",
        "type": "string",
        "description": "All of the exact words of a query must be found in a record for it to be included in the results. No fuzziness or wildcards are included.\n\nFor example, a search for \"hooded jacket\" will only return records that contain the exact terms \"hooded\" AND \"jacket\".",
        "": "All of the exact words of a query must be found in a record for it to be included in the results. No fuzziness or wildcards are included.\n\nFor example, a search for \"hooded jacket\" will only return records that contain the exact terms \"hooded\" AND \"jacket\"."
      },
      {
        "name": "FUZZY_AND",
        "kind": "optional",
        "type": "string",
        "description": "This is the same as a AND query, however a certain amount of 'fuzziness' is allowed to account for spelling mistakes.\n\nFor example, if the searched query contains spelling mistakes like \"hooder jakcet\", Klevu will still be able to match any records containing the words \"hooded\" AND \"jacket\".",
        "": "This is the same as a AND query, however a certain amount of 'fuzziness' is allowed to account for spelling mistakes.\n\nFor example, if the searched query contains spelling mistakes like \"hooder jakcet\", Klevu will still be able to match any records containing the words \"hooded\" AND \"jacket\"."
      },
      {
        "kind": "optional",
        "name": "WILDCARD_AND",
        "type": "string",
        "description": "This is an 'AND' query, so all words of the query must be found somewhere in a record for it to be included in the results. The last word of the query will have a wildcard suffix appended.\n\nFor example, if the searched query is \"hooded jacket\", this will become \"hooded jacket*\", i.e., Klevu will try to find records containing the word \"hooded\" AND any words beginning with \"jacket\".",
        "": "optional"
      },
      {
        "kind": "optional",
        "name": "FUZZY_WILDCARD_AND",
        "type": "string",
        "description": "This is the same as a WILDCARD_AND query, however a certain amount of 'fuzziness' is allowed to account for spelling mistakes.\n\nFor example, if the searched query contains spelling mistakes like \"hooder jakcet\", Klevu will still be able to match any records containing the words \"hooded\" AND \"jacket\".",
        "": "FUZZY_WILDCARD_AND"
      },
      {
        "kind": "optional",
        "name": "WILDCARD_OR",
        "type": "string",
        "description": "This is an 'OR' query so at least one of the words in the query must be found somewhere in a record for it to be included in the results. The last word of the query will have a wildcard suffix appended.\n\nFor example, if the searched query is \"hooded jacket\", this will become \"hooded jacket*\", ie. Klevu will try to find records containing the word \"hooded\" OR any words beginning with \"jacket\"."
      },
      {
        "kind": "optional",
        "name": "FUZZY_OR",
        "type": "string",
        "description": "This is the same as a WILDCARD_OR query, however a certain amount of 'fuzziness' is allowed to account for spelling mistakes.\n\nFor example, if the searched query contains spelling mistakes like \"hooder jakcet\", Klevu will still be able to match any records containing the words \"hooded\" OR \"jacket\"."
      },
      {
        "kind": "optional",
        "name": "OR",
        "type": "string",
        "description": "At least one exact word of a query must be found in a record for it to be included in a results. No fuzziness or wildcards are included.\n\nFor example a search for \"hooded jacket\" will only return records which contain one of the exact terms \"hooded\" OR \"jacket\"."
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "3XlvmT855lGkJOht0nPXg",
        "code": "{\n    \"meta\": {\n        \"qTime\": 17,\n        \"responseCode\": 200\n    },\n    \"queryResults\": [\n        {\n            \"id\": \"productSearch\",\n            \"meta\": {\n                \"qTime\": 16,\n                \"noOfResults\": 12,\n                \"totalResultsFound\": 190,\n                \"typeOfSearch\": \"FUZZY_OR\",\n                \"offset\": 0,\n                \"debuggingInformation\": {},\n                \"notificationCode\": 1,\n                \"searchedTerm\": \"short\",\n                \"apiKey\": \"klevu-156925593843210765\",\n                \"isPersonalised\": false\n            },\n            \"records\": [\n                {\n                    \"name\": \"Rapha Sports Short\",\n                    \"id\": \"31366464503870\"\n                },\n                {\n                    \"name\": \"Rapha Sports Short\",\n                    \"id\": \"31366464110654\"\n                },\n                {\n                    \"name\": \"Rapha Sports Short\",\n                    \"id\": \"31366464667710\"\n                },\n                {\n                    \"name\": \"Shorts\",\n                    \"id\": \"category_156703227966\"\n                },\n                {\n                    \"name\": \"Erika Running Short\",\n                    \"id\": \"31366431146046\"\n                },\n                {\n                    \"name\": \"Erika Running Short\",\n                    \"id\": \"31366431014974\"\n                },\n                {\n                    \"name\": \"Erika Running Short\",\n                    \"id\": \"31366431080510\"\n                },\n                {\n                    \"name\": \"Meteor Workout Short\",\n                    \"id\": \"31366465781822\"\n                },\n                {\n                    \"name\": \"Hawkeye Yoga Short\",\n                    \"id\": \"31366465126462\"\n                },\n                {\n                    \"name\": \"Hawkeye Yoga Short\",\n                    \"id\": \"31366465191998\"\n                },\n                {\n                    \"name\": \"Hawkeye Yoga Short\",\n                    \"id\": \"31366465060926\"\n                },\n                {\n                    \"name\": \"Bess Yoga Short\",\n                    \"id\": \"31366434226238\"\n                }\n            ],\n            \"filters\": []\n        }\n    ]\n}",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "3XlvmT855lGkJOht0nPXg"
  },
  "examples": {
    "languages": [
      {
        "id": "jSU7DlYyJ_eUh63YSP682",
        "code": "{\n  \"recordQueries\": [\n    {\n      \"settings\": {\n        \"typeOfSearch\": \"FUZZY_OR\",\n        \"query\": {\n          \"term\": \"short\"\n        },\n        \"fields\": [\n          \"id\",\n          \"name\"\n        ]\n      },\n      \"id\": \"productSearch\"\n    }\n  ],\n  \"context\": {\n    \"apiKeys\": [\n      \"klevu-156925593843210765\"\n    ]\n  }\n}",
        "language": "json",
        "customLabel": "Request Body (JSON)"
      },
      {
        "id": "8Yg33Te4JzfoWp5yEbmJh",
        "code": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => 'https://eucs15v2.ksearchnet.com/cs/v2/search',\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  CURLOPT_POSTFIELDS =>'{\n  \"recordQueries\": [\n    {\n      \"settings\": {\n        \"typeOfSearch\": \"FUZZY_OR\",\n        \"query\": {\n          \"term\": \"short\"\n        },\n        \"fields\": [\n          \"id\",\n          \"name\"\n        ]\n      },\n      \"id\": \"productSearch\"\n    }\n  ],\n  \"context\": {\n    \"apiKeys\": [\n      \"klevu-156925593843210765\"\n    ]\n  }\n}',\n  CURLOPT_HTTPHEADER => array(\n    'Content-Type: application/json'\n  ),\n));\n\n$response = curl_exec($curl);\n\ncurl_close($curl);\necho $response;\n",
        "language": "php",
        "customLabel": ""
      },
      {
        "id": "WCDgTsSqAXfiwklk2V174",
        "code": "var data = JSON.stringify({\"recordQueries\":[{\"settings\":{\"typeOfSearch\":\"FUZZY_OR\",\"query\":{\"term\":\"short\"},\"fields\":[\"id\",\"name\"]},\"id\":\"productSearch\"}],\"context\":{\"apiKeys\":[\"klevu-156925593843210765\"]}});\n\nvar xhr = new XMLHttpRequest();\nxhr.withCredentials = false;\n\nxhr.addEventListener(\"readystatechange\", function() {\n  if(this.readyState === 4) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"POST\", \"https://eucs15v2.ksearchnet.com/cs/v2/search\");\nxhr.setRequestHeader(\"Content-Type\", \"application/json\");\n\nxhr.send(data);",
        "language": "javascript",
        "customLabel": ""
      },
      {
        "id": "nPW0NIJe-j5R9I5W4BGN0",
        "code": "OkHttpClient client = new OkHttpClient().newBuilder()\n  .build();\nMediaType mediaType = MediaType.parse(\"application/json\");\nRequestBody body = RequestBody.create(mediaType, \"{\\n  \\\"recordQueries\\\": [\\n    {\\n      \\\"settings\\\": {\\n        \\\"typeOfSearch\\\": \\\"FUZZY_OR\\\",\\n        \\\"query\\\": {\\n          \\\"term\\\": \\\"short\\\"\\n        },\\n        \\\"fields\\\": [\\n          \\\"id\\\",\\n          \\\"name\\\"\\n        ]\\n      },\\n      \\\"id\\\": \\\"productSearch\\\"\\n    }\\n  ],\\n  \\\"context\\\": {\\n    \\\"apiKeys\\\": [\\n      \\\"klevu-156925593843210765\\\"\\n    ]\\n  }\\n}\");\nRequest request = new Request.Builder()\n  .url(\"https://eucs15v2.ksearchnet.com/cs/v2/search\")\n  .method(\"POST\", body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .build();\nResponse response = client.newCall(request).execute();",
        "language": "java",
        "customLabel": ""
      },
      {
        "id": "0Ih7nieKhHFMl7CRY51j_",
        "code": "var request = require('request');\nvar options = {\n  'method': 'POST',\n  'url': 'https://eucs15v2.ksearchnet.com/cs/v2/search',\n  'headers': {\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"recordQueries\":[{\"settings\":{\"typeOfSearch\":\"FUZZY_OR\",\"query\":{\"term\":\"short\"},\"fields\":[\"id\",\"name\"]},\"id\":\"productSearch\"}],\"context\":{\"apiKeys\":[\"klevu-156925593843210765\"]}})\n\n};\nrequest(options, function (error, response) {\n  if (error) throw new Error(error);\n  console.log(response.body);\n});\n",
        "language": "nodejs",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "WCDgTsSqAXfiwklk2V174"
  },
  "description": "This is an example how to change type of search results.",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "hasTryItOut": false,
  "autoGeneratedAnchorSlug": "type-of-search-1",
  "legacyHash": "AFKlUX4AbBKCZLN7QCBp8"
}
```
:::

### Try it here!

:::Iframe{code="<iframe src=&#x22;https://codesandbox.io/embed/klevu-api-sendbox-4ktfrp?fontsize=14&hidenavigation=0&theme=dark&view=preview&initialpath=?payload=typeOfSearch&#x22;&#xA;     style=&#x22;width:100%; height:550px; border:0; border-radius: 4px; overflow:hidden;&#x22;&#xA;     title=&#x22;klevu_api sendbox&#x22;&#xA;     allow=&#x22;accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking&#x22;&#xA;     sandbox=&#x22;allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts&#x22;&#xA;     &#xA;   ></iframe>" iframeHeight="550"}

:::

## Preferences

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.

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://{{hostname}}/cs/v2/search",
  "name": "Search preferences",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "optional",
        "name": "showOutOfStockProducts",
        "type": "String",
        "description": "Whether or not your store should include 'Out of Stock' products in search results by default can be configured within the Klevu Merchant Centre. However, if you would like to override this for a particular query, please include one of these flags."
      },
      {
        "kind": "optional",
        "name": "hideOutOfStockProducts",
        "type": "string",
        "description": "Flag to hide out-of-stock products.\n\n"
      },
      {
        "kind": "optional",
        "name": "disableStockSorting",
        "type": "string",
        "description": "This can be used in conjunction with showOutOfStockProducts. If your store is configured to display out of stock products, they will be displayed at the very end of the search results after all in stock products have been displayed. By using this flag you can disable this logic, and cause all products to be ranked in an order that disregards their stock status."
      },
      {
        "kind": "optional",
        "name": "includeStopwords",
        "type": "string",
        "description": "By default, functional words such as prepositions, pronouns, articles, etc. are excluded from searches. Add this flag to include these stopwords in your search."
      },
      {
        "kind": "optional",
        "name": "excludeIds",
        "type": "string",
        "description": "Use this flag to disable the searching of record IDs."
      },
      {
        "kind": "optional",
        "name": "includeDescription",
        "type": "string",
        "description": "Whether or not a record's 'description' is considered for search results can be configured by Klevu Support on a store-by-store basis, however if you would like to override this for a particular query, please include one of these flags."
      },
      {
        "kind": "optional",
        "name": "excludeDescription",
        "type": "string",
        "description": "Use this flag to exclude search in the description."
      },
      {
        "kind": "optional",
        "name": "disableFuzzyMatch",
        "type": "string",
        "description": "This flag can be used in conjunction with the typeOfSearch 'DEFAULT' to disable the FUZZY_AND and FUZZY_OR search types from being attempted."
      },
      {
        "kind": "optional",
        "name": "disableWildcard",
        "type": "string",
        "description": "This flag can be used in conjunction with the typeOfSearch 'DEFAULT' to disable the WILDCARD_AND and WILDCARD_OR search types from being attempted."
      },
      {
        "kind": "optional",
        "name": "disableORSearch",
        "type": "string",
        "description": "This flag can be used in conjunction with the typeOfSearch 'DEFAULT' to disable the WILDCARD_OR and FUZZY_OR search types from being attempted."
      },
      {
        "kind": "optional",
        "name": "partialMatch",
        "type": "string",
        "description": "Enable partial match for the last word of a query, where the last word searched can be a substring of any other word found in a record. This can be useful for non-English languages.\n\nFor example let's say a product has the name \"rödvinsglas\" (red wine glass). If searching for \"högt glas\" (tall glass) it may not match since the record has no words starting with 'glas'. By providing this flag, the search would become \"högt *glas*\" meaning it would match the record since it contains a word which ends with 'glas'."
      },
      {
        "kind": "optional",
        "name": "partialMatchForAllWords",
        "type": "string",
        "description": "Similar to partialMatch, but for all words rather than just the last. In the same \"rödvinsglas\" example, a search for \"högt glas\" would become \"*högt* *glas*\", so any records containing words containing 'högt' or 'glas' would result in a match."
      },
      {
        "kind": "optional",
        "name": "disableWordShingles",
        "type": "string",
        "description": "For a query longer than one word, all the possible bigrams and trigrams (i.e. formed out of query terms) are looked up in records and the ones having one or more of them are boosted higher up in the search results. You can use this flag to disable such boosting."
      },
      {
        "kind": "optional",
        "name": "searchCompoundsAsAndQuery",
        "type": "string",
        "description": "When a compound word is searched for, i.e. two or more individual words joined together as one word, Klevu automatically disjoints them if the de-compounding feature is enabled for your store.\n\nFor example, a search for \"fairylights\" would be treated as \"fairy lights\", but with the added condition that those words must appear within 5 words of each other in a matching record.\n\nIf you would prefer that the words \"fairy\" and \"light\" could be found anywhere within the record, not necessarily near one another, then please include this flag."
      },
      {
        "kind": "optional",
        "name": "enableBoostingOriginalTermsInSynonyms",
        "type": "string",
        "description": "By default, synonyms are treated equally to their query term. Should you wish to give higher priority to the actual terms your customer entered in the query over their synonyms, please include this flag in your search preferences."
      },
      {
        "kind": "optional",
        "name": "showDisabledFacets",
        "type": "string",
        "description": "It is possible to configure which facets or filters should be enabled or disabled within the Klevu Merchant Centre. By including this flag, all facets will be returned regardless of whether they have been disabled in the KMC."
      },
      {
        "kind": "optional",
        "name": "showFiltersWithSmallCount",
        "type": "string",
        "description": "By default some filters are excluded from the results if they only have a small number of results. Please use this flag to override this logic and include all filters in the response."
      },
      {
        "kind": "optional",
        "name": "includeCategoryFilterInCatNav",
        "type": "string",
        "description": "When the typeOfRequest is 'CATNAV', the filter for 'Category' is automatically excluded since you are already within the context of a category. Use this flag to override this logic and return the category filters even for CatNav requests."
      },
      {
        "kind": "optional",
        "name": "enableScores",
        "type": "string",
        "description": "include the score information with the response fields: klevu_product_boosting and klevu_manual_boosting."
      },
      {
        "kind": "optional",
        "name": "disableGrouping",
        "type": "string",
        "description": "By default, Klevu groups results by itemGroupId. Use this flag to disable the grouping of products.\n"
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "3XlvmT855lGkJOht0nPXg",
        "code": "{\n   meta: {\n      qTime: 29,\n      responseCode: 200\n   },\n   queryResults: [\n      {\n         id: \"productSearch\",\n         meta: {\n            qTime: 26,\n            noOfResults: 12,\n            totalResultsFound: 108,\n            typeOfSearch: \"WILDCARD_AND\",\n            offset: 0,\n            debuggingInformation: {},\n            notificationCode: 1,\n            searchedTerm: \"short\",\n            apiKey: \"klevu-156925593843210765\",\n            isPersonalised: false\n         },\n         records: [\n            {\n               discount: \"\",\n               hideGroupPrices: \"\",\n               type: \"Shorts\",\n               itemGroupId: \"4384016203838\",\n               score: \"1.7803618\",\n               freeShipping: \"\",\n               storeBaseCurrency: \"GBP\",\n               price: \"45.00\",\n               toPrice: \"\",\n               imageUrl: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/wsh12-red_main_9999e03f-694d-4f0c-83ab-8c0200029275_medium.jpg?v=1575477719\",\n               currency: \"GBP\",\n               inStock: \"yes\",\n               id: \"31366431014974\",\n               imageHover: \"\",\n               sku: \"WSH12-28-Red\",\n               brand: \"KSD\",\n               basePrice: \"45.0\",\n               startPrice: \"\",\n               image: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/wsh12-red_main_9999e03f-694d-4f0c-83ab-8c0200029275_medium.jpg?v=1575477719\",\n               deliveryInfo: \"\",\n               hideAddToCart: \"\",\n               salePrice: \"45.0\",\n               klevu_product_boosting: \"1.2\",\n               swatchesInfo: \"\",\n               weight: \"\",\n               klevu_category: \"KLEVU_PRODUCT;Products;;Shorts  @ku@kuCategory@ku@\",\n               totalVariants: 0,\n               groupPrices: \"\",\n               url: \"https://jsv2-shopify-demo.ksearchmisc.com/products/erika-running-short-red\",\n               tags: \"body-hugging, nylon, Red, Running, Short\",\n               size: \"Medium\",\n               name: \"Erika Running Short\",\n               shortDesc: \"A great short with a body-hugging design, the Erika Running Short is perfect for runners who prefer a fitted short rather than the traditional baggy variety. • Seafoam pattern running shorts. • Elastic waistband. • Snug fit. • 4''\",\n               klevu_manual_boosting: \"1.0\",\n               category: \"Shorts\"\n            },\n            {\n               discount: \"\",\n               hideGroupPrices: \"\",\n               type: \"Shorts\",\n               itemGroupId: \"4384016269374\",\n               score: \"1.7803618\",\n               freeShipping: \"\",\n               storeBaseCurrency: \"GBP\",\n               price: \"45.00\",\n               toPrice: \"\",\n               imageUrl: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/wsh12-purple_main_c57ce41e-7b0e-4cd2-a0de-18ddb6d2017a_medium.jpg?v=1575477720\",\n               currency: \"GBP\",\n               inStock: \"yes\",\n               id: \"31366431080510\",\n               imageHover: \"\",\n               sku: \"WSH12-28-Purple\",\n               brand: \"KSD\",\n               basePrice: \"45.0\",\n               startPrice: \"\",\n               image: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/wsh12-purple_main_c57ce41e-7b0e-4cd2-a0de-18ddb6d2017a_medium.jpg?v=1575477720\",\n               deliveryInfo: \"\",\n               hideAddToCart: \"\",\n               salePrice: \"45.0\",\n               klevu_product_boosting: \"1.2\",\n               swatchesInfo: \"\",\n               weight: \"\",\n               klevu_category: \"KLEVU_PRODUCT;Products;;Shorts  @ku@kuCategory@ku@\",\n               totalVariants: 0,\n               groupPrices: \"\",\n               url: \"https://jsv2-shopify-demo.ksearchmisc.com/products/erika-running-short-purple\",\n               tags: \"body-hugging, nylon, Red, Running, Short\",\n               size: \"Large\",\n               name: \"Erika Running Short\",\n               shortDesc: \"A great short with a body-hugging design, the Erika Running Short is perfect for runners who prefer a fitted short rather than the traditional baggy variety. • Seafoam pattern running shorts. • Elastic waistband. • Snug fit. • 4''\",\n               klevu_manual_boosting: \"1.0\",\n               category: \"Shorts\"\n            },\n            {\n               discount: \"\",\n               hideGroupPrices: \"\",\n               type: \"Shorts\",\n               itemGroupId: \"4384016334910\",\n               score: \"1.7803618\",\n               freeShipping: \"\",\n               storeBaseCurrency: \"GBP\",\n               price: \"45.00\",\n               toPrice: \"\",\n               imageUrl: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/wsh12-green_main_3ac6ebe5-2c3e-45cf-91cf-ec54de5e5e3a_medium.jpg?v=1575477721\",\n               currency: \"GBP\",\n               inStock: \"yes\",\n               id: \"31366431146046\",\n               imageHover: \"\",\n               sku: \"WSH12-28-Green\",\n               brand: \"KSD\",\n               basePrice: \"45.0\",\n               startPrice: \"\",\n               image: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/wsh12-green_main_3ac6ebe5-2c3e-45cf-91cf-ec54de5e5e3a_medium.jpg?v=1575477721\",\n               deliveryInfo: \"\",\n               hideAddToCart: \"\",\n               salePrice: \"45.0\",\n               klevu_product_boosting: \"1.2\",\n               swatchesInfo: \"\",\n               weight: \"\",\n               klevu_category: \"KLEVU_PRODUCT;Products;;Shorts  @ku@kuCategory@ku@\",\n               totalVariants: 0,\n               groupPrices: \"\",\n               url: \"https://jsv2-shopify-demo.ksearchmisc.com/products/erika-running-short-green\",\n               tags: \"body-hugging, Green, nylon, Running, Short\",\n               size: \"Small\",\n               name: \"Erika Running Short\",\n               shortDesc: \"A great short with a body-hugging design, the Erika Running Short is perfect for runners who prefer a fitted short rather than the traditional baggy variety. • Seafoam pattern running shorts. • Elastic waistband. • Snug fit. • 4''\",\n               klevu_manual_boosting: \"1.0\",\n               category: \"Shorts\"\n            },\n            {\n               discount: \"\",\n               hideGroupPrices: \"\",\n               type: \"Shorts\",\n               itemGroupId: \"4384040386622\",\n               score: \"1.513042\",\n               freeShipping: \"\",\n               storeBaseCurrency: \"GBP\",\n               price: \"32.50\",\n               toPrice: \"\",\n               imageUrl: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh03-black_main_a8796b84-9c70-4146-9c73-2295b0d260a7_medium.jpg?v=1575478122\",\n               currency: \"GBP\",\n               inStock: \"yes\",\n               id: \"31366465781822\",\n               imageHover: \"\",\n               sku: \"MSH03-32-Black\",\n               brand: \"KKE\",\n               basePrice: \"32.5\",\n               startPrice: \"\",\n               image: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh03-black_main_a8796b84-9c70-4146-9c73-2295b0d260a7_medium.jpg?v=1575478122\",\n               deliveryInfo: \"\",\n               hideAddToCart: \"\",\n               salePrice: \"32.5\",\n               klevu_product_boosting: \"1.02\",\n               swatchesInfo: \"\",\n               weight: \"\",\n               klevu_category: \"KLEVU_PRODUCT;Products;;Shorts  @ku@kuCategory@ku@\",\n               totalVariants: 0,\n               groupPrices: \"\",\n               url: \"https://jsv2-shopify-demo.ksearchmisc.com/products/meteor-workout-short-black\",\n               tags: \"black, Machine, Nylon, Relaxed fit, Short, Summer\",\n               size: \"Small\",\n               name: \"Meteor Workout Short\",\n               shortDesc: \"Step into the Meteor Workout Short for an incredibly lightweight fitness experience. Its breathable construction and an inner brief provide additional comfort and support, while the adjustable waistband offers the perfect fit to take you to the fi\",\n               klevu_manual_boosting: \"1.0\",\n               category: \"Shorts\"\n            },\n            {\n               discount: \"\",\n               hideGroupPrices: \"\",\n               type: \"Shorts\",\n               itemGroupId: \"4384039796798\",\n               score: \"1.4835187\",\n               freeShipping: \"\",\n               storeBaseCurrency: \"GBP\",\n               price: \"29.00\",\n               toPrice: \"\",\n               imageUrl: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh05-black_main_f61ee526-b9d3-4eaa-b7b2-80dc400f31b0_medium.jpg?v=1575478115\",\n               currency: \"GBP\",\n               inStock: \"yes\",\n               id: \"31366465191998\",\n               imageHover: \"\",\n               sku: \"MSH05-32-Black\",\n               brand: \"KKE\",\n               basePrice: \"29.0\",\n               startPrice: \"\",\n               image: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh05-black_main_f61ee526-b9d3-4eaa-b7b2-80dc400f31b0_medium.jpg?v=1575478115\",\n               deliveryInfo: \"\",\n               hideAddToCart: \"\",\n               salePrice: \"29.0\",\n               klevu_product_boosting: \"1.0\",\n               swatchesInfo: \"\",\n               weight: \"\",\n               klevu_category: \"KLEVU_PRODUCT;Products;;Shorts  @ku@kuCategory@ku@\",\n               totalVariants: 0,\n               groupPrices: \"\",\n               url: \"https://jsv2-shopify-demo.ksearchmisc.com/products/hawkeye-yoga-short-black\",\n               tags: \"Black, Machine, motion-friendly, Nylon, Relaxed fit, Smooth, Summer, yoga-short\",\n               size: \"Small\",\n               name: \"Hawkeye Yoga Short\",\n               shortDesc: \"What more do you need than a sporty yoga short made with organic cotton and a little spandex for mobility? The Hawkeye Yoga Short brings a stylish, standard fit you can sport with confidence outside the studio. • Dark gray shorts with red a\",\n               klevu_manual_boosting: \"1.0\",\n               category: \"Shorts\"\n            },\n            {\n               discount: \"\",\n               hideGroupPrices: \"\",\n               type: \"Shorts\",\n               itemGroupId: \"4384039665726\",\n               score: \"1.4835187\",\n               freeShipping: \"\",\n               storeBaseCurrency: \"GBP\",\n               price: \"29.00\",\n               toPrice: \"\",\n               imageUrl: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh05-gray_main_0f869cff-09fb-403a-a209-cf092f4d3c1a_medium.jpg?v=1575478112\",\n               currency: \"GBP\",\n               inStock: \"yes\",\n               id: \"31366465060926\",\n               imageHover: \"\",\n               sku: \"MSH05-32-Gray\",\n               brand: \"KSD\",\n               basePrice: \"29.0\",\n               startPrice: \"\",\n               image: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh05-gray_main_0f869cff-09fb-403a-a209-cf092f4d3c1a_medium.jpg?v=1575478112\",\n               deliveryInfo: \"\",\n               hideAddToCart: \"\",\n               salePrice: \"29.0\",\n               klevu_product_boosting: \"1.0\",\n               swatchesInfo: \"\",\n               weight: \"\",\n               klevu_category: \"KLEVU_PRODUCT;Products;;Shorts  @ku@kuCategory@ku@\",\n               totalVariants: 0,\n               groupPrices: \"\",\n               url: \"https://jsv2-shopify-demo.ksearchmisc.com/products/hawkeye-yoga-short-gray\",\n               tags: \"Gray, Machine, Nylon, Relaxed fit, Short, Summer\",\n               size: \"Medium\",\n               name: \"Hawkeye Yoga Short\",\n               shortDesc: \"What more do you need than a sporty yoga short made with organic cotton and a little spandex for mobility? The Hawkeye Yoga Short brings a stylish, standard fit you can sport with confidence outside the studio. • Dark gray shorts with red a\",\n               klevu_manual_boosting: \"1.0\",\n               category: \"Shorts\"\n            },\n            {\n               discount: \"\",\n               hideGroupPrices: \"\",\n               type: \"Shorts\",\n               itemGroupId: \"4384039731262\",\n               score: \"1.4835187\",\n               freeShipping: \"\",\n               storeBaseCurrency: \"GBP\",\n               price: \"29.00\",\n               toPrice: \"\",\n               imageUrl: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh05-blue_main_2130114d-06b0-4793-8fc2-bf77411297e4_medium.jpg?v=1575478114\",\n               currency: \"GBP\",\n               inStock: \"yes\",\n               id: \"31366465126462\",\n               imageHover: \"\",\n               sku: \"MSH05-32-Blue\",\n               brand: \"MNH\",\n               basePrice: \"29.0\",\n               startPrice: \"\",\n               image: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh05-blue_main_2130114d-06b0-4793-8fc2-bf77411297e4_medium.jpg?v=1575478114\",\n               deliveryInfo: \"\",\n               hideAddToCart: \"\",\n               salePrice: \"29.0\",\n               klevu_product_boosting: \"1.0\",\n               swatchesInfo: \"\",\n               weight: \"\",\n               klevu_category: \"KLEVU_PRODUCT;Products;;Shorts  @ku@kuCategory@ku@\",\n               totalVariants: 0,\n               groupPrices: \"\",\n               url: \"https://jsv2-shopify-demo.ksearchmisc.com/products/hawkeye-yoga-short-blue\",\n               tags: \"Blue, Machine, Nylon, Relaxed fit, Short, Summer\",\n               size: \"Large\",\n               name: \"Hawkeye Yoga Short\",\n               shortDesc: \"What more do you need than a sporty yoga short made with organic cotton and a little spandex for mobility? The Hawkeye Yoga Short brings a stylish, standard fit you can sport with confidence outside the studio. • Dark gray shorts with red a\",\n               klevu_manual_boosting: \"1.0\",\n               category: \"Shorts\"\n            },\n            {\n               discount: \"\",\n               hideGroupPrices: \"\",\n               type: \"Shorts\",\n               itemGroupId: \"4384037765182\",\n               score: \"1.4835187\",\n               freeShipping: \"\",\n               storeBaseCurrency: \"GBP\",\n               price: \"27.00\",\n               toPrice: \"\",\n               imageUrl: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh12-gray_main_4bb28c53-a928-47a0-92ea-ecd303f97dba_medium.jpg?v=1575478089\",\n               currency: \"GBP\",\n               inStock: \"yes\",\n               id: \"31366462439486\",\n               imageHover: \"\",\n               sku: \"MSH12-32-Gray\",\n               brand: \"MNH\",\n               basePrice: \"27.0\",\n               startPrice: \"\",\n               image: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh12-gray_main_4bb28c53-a928-47a0-92ea-ecd303f97dba_medium.jpg?v=1575478089\",\n               deliveryInfo: \"\",\n               hideAddToCart: \"\",\n               salePrice: \"27.0\",\n               klevu_product_boosting: \"1.0\",\n               swatchesInfo: \"\",\n               weight: \"\",\n               klevu_category: \"KLEVU_PRODUCT;Products;;Shorts  @ku@kuCategory@ku@\",\n               totalVariants: 0,\n               groupPrices: \"\",\n               url: \"https://jsv2-shopify-demo.ksearchmisc.com/products/pierce-gym-short-gray\",\n               tags: \"Gray, Machine, Nylon, Relaxed fit, Short, Summer\",\n               size: \"Large\",\n               name: \"Pierce Gym Short\",\n               shortDesc: \"The Pierce Gym Short is similar to our Arcadio Gym Short, but designed with a fitted, tapered look. A flat waistband with an adjustable drawstring adds comfort, with zippered pockets for safe, easy storage. • Dark red cotton shorts. • 8\",\n               klevu_manual_boosting: \"1.0\",\n               category: \"Shorts\"\n            },\n            {\n               discount: \"\",\n               hideGroupPrices: \"\",\n               type: \"Shorts\",\n               itemGroupId: \"4384037830718\",\n               score: \"1.4835187\",\n               freeShipping: \"\",\n               storeBaseCurrency: \"GBP\",\n               price: \"27.00\",\n               toPrice: \"\",\n               imageUrl: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh12-black_main_2ef78733-04a5-4345-9f5f-992d0cfffe8d_medium.jpg?v=1575478090\",\n               currency: \"GBP\",\n               inStock: \"yes\",\n               id: \"31366462472254\",\n               imageHover: \"\",\n               sku: \"MSH12-32-Black\",\n               brand: \"KKE\",\n               basePrice: \"27.0\",\n               startPrice: \"\",\n               image: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh12-black_main_2ef78733-04a5-4345-9f5f-992d0cfffe8d_medium.jpg?v=1575478090\",\n               deliveryInfo: \"\",\n               hideAddToCart: \"\",\n               salePrice: \"27.0\",\n               klevu_product_boosting: \"1.0\",\n               swatchesInfo: \"\",\n               weight: \"\",\n               klevu_category: \"KLEVU_PRODUCT;Products;;Shorts  @ku@kuCategory@ku@\",\n               totalVariants: 0,\n               groupPrices: \"\",\n               url: \"https://jsv2-shopify-demo.ksearchmisc.com/products/pierce-gym-short-black\",\n               tags: \"Black, Machine, Nylon, Relaxed fit, Short, Summer\",\n               size: \"Small\",\n               name: \"Pierce Gym Short\",\n               shortDesc: \"The Pierce Gym Short is similar to our Arcadio Gym Short, but designed with a fitted, tapered look. A flat waistband with an adjustable drawstring adds comfort, with zippered pockets for safe, easy storage. • Dark red cotton shorts. • 8\",\n               klevu_manual_boosting: \"1.0\",\n               category: \"Shorts\"\n            },\n            {\n               discount: \"\",\n               hideGroupPrices: \"\",\n               type: \"Shorts\",\n               itemGroupId: \"4384037699646\",\n               score: \"1.4835186\",\n               freeShipping: \"\",\n               storeBaseCurrency: \"GBP\",\n               price: \"27.00\",\n               toPrice: \"\",\n               imageUrl: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh12-red_main_6c29f610-d5f7-4e1a-bde4-1fb148964be5_medium.jpg?v=1575478088\",\n               currency: \"GBP\",\n               inStock: \"yes\",\n               id: \"31366462373950\",\n               imageHover: \"\",\n               sku: \"MSH12-32-Red\",\n               brand: \"KSD\",\n               basePrice: \"27.0\",\n               startPrice: \"\",\n               image: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh12-red_main_6c29f610-d5f7-4e1a-bde4-1fb148964be5_medium.jpg?v=1575478088\",\n               deliveryInfo: \"\",\n               hideAddToCart: \"\",\n               salePrice: \"27.0\",\n               klevu_product_boosting: \"1.0\",\n               swatchesInfo: \"\",\n               weight: \"\",\n               klevu_category: \"KLEVU_PRODUCT;Products;;Shorts  @ku@kuCategory@ku@\",\n               totalVariants: 0,\n               groupPrices: \"\",\n               url: \"https://jsv2-shopify-demo.ksearchmisc.com/products/pierce-gym-short-red\",\n               tags: \"Cotton, Machine, Relaxed fit, Res, Short, Summer\",\n               size: \"Medium\",\n               name: \"Pierce Gym Short\",\n               shortDesc: \"The Pierce Gym Short is similar to our Arcadio Gym Short, but designed with a fitted, tapered look. A flat waistband with an adjustable drawstring adds comfort, with zippered pockets for safe, easy storage. • Dark red cotton shorts. • 8\",\n               klevu_manual_boosting: \"1.0\",\n               category: \"Shorts\"\n            },\n            {\n               discount: \"\",\n               hideGroupPrices: \"\",\n               type: \"Shorts\",\n               itemGroupId: \"4384038256702\",\n               score: \"1.4835119\",\n               freeShipping: \"\",\n               storeBaseCurrency: \"GBP\",\n               price: \"32.00\",\n               toPrice: \"\",\n               imageUrl: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh10-green_main_18d664f2-5ba2-421d-b89a-87cb73d86416_medium.jpg?v=1575478095\",\n               currency: \"GBP\",\n               inStock: \"yes\",\n               id: \"31366463029310\",\n               imageHover: \"\",\n               sku: \"MSH10-32-Green\",\n               brand: \"MNH\",\n               basePrice: \"32.0\",\n               startPrice: \"\",\n               image: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh10-green_main_18d664f2-5ba2-421d-b89a-87cb73d86416_medium.jpg?v=1575478095\",\n               deliveryInfo: \"\",\n               hideAddToCart: \"\",\n               salePrice: \"32.0\",\n               klevu_product_boosting: \"1.0\",\n               swatchesInfo: \"\",\n               weight: \"\",\n               klevu_category: \"KLEVU_PRODUCT;Products;;Shorts  @ku@kuCategory@ku@\",\n               totalVariants: 0,\n               groupPrices: \"\",\n               url: \"https://jsv2-shopify-demo.ksearchmisc.com/products/sol-active-short-green\",\n               tags: \"Green, Machine, Nylon, Relaxed fit, Short, Summer\",\n               size: \"Large\",\n               name: \"Sol Active Short\",\n               shortDesc: \"You'll let your fear go and push your limits in your new Sol Active Short. Featuring ultra-breathable performance fabric and a flat comfort-fit waistband, the Sol Active Short is perfect for high-intensity circuits or high-heat bikram. • Li\",\n               klevu_manual_boosting: \"1.0\",\n               category: \"Shorts\"\n            },\n            {\n               discount: \"\",\n               hideGroupPrices: \"\",\n               type: \"Shorts\",\n               itemGroupId: \"4384038158398\",\n               score: \"1.4835119\",\n               freeShipping: \"\",\n               storeBaseCurrency: \"GBP\",\n               price: \"32.00\",\n               toPrice: \"\",\n               imageUrl: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh10-purple_main_1e2fd886-6ce1-4258-8fe5-6ca863ab5f9e_medium.jpg?v=1575478094\",\n               currency: \"GBP\",\n               inStock: \"yes\",\n               id: \"31366462931006\",\n               imageHover: \"\",\n               sku: \"MSH10-32-Purple\",\n               brand: \"KSD\",\n               basePrice: \"32.0\",\n               startPrice: \"\",\n               image: \"https://cdn.shopify.com/s/files/1/0116/9457/1582/products/msh10-purple_main_1e2fd886-6ce1-4258-8fe5-6ca863ab5f9e_medium.jpg?v=1575478094\",\n               deliveryInfo: \"\",\n               hideAddToCart: \"\",\n               salePrice: \"32.0\",\n               klevu_product_boosting: \"1.0\",\n               swatchesInfo: \"\",\n               weight: \"\",\n               klevu_category: \"KLEVU_PRODUCT;Products;;Shorts  @ku@kuCategory@ku@\",\n               totalVariants: 0,\n               groupPrices: \"\",\n               url: \"https://jsv2-shopify-demo.ksearchmisc.com/products/sol-active-short-purple\",\n               tags: \"Black, Machine, Nylon, Relaxed fit, Short, Summer\",\n               size: \"Medium\",\n               name: \"Sol Active Short\",\n               shortDesc: \"You'll let your fear go and push your limits in your new Sol Active Short. Featuring ultra-breathable performance fabric and a flat comfort-fit waistband, the Sol Active Short is perfect for high-intensity circuits or high-heat bikram. • Li\",\n               klevu_manual_boosting: \"1.0\",\n               category: \"Shorts\"\n            }\n         ],\n         filters: []\n      }\n   ]\n}",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "3XlvmT855lGkJOht0nPXg"
  },
  "examples": {
    "languages": [
      {
        "id": "jSU7DlYyJ_eUh63YSP682",
        "code": "{\n  \"recordQueries\": [\n    {\n      \"settings\": {\n        \"searchPrefs\": [\n          \"showOutOfStockProducts\",\n          \"disableStockSorting\",\n          \"includeStopwords\",\n          \"excludeIds\",\n          \"includeDescription\",\n          \"disableFuzzyMatch\",\n          \"disableWildcard\",\n          \"disableORSearch\",\n          \"partialMatch\",\n          \"partialMatchForAllWords\",\n          \"disableWordShingles\",\n          \"searchCompoundsAsAndQuery\",\n          \"enableBoostingOriginalTermsInSynonyms\",\n          \"showDisabledFacets\",\n          \"showFiltersWithSmallCount\",\n          \"includeCategoryFilterInCatNav\",\n          \"enableScores\",\n          \"disableGrouping\"\n        ],\n        \"query\": {\n          \"term\": \"short\"\n        }\n      },\n      \"id\": \"productSearch\"\n    }\n  ],\n  \"context\": {\n    \"apiKeys\": [\n      \"klevu-156925593843210765\"\n    ]\n  }\n}",
        "language": "json",
        "customLabel": "Request Body (JSON)"
      },
      {
        "id": "8Yg33Te4JzfoWp5yEbmJh",
        "code": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => 'https://eucs15v2.ksearchnet.com/cs/v2/search',\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  CURLOPT_POSTFIELDS =>'{\n  \"recordQueries\": [\n    {\n      \"settings\": {\n        \"searchPrefs\": [\n          \"showOutOfStockProducts\",\n          \"disableStockSorting\",\n          \"includeStopwords\",\n          \"excludeIds\",\n          \"includeDescription\",\n          \"disableFuzzyMatch\",\n          \"disableWildcard\",\n          \"disableORSearch\",\n          \"partialMatch\",\n          \"partialMatchForAllWords\",\n          \"disableWordShingles\",\n          \"searchCompoundsAsAndQuery\",\n          \"enableBoostingOriginalTermsInSynonyms\",\n          \"showDisabledFacets\",\n          \"showFiltersWithSmallCount\",\n          \"includeCategoryFilterInCatNav\",\n          \"enableScores\",\n          \"debugQuery\",\n          \"disableGrouping\"\n        ],\n        \"query\": {\n          \"term\": \"short\"\n        }\n      },\n      \"id\": \"productSearch\"\n    }\n  ],\n  \"context\": {\n    \"apiKeys\": [\n      \"klevu-156925593843210765\"\n    ]\n  }\n}',\n  CURLOPT_HTTPHEADER => array(\n    'Content-Type: application/json'\n  ),\n));\n\n$response = curl_exec($curl);\n\ncurl_close($curl);\necho $response;\n",
        "language": "php",
        "customLabel": ""
      },
      {
        "id": "WCDgTsSqAXfiwklk2V174",
        "code": "var data = JSON.stringify({\"recordQueries\":[{\"settings\":{\"searchPrefs\":[\"showOutOfStockProducts\",\"disableStockSorting\",\"includeStopwords\",\"excludeIds\",\"includeDescription\",\"disableFuzzyMatch\",\"disableWildcard\",\"disableORSearch\",\"partialMatch\",\"partialMatchForAllWords\",\"disableWordShingles\",\"searchCompoundsAsAndQuery\",\"enableBoostingOriginalTermsInSynonyms\",\"showDisabledFacets\",\"showFiltersWithSmallCount\",\"includeCategoryFilterInCatNav\",\"enableScores\",\"debugQuery\",\"disableGrouping\"],\"query\":{\"term\":\"short\"}},\"id\":\"productSearch\"}],\"context\":{\"apiKeys\":[\"klevu-156925593843210765\"]}});\n\nvar xhr = new XMLHttpRequest();\nxhr.withCredentials = false;\n\nxhr.addEventListener(\"readystatechange\", function() {\n  if(this.readyState === 4) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"POST\", \"https://eucs15v2.ksearchnet.com/cs/v2/search\");\nxhr.setRequestHeader(\"Content-Type\", \"application/json\");\n\nxhr.send(data);",
        "language": "javascript",
        "customLabel": ""
      },
      {
        "id": "nPW0NIJe-j5R9I5W4BGN0",
        "code": "OkHttpClient client = new OkHttpClient().newBuilder()\n  .build();\nMediaType mediaType = MediaType.parse(\"application/json\");\nRequestBody body = RequestBody.create(mediaType, \"{\\n  \\\"recordQueries\\\": [\\n    {\\n      \\\"settings\\\": {\\n        \\\"searchPrefs\\\": [\\n          \\\"showOutOfStockProducts\\\",\\n          \\\"disableStockSorting\\\",\\n          \\\"includeStopwords\\\",\\n          \\\"excludeIds\\\",\\n          \\\"includeDescription\\\",\\n          \\\"disableFuzzyMatch\\\",\\n          \\\"disableWildcard\\\",\\n          \\\"disableORSearch\\\",\\n          \\\"partialMatch\\\",\\n          \\\"partialMatchForAllWords\\\",\\n          \\\"disableWordShingles\\\",\\n          \\\"searchCompoundsAsAndQuery\\\",\\n          \\\"enableBoostingOriginalTermsInSynonyms\\\",\\n          \\\"showDisabledFacets\\\",\\n          \\\"showFiltersWithSmallCount\\\",\\n          \\\"includeCategoryFilterInCatNav\\\",\\n          \\\"enableScores\\\",\\n          \\\"debugQuery\\\",\\n          \\\"disableGrouping\\\"\\n        ],\\n        \\\"query\\\": {\\n          \\\"term\\\": \\\"short\\\"\\n        }\\n      },\\n      \\\"id\\\": \\\"productSearch\\\"\\n    }\\n  ],\\n  \\\"context\\\": {\\n    \\\"apiKeys\\\": [\\n      \\\"klevu-156925593843210765\\\"\\n    ]\\n  }\\n}\");\nRequest request = new Request.Builder()\n  .url(\"https://eucs15v2.ksearchnet.com/cs/v2/search\")\n  .method(\"POST\", body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .build();\nResponse response = client.newCall(request).execute();",
        "language": "java",
        "customLabel": ""
      },
      {
        "id": "0Ih7nieKhHFMl7CRY51j_",
        "code": "var request = require('request');\nvar options = {\n  'method': 'POST',\n  'url': 'https://eucs15v2.ksearchnet.com/cs/v2/search',\n  'headers': {\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"recordQueries\":[{\"settings\":{\"searchPrefs\":[\"showOutOfStockProducts\",\"disableStockSorting\",\"includeStopwords\",\"excludeIds\",\"includeDescription\",\"disableFuzzyMatch\",\"disableWildcard\",\"disableORSearch\",\"partialMatch\",\"partialMatchForAllWords\",\"disableWordShingles\",\"searchCompoundsAsAndQuery\",\"enableBoostingOriginalTermsInSynonyms\",\"showDisabledFacets\",\"showFiltersWithSmallCount\",\"includeCategoryFilterInCatNav\",\"enableScores\",\"debugQuery\",\"disableGrouping\"],\"query\":{\"term\":\"short\"}},\"id\":\"productSearch\"}],\"context\":{\"apiKeys\":[\"klevu-156925593843210765\"]}})\n\n};\nrequest(options, function (error, response) {\n  if (error) throw new Error(error);\n  console.log(response.body);\n});\n",
        "language": "nodejs",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "WCDgTsSqAXfiwklk2V174"
  },
  "description": "This is an example how to use different search preferences. ",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "hasTryItOut": false,
  "autoGeneratedAnchorSlug": "search-preferences",
  "legacyHash": "H8JzOsaZN1VAbxjcEZOmj"
}
```
:::

### Try it here!

:::Iframe{code="<iframe src=&#x22;https://codesandbox.io/embed/klevu-api-sendbox-4ktfrp?fontsize=14&hidenavigation=0&theme=dark&view=preview&initialpath=?payload=preferences&#x22;&#xA;     style=&#x22;width:100%; height:550px; border:0; border-radius: 4px; overflow:hidden;&#x22;&#xA;     title=&#x22;klevu_api sendbox&#x22;&#xA;     allow=&#x22;accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking&#x22;&#xA;     sandbox=&#x22;allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts&#x22;&#xA;     &#xA;   ></iframe>" iframeHeight="550"}

:::




