MCPcopy
hub / github.com/redis/redis-py / return_field

Method return_field

redis/commands/search/query.py:63–82  ·  view source on GitHub ↗

Add a field to the list of fields to return. - **field**: The field to include in query results - **as_field**: The alias for the field - **decode_field**: Whether to decode the field from bytes to string - **encoding**: The encoding to use when decoding the

(
        self,
        field: str,
        as_field: Optional[str] = None,
        decode_field: Optional[bool] = True,
        encoding: Optional[str] = "utf8",
    )

Source from the content-addressed store, hash-verified

61 return self
62
63 def return_field(
64 self,
65 field: str,
66 as_field: Optional[str] = None,
67 decode_field: Optional[bool] = True,
68 encoding: Optional[str] = "utf8",
69 ) -> "Query":
70 """
71 Add a field to the list of fields to return.
72
73 - **field**: The field to include in query results
74 - **as_field**: The alias for the field
75 - **decode_field**: Whether to decode the field from bytes to string
76 - **encoding**: The encoding to use when decoding the field
77 """
78 self._return_fields.append(field)
79 self._return_fields_decode_as[field] = encoding if decode_field else None
80 if as_field is not None:
81 self._return_fields += ("AS", as_field)
82 return self
83
84 def _mk_field_list(self, fields: Optional[Union[List[str], str]]) -> List:
85 if not fields:

Calls 1

appendMethod · 0.45