How to know which phrase matches a rule

I follow the docs to create a rule using facet. How can I know which facet value matches?
E.g: With this config:

'pattern' => '{facet:color}'

The query red shirt will match the rule. How can I get the matched word red?

Hello @thungthudh,
There is no way to know which value triggered the rule.
You can automatically apply the corresponding filter:,
and/or remove the value of the facet from the query string that triggered the rule:

For example:

    "objectID": "1",
    "condition": {
        "anchoring": "is",
        "pattern": "{facet:color}"
    "consequence": {
        "params": {
            "automaticFacetFilters": ["{facet:color}"]
        "query": {
            "edits": [{"type": "remove", "delete": "{facet:color}"}]

would trigger on any value of the facet color. It would apply the filter color:xxx (xxx being the value in the query string) and remove xxx from the query string.