Internal add_document used for both batch and single doc indexing
(
self,
doc_id,
conn=None,
nosave=False,
score=1.0,
payload=None,
replace=False,
partial=False,
language=None,
no_create=False,
**fields,
)
| 1016 | return self.execute_command(*args) |
| 1017 | |
| 1018 | def _add_document( |
| 1019 | self, |
| 1020 | doc_id, |
| 1021 | conn=None, |
| 1022 | nosave=False, |
| 1023 | score=1.0, |
| 1024 | payload=None, |
| 1025 | replace=False, |
| 1026 | partial=False, |
| 1027 | language=None, |
| 1028 | no_create=False, |
| 1029 | **fields, |
| 1030 | ): |
| 1031 | """ |
| 1032 | Internal add_document used for both batch and single doc indexing |
| 1033 | """ |
| 1034 | |
| 1035 | if partial or no_create: |
| 1036 | replace = True |
| 1037 | |
| 1038 | args = [ADD_CMD, self.index_name, doc_id, score] |
| 1039 | if nosave: |
| 1040 | args.append("NOSAVE") |
| 1041 | if payload is not None: |
| 1042 | args.append("PAYLOAD") |
| 1043 | args.append(payload) |
| 1044 | if replace: |
| 1045 | args.append("REPLACE") |
| 1046 | if partial: |
| 1047 | args.append("PARTIAL") |
| 1048 | if no_create: |
| 1049 | args.append("NOCREATE") |
| 1050 | if language: |
| 1051 | args += ["LANGUAGE", language] |
| 1052 | args.append("FIELDS") |
| 1053 | args += list(itertools.chain(*fields.items())) |
| 1054 | |
| 1055 | if conn is not None: |
| 1056 | return conn.execute_command(*args) |
| 1057 | |
| 1058 | return self.execute_command(*args) |
| 1059 | |
| 1060 | def _add_document_hash( |
| 1061 | self, doc_id, conn=None, score=1.0, language=None, replace=False |
no test coverage detected