---
title: "Validate disjunctive facet counts"
description: "Test category facet counts against a documented counting rule, including whether the current category selection is excluded from its own counts."
canonical_url: "https://vostride.com/agent-library/search-filtering/facet-count-contract.md"
md_url: "https://vostride.com/agent-library/search-filtering/facet-count-contract.md"
content_kind: "recipe"
topic: "search-filtering"
---

# Validate disjunctive facet counts

Test category facet counts against a documented counting rule, including whether the current category selection is excluded from its own counts.

## Risk

Facet counts are ambiguous unless the product defines their meaning. Use the fixture contract here: category counts honor the text query and other facets but ignore the category facet itself.

## Fixtures

- A fixture store has red wool hat, red cotton hat, red wool scarf, and blue wool scarf with unique item keys.
- The query red matches three records; the material Wool constraint leaves the red hat and red scarf.
- The expected disjunctive category counts are Hat 1 and Scarf 1 while Wool is selected.

## Steps

1. Open the fixture store, search red, and verify only the three red records appear.
2. Choose material Wool and verify the red wool hat and red wool scarf remain.
3. Verify category facet counts show Hat 1 and Scarf 1 before choosing a category.
4. Choose Hat and verify only the red wool hat appears while the category counts still show Hat 1 and Scarf 1.
5. Choose Scarf instead and verify the visible record changes to the red wool scarf without changing the material constraint.

## Expected results

- The visible result membership uses every active constraint, even when category counts deliberately ignore their own selection.
- Each displayed category count equals the independent fixture matrix for query red and material Wool.
- Switching category preserves the text query and material filter in both controls and result membership.

## False-pass traps

- Comparing counts to the already filtered single row can mistakenly bless a conjunctive implementation.
- A disabled zero-count facet can hide a wrong counting rule; inspect both category values.

## Cleanup

- Remove the four inventory fixtures and reset category, material, and query state.

## Use with agent-qa

Adapt this test design to your application's acceptance criteria and configured target using the [recipe execution guide](/agent-library/software-factory/turn-a-recipe-into-an-agent-qa-test.md). External fixture setup and non-UI checks require your own supported hooks or test tooling. Validate the authored test, execute it, and inspect the completed evidence; this recipe is not a recorded test result.

## References

- [agent-qa test](/docs/agent-qa/configuration/test.md)
- [agent-qa first test](/docs/agent-qa/guides/first-test.md)
- [agent-qa web testing](/docs/agent-qa/guides/web-testing.md)

- [Search and filtering QA recipes](/agent-library/search-filtering.md)
- [Software factory QA library](/agent-library.md)
