Add a single document to the index. Args: doc_id: the id of the saved document. nosave: if set to true, we just index the document, and don't save a copy of it. This means that searches will just return ids.
(
self,
doc_id: str,
nosave: bool = False,
score: float = 1.0,
payload: Optional[bool] = None,
replace: bool = False,
partial: bool = False,
language: Optional[str] = None,
no_create: bool = False,
**fields: List[str],
)
| 1081 | version="2.0.0", reason="deprecated since redisearch 2.0, call hset instead" |
| 1082 | ) |
| 1083 | def add_document( |
| 1084 | self, |
| 1085 | doc_id: str, |
| 1086 | nosave: bool = False, |
| 1087 | score: float = 1.0, |
| 1088 | payload: Optional[bool] = None, |
| 1089 | replace: bool = False, |
| 1090 | partial: bool = False, |
| 1091 | language: Optional[str] = None, |
| 1092 | no_create: bool = False, |
| 1093 | **fields: List[str], |
| 1094 | ): |
| 1095 | """ |
| 1096 | Add a single document to the index. |
| 1097 | |
| 1098 | Args: |
| 1099 | |
| 1100 | doc_id: the id of the saved document. |
| 1101 | nosave: if set to true, we just index the document, and don't |
| 1102 | save a copy of it. This means that searches will just |
| 1103 | return ids. |
| 1104 | score: the document ranking, between 0.0 and 1.0 |
| 1105 | payload: optional inner-index payload we can save for fast |
| 1106 | access in scoring functions |
| 1107 | replace: if True, and the document already is in the index, |
| 1108 | we perform an update and reindex the document |
| 1109 | partial: if True, the fields specified will be added to the |
| 1110 | existing document. |
| 1111 | This has the added benefit that any fields specified |
| 1112 | with `no_index` |
| 1113 | will not be reindexed again. Implies `replace` |
| 1114 | language: Specify the language used for document tokenization. |
| 1115 | no_create: if True, the document is only updated and reindexed |
| 1116 | if it already exists. |
| 1117 | If the document does not exist, an error will be |
| 1118 | returned. Implies `replace` |
| 1119 | fields: kwargs dictionary of the document fields to be saved |
| 1120 | and/or indexed. |
| 1121 | NOTE: Geo points should be encoded as strings of "lon,lat" |
| 1122 | """ # noqa |
| 1123 | return self._add_document( |
| 1124 | doc_id, |
| 1125 | conn=None, |
| 1126 | nosave=nosave, |
| 1127 | score=score, |
| 1128 | payload=payload, |
| 1129 | replace=replace, |
| 1130 | partial=partial, |
| 1131 | language=language, |
| 1132 | no_create=no_create, |
| 1133 | **fields, |
| 1134 | ) |
| 1135 | |
| 1136 | @deprecated_function( |
| 1137 | version="2.0.0", reason="deprecated since redisearch 2.0, call hset instead" |
nothing calls this directly
no test coverage detected