def search_disjunctive_faceting(self, query, disjunctive_facets,
                                    params=None, refinements=None):
        if params is None:
            params = {}
        if refinements is None:
            refinements = {}

        if not isinstance(disjunctive_facets, (str, list)):
            raise AlgoliaException(
                'Argument \'disjunctive_facets\' must be a String or an Array')
        if not (isinstance(refinements, dict)):
            raise AlgoliaException(
                'Argument \'refinements\' must be a Hash of Arrays')

        if isinstance(disjunctive_facets, str):
            disjunctive_facets = disjunctive_facets.split(',')

        disjunctive_refinements = {}
        for key in refinements.keys():
            if key in disjunctive_facets:
                disjunctive_refinements[key] = refinements[key]

        queries = []
        filters = []

        for key in refinements:
            r = list(map(lambda x: key + ':' + x, refinements[key]))

            if str(key) in disjunctive_refinements:
                filters.append(r)
            else:
                filters += r

        params.update({
            'indexName': self.index_name,
            'query': query,
            'facetFilters': filters
        })
        queries.append(dict(params))

        params.update({
            'page': 0,
            'hitsPerPage': 0,
            'attributesToRetrieve': [],
            'attributesToHighlight': [],
            'attributesToSnippet': [],
            'analytics': False
        })

        for disjunctive_facet in disjunctive_facets:
            filters = []

            for key in refinements:
                if key != disjunctive_facet:
                    r = list(map(lambda x: key + ':' + x, refinements[key]))

                    if (str(key) in disjunctive_refinements):
                        filters.append(r)
                    else:
                        filters += r

            params['facetFilters'] = filters
            params['facets'] = disjunctive_facet
            queries.append(dict(params))

        answers = self.client.multiple_queries(queries)

        aggregated_answer = answers['results'][0]
        aggregated_answer['disjunctiveFacets'] = {}
        for i in range(1, len(answers['results'])):
            for facet in answers['results'][i]['facets']:
                aggregated_answer['disjunctiveFacets'][facet] = (
                        answers['results'][i]['facets'][facet])

                if facet not in disjunctive_refinements:
                    continue

                for r in disjunctive_refinements[facet]:
                    if r not in aggregated_answer['disjunctiveFacets'][facet]:
                        aggregated_answer['disjunctiveFacets'][facet][r] = 0

        return aggregated_answer
Perform a search with disjunctive facets generating as many queries as
dataset/ETHPy150Open algolia/algoliasearch-client-python/algoliasearch/index.py/Index.search_disjunctive_faceting