MCPcopy Create free account
hub / github.com/alibaba/zvec / _validate

Method _validate

python/zvec/model/param/query.py:147–162  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

145 return value if value.strip() else ""
146
147 def _validate(self) -> None:
148 if not isinstance(self.field_name, str) or not self.field_name.strip():
149 raise ValueError("Field name must be a non-empty string")
150 if self.has_id() and self.has_vector():
151 raise ValueError("Cannot provide both id and vector")
152 if self.has_fts() and (self.has_vector() or self.has_id()):
153 raise ValueError(
154 "Cannot combine fts with vector search fields (id/vector) in a single Query"
155 )
156 if self.fts is not None and not self.has_fts():
157 raise ValueError("Fts requires a non-empty query_string or match_string")
158 if self._fts_query_string() and self._fts_match_string():
159 raise ValueError(
160 "Cannot provide both query_string and match_string in Fts; "
161 "they are mutually exclusive"
162 )
163
164
165class VectorQuery(Query):

Calls 5

has_idMethod · 0.95
has_vectorMethod · 0.95
has_ftsMethod · 0.95
_fts_query_stringMethod · 0.95
_fts_match_stringMethod · 0.95