From 93087a54dbeb3331dacd07d67c0eddc5e51ad551 Mon Sep 17 00:00:00 2001 From: MrPresent-Han Date: Thu, 19 Oct 2023 17:59:43 +0800 Subject: [PATCH] add judgement for isPrimary(#1663) Signed-off-by: MrPresent-Han --- pymilvus/orm/constants.py | 1 + pymilvus/orm/iterator.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pymilvus/orm/constants.py b/pymilvus/orm/constants.py index ddfe8aecb..b69ae5294 100644 --- a/pymilvus/orm/constants.py +++ b/pymilvus/orm/constants.py @@ -36,6 +36,7 @@ RANGE_FILTER = "range_filter" FIELDS = "fields" EF = "ef" +IS_PRIMARY = "is_primary" STOP_REDUCE_FOR_BEST = "stop_reduce_for_best" DEFAULT_MAX_L2_DISTANCE = 99999999.0 DEFAULT_MIN_IP_DISTANCE = -99999999.0 diff --git a/pymilvus/orm/iterator.py b/pymilvus/orm/iterator.py index 5d84fe4cb..5b77b931b 100644 --- a/pymilvus/orm/iterator.py +++ b/pymilvus/orm/iterator.py @@ -20,6 +20,7 @@ EF, FIELDS, INT64_MAX, + IS_PRIMARY, MAX_BATCH_SIZE, MAX_FILTERED_IDS_COUNT_ITERATION, MAX_TRY_TIME, @@ -163,7 +164,7 @@ def __check_reached_limit(self, ret: List): def __setup__pk_prop(self): fields = self._schema[FIELDS] for field in fields: - if field["is_primary"]: + if field[IS_PRIMARY]: if field["type"] == DataType.VARCHAR: self._pk_str = True else: @@ -352,7 +353,7 @@ def __check_for_special_index_param(self): def __setup__pk_prop(self): fields = self._schema[FIELDS] for field in fields: - if field["is_primary"]: + if IS_PRIMARY in field and field[IS_PRIMARY]: if field["type"] == DataType.VARCHAR: self._pk_str = True else: