"""Create a RedisText inequality filter expression
        Args:
            other (str): The text value to filter on.
        Example:
            >>> from langchain.vectorstores.redis import RedisText
            >>> filter = RedisText("job") != "engineer"
        """
        self._set_value(other, str, RedisFilterOperator.NE)
        return RedisFilterExpression(str(self))
    def __mod__(self, other: str) -> "RedisFilterExpression":
        """Create a RedisText like filter expression
        Args:
            other (str): The text value to filter on.
        Example:
            >>> from langchain.vectorstores.redis import RedisText
            >>> filter = RedisText("job") % "engineer"
        """
        self._set_value(other, str, RedisFilterOperator.LIKE)
        return RedisFilterExpression(str(self))
    def __str__(self) -> str:
        if not self._value:
            raise ValueError(
                f"Operator must be used before calling __str__. Operators are "
                f"{self.OPERATORS.values()}"
            )
        try:
            return self.OPERATOR_MAP[self._operator] % (self._field, self._value)
        except KeyError:
            raise Exception("Invalid operator")
[docs]class RedisFilterExpression:
    """A RedisFilterExpression is a logical expression of RedisFilterFields.
    RedisFilterExpressions can be combined using the & and | operators to create
    complex logical expressions that evaluate to the Redis Query language.
    This presents an interface by which users can create complex queries
    without having to know the Redis Query language.
    Filter expressions are not initialized directly. Instead they are built
    by combining RedisFilterFields using the & and | operators.
    Examples: