Skip to content

refactor: drop VectorQuery, unify single-target query on SearchQuery#428

Merged
zhourrr merged 2 commits into
alibaba:mainfrom
egolearner:refactor/search-query-abstraction
May 29, 2026
Merged

refactor: drop VectorQuery, unify single-target query on SearchQuery#428
zhourrr merged 2 commits into
alibaba:mainfrom
egolearner:refactor/search-query-abstraction

Conversation

@egolearner
Copy link
Copy Markdown
Collaborator

Extract query types from doc.h into a new src/include/zvec/db/query.h and introduce VectorClause / FtsClause / QueryTarget / SearchQuery as the unified query API.

  • SearchQuery becomes the single canonical entry at the SQLEngine layer (execute, parse_request, MessageToSQLInfo)
  • Collection gains Query(const SearchQuery&); the old Query(const VectorQuery&) overload is kept as a backward-compat delegating shim and marked [[deprecated]]
  • VectorQuery struct itself is also marked [[deprecated]] with a migration hint to SearchQuery
  • GroupByVectorQuery is reorganized to hold a QueryTarget (not publicly released, so the layout change is safe)
  • C and Python bindings now route through SearchQuery internally while preserving the external surface (C symbol names, Python _VectorQuery attribute names, pickle tuple layout)
  • All SQLEngine-layer tests, plus the collection / doc / optimize-recovery tests, are migrated to construct SearchQuery directly
  • The C++ example and the bug-report issue template are updated to the new API

@egolearner egolearner force-pushed the refactor/search-query-abstraction branch from 41a9da5 to 85cefc1 Compare May 28, 2026 07:53
@egolearner egolearner force-pushed the refactor/search-query-abstraction branch from 85cefc1 to 27dea57 Compare May 29, 2026 03:05
@egolearner egolearner changed the title refactor: introduce SearchQuery and QueryTarget, deprecate VectorQuery refactor: drop VectorQuery, unify single-target query on SearchQuery May 29, 2026
Comment thread src/include/zvec/db/query.h Outdated
Comment thread src/include/zvec/db/query.h Outdated
Comment thread src/db/index/common/doc.cc Outdated
Comment thread src/include/zvec/db/query.h
Comment thread src/db/collection.cc
Comment thread src/db/collection.cc
Comment thread src/db/index/common/doc.cc Outdated
Comment thread src/db/index/common/doc.cc Outdated
Comment thread src/binding/c/c_api.cc
Copy link
Copy Markdown
Collaborator

@chinaux chinaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhourrr zhourrr merged commit 8dcb6cb into alibaba:main May 29, 2026
13 checks passed
@egolearner egolearner deleted the refactor/search-query-abstraction branch May 29, 2026 08:43
egolearner added a commit to egolearner/zvec that referenced this pull request May 29, 2026
Adapt FTS to the query-model refactor from alibaba#428/alibaba#405 on main:
- VectorQuery is replaced by SearchQuery + QueryTarget
  (variant<VectorClause, FtsClause>)
- Fold FTS validation into SearchQuery::validate_and_sanitize
- c_api / python binding read & write FTS via FtsClause and target_.clause_
- Add QueryTarget::get_fts_clause() helper, replacing raw std::get_if calls
- Migrate FTS tests to the new model; drop the vector/fts mutual-exclusion
  case that no longer applies under the variant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants