def test_facets_filter_term_exclusions(self):
        """
        Tests facet behavior with filter exclusions, verifying that excludeTerms properly
        removes specified terms from facet results while maintaining proper counts.
        """

        def test_facet_query(retrieval_method, ranking_method, facets, filter_string, expected_lexical_facets, expected_other_facets):
            res = tensor_search.search(
                config=self.config, index_name=self.semi_structured_default_text_index.name, text="shirt",
                facets=facets,
                search_method=SearchMethod.HYBRID, hybrid_parameters=HybridParameters(
                    retrievalMethod=retrieval_method, rankingMethod=ranking_method
                ),
                filter=filter_string,
            )
            if retrieval_method == RetrievalMethod.Lexical:
                # lexical only matches 1 doc for q="shirt"
                self.assertDictEqual(res["facets"], expected_lexical_facets)
            else:
                self.assertDictEqual(res["facets"], expected_other_facets)
            return res

        self.add_fashion_docs(EXAMPLE_FASHION_DOCUMENTS)
        for retrieval_method, ranking_method in (
                (RetrievalMethod.Tensor, RankingMethod.Tensor),
                (RetrievalMethod.Lexical, RankingMethod.Lexical),
                (RetrievalMethod.Disjunction, RankingMethod.RRF),
        ):
            with self.subTest(retrieval_method=retrieval_method, ranking_method=ranking_method):
                with self.subTest("No facets returned due to filtering"):
                    facets = FacetsParameters(fields={"color": FieldFacetsConfiguration(
                        type="string"
                    )})
                    expected_lexical_facets = {}
                    expected_other_facets = {}
                    res = test_facet_query(
                        retrieval_method=retrieval_method, ranking_method=ranking_method,
                        facets=facets,
                        expected_lexical_facets=expected_lexical_facets, expected_other_facets=expected_other_facets,
                        filter_string="price:[100 TO 200]"
                    )
                    self.assertEqual(res["hits"], [])
                with self.subTest("No hits returned due to filtering, facets with terms exclusions are present"):
                    facets = FacetsParameters(fields={"color": FieldFacetsConfiguration(
                        type="string", excludeTerms=["price:[100 TO 200]"]
                    )})
                    expected_lexical_facets = {'color': {'red': {'count': 1}}}
                    expected_other_facets = {'color': {'red': {'count': 2}, 'coral': {'count': 1}, 'green': {'count': 1}}}
                    res = test_facet_query(
                        retrieval_method=retrieval_method, ranking_method=ranking_method,
                        facets=facets,
                        expected_lexical_facets=expected_lexical_facets, expected_other_facets=expected_other_facets,
                        filter_string="price:[100 TO 200]"
                    )
                    self.assertEqual(res["hits"], [])
                with self.subTest("excludeTerms can get rid of part of the term"):
                    facets = FacetsParameters(fields={"color": FieldFacetsConfiguration(
                        type="string", excludeTerms=["color:red"]
                    )})
                    expected_lexical_facets = {'color': {'red': {'count': 1}}}
                    expected_other_facets = {'color': {'red': {'count': 1}}}
                    res = test_facet_query(
                        retrieval_method=retrieval_method, ranking_method=ranking_method,
                        facets=facets,
                        expected_lexical_facets=expected_lexical_facets, expected_other_facets=expected_other_facets,
                        filter_string="price:[49 TO 49.1] AND NOT color:red"
                    )
                with self.subTest("excludeTerms work per field"):
                    facets = FacetsParameters(fields={
                        "color": FieldFacetsConfiguration(type="string", excludeTerms=["color:green"]),
                        "brand": FieldFacetsConfiguration(type="string", excludeTerms=["color:red"]),
                    })
                    expected_lexical_facets = {
                        'color': {'red': {'count': 1}},
                        'brand': {'SnugNest': {'count': 1}}
                    }
                    expected_other_facets = {
                        'color': {'red': {'count': 2}},
                        'brand': {'PulseWear': {'count': 1}, 'SnugNest': {'count': 1}, 'SprintX': {'count': 1}}
                    }
                    res = test_facet_query(
                        retrieval_method=retrieval_method, ranking_method=ranking_method,
                        facets=facets,
                        expected_lexical_facets=expected_lexical_facets, expected_other_facets=expected_other_facets,
                        filter_string="color:red AND NOT color:green"
                    )

        Tests facet behavior with filter exclusions, verifying that excludeTerms properly
        removes specified terms from facet results while maintaining proper counts.
        
tests/integ_tests/tensor_search/integ_tests/test_facets.py