FacetsMixin#

class FacetsMixin#

Bases: object

Methods Summary

get_facet(project_id, facet_id_or_name)

Retrieves a facet of project project_id.

get_facet_stats(project_id, id)

Returns stats for a facet on project project_id.

get_facets(project_id)

Retrieves all facets of project project_id.

modify_facet(project_id, id[, display_name, ...])

Modifies a facet on project project_id.

new_facet(project_id, name[, data_type, ...])

Creates a new facet on project project_id.

Methods Documentation

get_facet(project_id, facet_id_or_name)#

Retrieves a facet of project project_id.

Parameters:
  • project_id – Project identifier

  • facet_id_or_name – Facet identifier or name

get_facet_stats(project_id, id)#

Returns stats for a facet on project project_id.

Parameters:
  • project_id – Project identifier

  • id – Facet identifier

Example:

>>> client.get_facet_stats('Sz7LLLbyTzy_SddblwIxaA',
 'da1d234f7e85c4edf37c3286ad7d4ea2c0c64ee8899a5219be21077214719d77'})
{
    u'all_single_values': True
}
get_facets(project_id)#

Retrieves all facets of project project_id.

Parameters:

project_id – Project identifier

modify_facet(project_id, id, display_name=None, group_name=None, visible=None, format_instr=None, searchable=None, typeahead=None, synonyms_id=None, compute_statistics=None, **kwargs)#

Modifies a facet on project project_id.

Parameters:
  • project_id – Project identifier

  • id – Facet identifier

  • display_name – Name to show to the user in the frontend

  • group_name – Label to group this facet under.

  • visible – If False this facet will be hidden in the front-end

  • format_instr – Formatting instruction for the facet value display.

  • searchable – Boolean property to enable/disable the searchability for this facet. For a ‘string’ data_type facet, this property can only be modified if the ‘analyzed’ (immutable) property of the facet has been set to ‘True’ while creating the facet. If False, this facet can still be used as a filter.

  • typeahead – Boolean property to enable/disable the typeahead for this facet.

  • synonyms_id – Synonym reference id. If set, the corresponding synonyms list will be applied when searching on this field. Requires the facet to by analyzed and only has an effect if the facet is searchable. If value is None then old synonyms is removed from facet.

  • compute_statistics – Whether to enable/disable the statistics computation for this facet. Defaults to False if not specified.

  • kwargs – Query parameters. All keyword arguments are passed on verbatim to the API. See the [[Facets#Update Facet|Update Facet]] resource for all possible parameters.

new_facet(project_id, name, data_type=None, display_name=None, group_name=None, visible=None, format_instr=None, searchable=None, typeahead=None, analyzed=None, synonyms_id=None, compute_statistics=None)#

Creates a new facet on project project_id.

Parameters:
  • project_id – Project identifier

  • name – Name of the facet in queries and on incoming items

  • data_type – One of (‘string’, ‘int’, ‘float’, ‘datetime’, ‘weighted’)

  • analyzed – Valid only for data_type ‘string’. For other data-types, this parameter is set to False and can not be modified for the time being. If True, this string facet will be analyzed for extra features like facet-value typeahead, searchability, and alphabetical sorting support on this facet. If False, this string facet will not support facet-value typeahead, searching, and alphabetical sorting at all. Although, it can still be used for query filtering, lexical sorting and facet-name typeahead. This is an immutable property and can not be modified after the facet has been created. Defaults to ‘True’ if not specified for string type facets. Setting this parameter to False will improve the data loading time.

  • display_name – Name to show to the user in the frontend

  • group_name – Label to group this facet under.

  • visible – If False this facet will be hidden in the front-end

  • format_instr – Formatting instruction for the facet value display.

  • searchable – Flag for enabling and disabling the searchability of a facet given that the analyzed property of this facet has been set to ‘True’. If ‘True’, values for this facet will be searchable. Defaults to ‘False’ if not specified.

  • typeahead – Boolean Flag for toggling the typeahead given that the analyzed property of this facet has been set to True while creation. If True, the value as well as the name of this facet will be typeaheadable. If False, neither the name, nor the value is typeaheadable. Defaults to False if not specified.

  • synonyms_id – Synonym reference id. If set, the corresponding synonyms list will be applied when searching on this field. Requires the facet to by analyzed and only has an effect if the facet is searchable.

  • compute_statistics – Whether to enable/disable the statistics computation for this facet. Defaults to False if not specified.