> For the complete documentation index, see [llms.txt](https://fredhopper.gitbook.io/product-discovery/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fredhopper.gitbook.io/product-discovery/resources/archived-pages/introduction/api-parameters/disable-features.md).

# Disable features

Disabling features allows faster queries

## Parameters

A single **`disable`** parameter allows disabling specific features, based on their name.

| **Name**      | Type    | Is Required ? | Default value |
| ------------- | ------- | ------------- | ------------- |
| **`disable`** | `array` | ✖             | empty array   |

### `disable`

An array of JSON objects, each representing a feature to disable during the query resolution. Each object contains the following properties:

| Property   | Type     | Description                    |
| ---------- | -------- | ------------------------------ |
| **`name`** | `string` | Name of the feature to disable |

{% tabs %}
{% tab title="JSON Format" %}

```javascript
"disable": [
    {
        "name": "feature-to-disable"
    },
    ...
]
```

{% endtab %}

{% tab title="TypeScript Format" %}

```typescript
type DisableOptions = { name: string }[];
```

{% endtab %}
{% endtabs %}

#### Available features

| Feature      | Feature name | Description                                                                                                                                                                                                                   |
| ------------ | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Faceting** | `"facet"`    | <p>Prevent XO Search from grouping results by facets, even if some facets are defined inside the XO Console.</p><p><strong>Note:</strong> If the query contains facets to filter by, these filters will still be applied.</p> |

#### Notes

* Currently, only the `"facet"` feature can be disabled.

## Response

All responses from XO Search uses the same format.\
Check [API Reference](/product-discovery/resources/archived-pages/introduction/api.md) page for a more detailed description of this format.

{% content-ref url="/pages/9oz6YlEAkw7zR7txwjhG" %}
[API Reference](/product-discovery/resources/archived-pages/introduction/api.md)
{% endcontent-ref %}

## Usage example

* Disable faceting in the results (ie. `response.metadata.facets` will be an empty array, no matter what is defined in the XO Console)

{% tabs %}
{% tab title="SDK - JS" %}
**NodeJS / NPM example**

```javascript
import { search } from '@attraqt/search';

const query = 'T-shirt';

search.init({ token: SEARCH_API_TOKEN });

const response = await search.query(query, {
  disable: [{ name: 'facet' }]
});

console.log(response);
```

**HTML example**

```markup
<script type="text/javascript">
    xo.init({
        search: {
            token: SEARCH_API_TOKEN
        }
    });

    xo.search.query('T-Shirt', {
        disable: [{ name: 'facet' }]
    }).then((response) => {
        console.log(response);
    });
</script>
```

{% endtab %}

{% tab title="API - POST" %}
**HTTP example**

```http
POST https://api-eu.attraqt.io/search HTTP/1.1
Content-Type: application/json; charset=UTF-8

{
  "token": "SEARCH_API_TOKEN",
  "query": "T-Shirt",
  "options": {
    "disable": [
      {
        "name": "facet"
      }
    ]
  }
}
```

**`curl` example**

```bash
curl -d "{\"token\":\"${SEARCH_API_TOKEN}\", \"query\":\"T-Shirt\", \"options\":{\"disable\":[{\"name\":\"facet\"}]}}" \
     -H "Content-Type: application/json; charset=UTF-8"                                                        \
     -X POST "https://api-eu.attraqt.io/search"
```

**JavaScript example**

```javascript
const response = await fetch('https://api-eu.attraqt.io/search', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json; charset=UTF-8'
  },
  body: JSON.stringify({
    token: SEARCH_API_TOKEN,
    query: 'T-Shirt',
    options: {
      disable: [{ name: 'facet' }]
    }
  })
});

if (response.ok) {
  console.log(await response.json());
}
```

{% endtab %}

{% tab title="API - GET" %}
**HTTP example**

```http
GET https://api-eu.attraqt.io/search/:token?encoded=:encodedParams HTTP/1.1
```

**`curl` example**

```bash
curl "https://api-eu.attraqt.io/search/${SEARCH_API_TOKEN}?encoded=%7B%22query%22%3A%22T-Shirt%22%2C%20%22options%22%3A%7B%22disable%22%3A%5B%7B%22name%22%3A%22facet%22%7D%5D%7D%7D"
```

**JavaScript example**

```javascript
const token = SEARCH_API_TOKEN;
const params = encodeURIComponent(JSON.stringify({
  query: 'T-shirt',
  options: {
    disable: [{ name: 'facet' }]
  }  
}));

const response = await fetch(
  `https://api-eu.attraqt.io/search/${token}?encoded=${params}`
);

if (response.ok) {
  console.log(await response.json());
}
```

{% endtab %}
{% endtabs %}
