Skip to main content

Filter Builder

getFilterBuilderData returns everything you need to build a filter UI — or to programmatically pick valid facets.include / facets.exclude values when composing a strategy. For a given asset type it hands back:

  • The facet fields that exist on that asset type (e.g. asset_data.subcategory, data.rarity)
  • For any fields you ask about: every value seen in the catalog plus the product count behind it
  • A live product preview, so you can sanity-check that a filter resolves to real inventory

It accepts the same fv* knobs as filterCriteria, so you can preview exactly what a strategy would match before saving it.

Discover the facet fields

Start here when you don't know what fields exist. availableFacetFields lists every facet field on the asset type:

query F($i: FilterBuilderInput!) {
getFilterBuilderData(input: $i) {
availableFacetFields
totalProducts
error { message code }
}
}
{ "i": { "assetTypeId": "<assetTypeId>", "skipFacets": true } }

Expand facet values

Once you know the field names, request value counts for the ones you care about:

query F($i: FilterBuilderInput!) {
getFilterBuilderData(input: $i) {
facets { fieldName totalValues counts { value count } }
totalProducts
error { message code }
}
}
{
"i": {
"assetTypeId": "<assetTypeId>",
"facetFields": ["asset_data.subcategory", "data.rarity"]
}
}

Preview what a strategy would match

Pass the same fv* bounds and filters you intend to save. totalProducts is how many products the strategy would target right now; preview shows a sample:

{
"i": {
"assetTypeId": "<assetTypeId>",
"fvModelConfigId": "<fvModelConfigId>",
"fvMinCents": 5000,
"fvMaxCents": 50000,
"fvConfidenceMin": 0.7,
"activeFilters": { "asset_data.subcategory": ["POKEMON_CARDS"] },
"previewLimit": 24
}
}

Input fields

FieldTypeDescription
assetTypeIdID (required)Asset type to explore
facetFields[String]Subset of fields to expand value counts for; omit for all (heavier)
activeFiltersJSON{ field: [values] } applied before counting — "if I filtered by X, what's left?"
facetRangesJSONNumeric bounds per field, same shape as filterCriteria.facetRanges
queryStringText query
fvMinCents / fvMaxCentsIntFair-value bounds
fvKeyIds[String]Restrict to specific variants — see Keys
fvModelConfigIdStringFair-value model to evaluate against
fvConfidenceMinFloatConfidence floor, 0–1
maxFacetValuesIntCap on values per facet
previewLimit / previewOffsetIntPreview pagination
skipFacetsBooleanSkip facet computation; return only preview + totalProducts

Payload

FieldTypeDescription
availableFacetFields[String!]!Field names — the keys for facets.include / facets.exclude
availableFacetFieldDefs[FacetFieldDef!]!The same fields paired with a display label for filter UIs
facets[FacetFieldResult!]!Per-field value counts (fieldName, totalValues, counts { value count })
totalProductsInt!Product count after filters
preview[ProductSearchResult!]!Sample matching products

fieldName and value map directly onto a strategy's filterCriteria.facets — discover here, then save the same strings into addStrategyToGroup.