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:

PropertyTypeDescription

name

string

Name of the feature to disable

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

Available features

FeatureFeature nameDescription

Faceting

"facet"

Prevent XO Search from grouping results by facets, even if some facets are defined inside the XO Console.

Note: If the query contains facets to filter by, these filters will still be applied.

Notes

  • Currently, only the "facet" feature can be disabled.

Response

All responses from XO Search uses the same format. Check API Reference page for a more detailed description of this format.

pageAPI Reference

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)

NodeJS / NPM example

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

<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>

Last updated