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