)
        return func(instance, *args, **kwargs)
    return wrapper
[docs]class RedisTag(RedisFilterField):
    """A RedisFilterField representing a tag in a Redis index."""
    OPERATORS: Dict[RedisFilterOperator, str] = {
        RedisFilterOperator.EQ: "==",
        RedisFilterOperator.NE: "!=",
        RedisFilterOperator.IN: "==",
    }
    OPERATOR_MAP: Dict[RedisFilterOperator, str] = {
        RedisFilterOperator.EQ: "@%s:{%s}",
        RedisFilterOperator.NE: "(-@%s:{%s})",
        RedisFilterOperator.IN: "@%s:{%s}",
    }
    SUPPORTED_VAL_TYPES = (list, set, tuple, str, type(None))
[docs]    def __init__(self, field: str):
        """Create a RedisTag FilterField.
        Args:
            field (str): The name of the RedisTag field in the index to be queried
                against.
        """
        super().__init__(field)
    def _set_tag_value(
        self,
        other: Union[List[str], Set[str], Tuple[str], str],
        operator: RedisFilterOperator,
    ) -> None:
        if isinstance(other, (list, set, tuple)):
            try:
                # "if val" clause removes non-truthy values from list
                other = [str(val) for val in other if val]
            except ValueError:
                raise ValueError("All tags within collection must be strings")
        # above to catch the "" case
        elif not other:
            other = []
        elif isinstance(other, str):
            other = [other]