Repository: redis/redis-py
File: redis/commands/search/query.py (Python)

Code before:
    the query string. The query string is set in the constructor, and other
    options have setter functions.

    The setter functions return the query object so they can be chained.
    i.e. `Query("foo").verbatim().filter(...)` etc.
    """

    def __init__(self, query_string: str) -> None:
        """
        Create a new query object.
        The query string is set in the constructor, and other options have
        setter functions.
        """

        self._query_string: str = query_string
        self._offset: int = 0
        self._num: int = 10
        self._no_content: bool = False
        self._no_stopwords: bool = False
        self._fields: Optional[List[str]] = None
        self._verbatim: bool = False
        self._with_payloads: bool = False
        self._with_scores: bool = False
        self._scorer: Optional[str] = None
        self._filters: List = list()
        self._ids: Optional[Tuple[str]] = None
        self._slop: int = -1
        self._timeout: Optional[float] = None
        self._in_order: bool = False
        self._sortby: Optional[SortbyField] = None
        self._return_fields: List = []
        self._return_fields_decode_as: dict = {}
        self._summarize_fields: List = []
        self._highlight_fields: List = []
        self._language: Optional[str] = None
        self._expander: Optional[str] = None
        self._dialect: int = DEFAULT_DIALECT

    def query_string(self) -> str:
        """Return the query string of this query only."""
        return self._query_string

    def limit_ids(self, *ids) -> "Query":
        """Limit the results to a specific set of pre-known document
        ids of any length."""
        self._ids = ids
        return self

    def return_fields(self, *fields) -> "Query":
        """Add fields to return fields."""
        for field in fields:

Review comment (suggestion):
The type annotation `Optional[Tuple[str]]` creates a tuple with exactly one string element. This should likely be `Optional[Tuple[str, ...]]` for a variable-length tuple or `Optional[List[str]]` to maintain the original list behavior.
```suggestion
        self._ids: Optional[Tuple[str, ...]] = None
```

Code after:
    the query string. The query string is set in the constructor, and other
    options have setter functions.

    The setter functions return the query object so they can be chained.
    i.e. `Query("foo").verbatim().filter(...)` etc.
    """

    def __init__(self, query_string: str) -> None:
        """
        Create a new query object.
        The query string is set in the constructor, and other options have
        setter functions.
        """

        self._query_string: str = query_string
        self._offset: int = 0
        self._num: int = 10
        self._no_content: bool = False
        self._no_stopwords: bool = False
        self._fields: Optional[List[str]] = None
        self._verbatim: bool = False
        self._with_payloads: bool = False
        self._with_scores: bool = False
        self._scorer: Optional[str] = None
        self._filters: List = list()
        self._ids: Optional[Tuple[str, ...]] = None
        self._slop: int = -1
        self._timeout: Optional[float] = None
        self._in_order: bool = False
        self._sortby: Optional[SortbyField] = None
        self._return_fields: List = []
        self._return_fields_decode_as: dict = {}
        self._summarize_fields: List = []
        self._highlight_fields: List = []
        self._language: Optional[str] = None
        self._expander: Optional[str] = None
        self._dialect: int = DEFAULT_DIALECT

    def query_string(self) -> str:
        """Return the query string of this query only."""
        return self._query_string

    def limit_ids(self, *ids) -> "Query":
        """Limit the results to a specific set of pre-known document
        ids of any length."""
        self._ids = ids
        return self

    def return_fields(self, *fields) -> "Query":
        """Add fields to return fields."""
        for field in fields: