You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(parser): enhance hybrid model support with vector names
- Added support for specifying dense and sparse vector names in hybrid collections during INSERT and CREATE statements.
- Updated the parser to handle new syntax for DENSE VECTOR and SPARSE VECTOR clauses.
- Modified the InsertStmt and CreateCollectionStmt to include dense_vector and sparse_vector attributes.
- Adjusted related tests to verify the correct handling of vector names in hybrid scenarios.
test(tests): update tests for new hybrid vector functionality
- Enhanced tests to cover new vector name features in INSERT and CREATE statements.
- Updated assertions to check for correct vector names in hybrid configurations.
- Refactored existing tests to ensure compatibility with the new parser changes.
CREATE COLLECTION research_papers USING HYBRID DENSE MODEL 'BAAI/bge-base-en-v1.5'
@@ -380,6 +391,7 @@ Replaces the stored dense vector for a **single point** identified by its ID. Th
380
391
```
381
392
UPDATE <collection> SET VECTOR WHERE id = '<point_id>' [<vector>]
382
393
UPDATE <collection> SET VECTOR WHERE id = <integer_id> [<vector>]
394
+
UPDATE <collection> SET VECTOR '<dense_vector_name>' WHERE id = '<point_id>' [<vector>]
383
395
```
384
396
385
397
The vector is provided as a JSON-style float array `[v1, v2, ..., vN]`. The array length must match the collection's configured vector dimensions.
@@ -392,13 +404,17 @@ UPDATE articles SET VECTOR WHERE id = '3f2e1a4b-8c91-4d0e-b123-abc123def456' [0.
392
404
393
405
-- Replace vector by integer ID
394
406
UPDATE articles SET VECTOR WHERE id =42 [0.1, 0.2, 0.3, 0.4]
407
+
408
+
-- Replace a specific named vector
409
+
UPDATE articles SET VECTOR 'body'WHERE id ='3f2e1a4b-8c91-4d0e-b123-abc123def456' [0.1, 0.2, 0.3, 0.4]
395
410
```
396
411
397
412
**Notes:**
398
413
- Only single-point updates are supported (by ID). Bulk or filter-based vector updates are not supported.
399
414
- The point must already exist; this operation does not create new points.
400
415
- The collection must exist; updating from a non-existent collection raises an error.
401
-
- For hybrid collections, the dense vector named `"dense"` is updated. Sparse vectors are managed separately.
416
+
- For named-vector collections, QQL updates the only dense vector when the target is unambiguous. Use `SET VECTOR '<name>'` when a collection has multiple dense vectors.
Copy file name to clipboardExpand all lines: docs/insert.md
+16-2Lines changed: 16 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,8 +16,9 @@ If you include an `id` field in `VALUES`, QQL uses it as the Qdrant point ID. Su
16
16
```
17
17
INSERT INTO COLLECTION <collection_name> VALUES {<dict>}
18
18
INSERT INTO COLLECTION <collection_name> VALUES {<dict>} USING MODEL '<model_name>'
19
+
INSERT INTO COLLECTION <collection_name> VALUES {<dict>} USING VECTOR '<dense_vector_name>'
19
20
INSERT INTO COLLECTION <collection_name> VALUES {<dict>} USING HYBRID
20
-
INSERT INTO COLLECTION <collection_name> VALUES {<dict>} USING HYBRID DENSE MODEL '<model>'SPARSE MODEL '<model>'
21
+
INSERT INTO COLLECTION <collection_name> VALUES {<dict>} USING HYBRID [DENSE MODEL '<model>'] [DENSE VECTOR '<name>'] [SPARSE MODEL '<model>'] [SPARSE VECTOR '<name>']
21
22
```
22
23
23
24
**Examples:**
@@ -49,6 +50,17 @@ Insert into a hybrid collection (dense + sparse BM25 vectors):
49
50
INSERT INTO COLLECTION articles VALUES {'text': 'Attention is all you need'} USING HYBRID
50
51
```
51
52
53
+
Insert into a specific named dense vector:
54
+
```sql
55
+
INSERT INTO COLLECTION articles VALUES {'text': 'hello world'} USING VECTOR 'body'
56
+
```
57
+
58
+
Insert into a hybrid collection with external vector names:
59
+
```sql
60
+
INSERT INTO COLLECTION articles VALUES {'text': 'hello world'}
61
+
USING HYBRID DENSE VECTOR 'emb' SPARSE VECTOR 'lex'
62
+
```
63
+
52
64
Insert with custom models for both dense and sparse:
53
65
```sql
54
66
INSERT INTO COLLECTION articles VALUES {'text': 'hello world'}
-`id`, when provided, must be an unsigned integer or UUID string.
68
80
- If the collection already exists with a different vector size (from a different model), an error is raised with a clear message.
69
81
- Hybrid inserts require a hybrid collection (created with `CREATE COLLECTION ... HYBRID`, auto-created on the first `USING HYBRID` insert, or **auto-detected** — if you omit `USING HYBRID` but the target collection is already a hybrid collection, QQL detects this and uses the hybrid insert path automatically).
82
+
- If a collection has multiple dense or sparse vectors, specify the target vector names explicitly.
70
83
71
84
---
72
85
@@ -82,8 +95,9 @@ Each record may optionally include an `id` field. This is the preferred way to k
82
95
```
83
96
INSERT BULK INTO COLLECTION <collection_name> VALUES [<dict>, <dict>, ...]
84
97
INSERT BULK INTO COLLECTION <collection_name> VALUES [<dict>, ...] USING MODEL '<model_name>'
98
+
INSERT BULK INTO COLLECTION <collection_name> VALUES [<dict>, ...] USING VECTOR '<dense_vector_name>'
85
99
INSERT BULK INTO COLLECTION <collection_name> VALUES [<dict>, ...] USING HYBRID
86
-
INSERT BULK INTO COLLECTION <collection_name> VALUES [<dict>, ...] USING HYBRID DENSE MODEL '<model>'SPARSE MODEL '<model>'
100
+
INSERT BULK INTO COLLECTION <collection_name> VALUES [<dict>, ...] USING HYBRID [DENSE MODEL '<model>'] [DENSE VECTOR '<name>'] [SPARSE MODEL '<model>'] [SPARSE VECTOR '<name>']
|`secret`|`str \| None`|`None`| API key; `None` for unauthenticated |
152
152
|`default_model`|`str \| None`|`None` → `sentence-transformers/all-MiniLM-L6-v2`| Dense embedding model used when no `USING MODEL` clause is given |
153
+
|`default_dense_vector_name`|`str`|`"dense"`| Dense vector name used when QQL creates a collection and no explicit `USING VECTOR` name is given |
154
+
|`default_sparse_vector_name`|`str`|`"sparse"`| Sparse vector name used when QQL creates a hybrid collection and no explicit sparse vector name is given |
Copy file name to clipboardExpand all lines: docs/scripts.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -155,8 +155,8 @@ qql execute backup.qql
155
155
156
156
**Rules and notes:**
157
157
- Points without a `'text'` payload field are **skipped** (counted in the footer comment).
158
-
- Hybrid collections produce `CREATE COLLECTION <name> HYBRID` and `INSERT BULK ... USING HYBRID` statements.
159
-
- Dense collections produce plain `CREATE COLLECTION <name>` and `INSERT BULK` statements.
158
+
- Hybrid collections produce `CREATE COLLECTION <name> USING HYBRID ...` and matching `INSERT BULK ... USING HYBRID ...` statements, including vector names when the source collection uses named vectors.
159
+
- Dense collections produce `CREATE COLLECTION <name> USING VECTOR '<name>'` for named vectors, or plain `CREATE COLLECTION <name>` for unnamed external collections.
160
160
- All payload value types are preserved: strings, integers, floats, booleans (`true`/`false`), `null`, lists, and nested dicts.
161
161
- Re-importing re-embeds all text using your currently configured model — use the same model as the original collection to preserve semantic accuracy.
162
162
- Parent directories of the output path are created automatically.
Copy file name to clipboardExpand all lines: docs/search.md
+14-3Lines changed: 14 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,10 +12,11 @@ An optional `WHERE` clause filters the candidate set **before** similarity ranki
12
12
```
13
13
SEARCH <collection_name> SIMILAR TO '<query_text>' LIMIT <n>
14
14
SEARCH <collection_name> SIMILAR TO '<query_text>' LIMIT <n> USING MODEL '<model_name>'
15
+
SEARCH <collection_name> SIMILAR TO '<query_text>' LIMIT <n> USING VECTOR '<dense_vector_name>'
15
16
SEARCH <collection_name> SIMILAR TO '<query_text>' LIMIT <n> [USING MODEL '<model>'] WHERE <filter>
16
17
SEARCH <collection_name> SIMILAR TO '<query_text>' LIMIT <n> USING HYBRID
17
-
SEARCH <collection_name> SIMILAR TO '<query_text>' LIMIT <n> USING HYBRID [FUSION 'rrf|dbsf'] [DENSE MODEL '<model>'] [SPARSE MODEL '<model>'] [WHERE <filter>]
18
-
SEARCH <collection_name> SIMILAR TO '<query_text>' LIMIT <n> USING SPARSE [MODEL '<sparse_model>']
18
+
SEARCH <collection_name> SIMILAR TO '<query_text>' LIMIT <n> USING HYBRID [FUSION 'rrf|dbsf'] [DENSE MODEL '<model>'] [DENSE VECTOR '<name>'] [SPARSE MODEL '<model>'] [SPARSE VECTOR '<name>'] [WHERE <filter>]
19
+
SEARCH <collection_name> SIMILAR TO '<query_text>' LIMIT <n> USING SPARSE [MODEL '<sparse_model>'] [VECTOR '<sparse_vector_name>']
19
20
SEARCH <collection_name> SIMILAR TO '<query_text>' LIMIT <n> EXACT
0 commit comments