qql-cli 1.4.0__tar.gz → 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. qql_cli-2.0.0/PKG-INFO +194 -0
  2. qql_cli-2.0.0/README.md +143 -0
  3. qql_cli-2.0.0/docs/_config.yml +10 -0
  4. qql_cli-2.0.0/docs/collections.md +216 -0
  5. qql_cli-2.0.0/docs/filters.md +166 -0
  6. qql_cli-2.0.0/docs/getting-started.md +154 -0
  7. qql_cli-2.0.0/docs/index.html +189 -0
  8. qql_cli-2.0.0/docs/insert.md +156 -0
  9. qql_cli-2.0.0/docs/programmatic.md +120 -0
  10. qql_cli-2.0.0/docs/reference.md +182 -0
  11. qql_cli-2.0.0/docs/robots.txt +4 -0
  12. qql_cli-2.0.0/docs/scripts.md +159 -0
  13. qql_cli-2.0.0/docs/search.md +293 -0
  14. qql_cli-2.0.0/docs/sitemap.xml +58 -0
  15. {qql_cli-1.4.0 → qql_cli-2.0.0}/pyproject.toml +13 -4
  16. {qql_cli-1.4.0 → qql_cli-2.0.0}/src/qql/ast_nodes.py +28 -3
  17. {qql_cli-1.4.0 → qql_cli-2.0.0}/src/qql/cli.py +4 -0
  18. {qql_cli-1.4.0 → qql_cli-2.0.0}/src/qql/executor.py +122 -12
  19. {qql_cli-1.4.0 → qql_cli-2.0.0}/src/qql/lexer.py +23 -1
  20. {qql_cli-1.4.0 → qql_cli-2.0.0}/src/qql/parser.py +113 -35
  21. {qql_cli-1.4.0 → qql_cli-2.0.0}/tests/test_executor.py +177 -0
  22. {qql_cli-1.4.0 → qql_cli-2.0.0}/tests/test_parser.py +143 -0
  23. qql_cli-1.4.0/PKG-INFO +0 -1449
  24. qql_cli-1.4.0/README.md +0 -1401
  25. {qql_cli-1.4.0 → qql_cli-2.0.0}/.github/workflows/ci.yml +0 -0
  26. {qql_cli-1.4.0 → qql_cli-2.0.0}/.github/workflows/publish.yml +0 -0
  27. {qql_cli-1.4.0 → qql_cli-2.0.0}/.gitignore +0 -0
  28. {qql_cli-1.4.0 → qql_cli-2.0.0}/LICENSE +0 -0
  29. {qql_cli-1.4.0 → qql_cli-2.0.0}/main.py +0 -0
  30. {qql_cli-1.4.0 → qql_cli-2.0.0}/resources/Features.md +0 -0
  31. {qql_cli-1.4.0 → qql_cli-2.0.0}/resources/sample.qql +0 -0
  32. {qql_cli-1.4.0 → qql_cli-2.0.0}/resources/sample_v2.qql +0 -0
  33. {qql_cli-1.4.0 → qql_cli-2.0.0}/src/qql/__init__.py +0 -0
  34. {qql_cli-1.4.0 → qql_cli-2.0.0}/src/qql/config.py +0 -0
  35. {qql_cli-1.4.0 → qql_cli-2.0.0}/src/qql/dumper.py +0 -0
  36. {qql_cli-1.4.0 → qql_cli-2.0.0}/src/qql/embedder.py +0 -0
  37. {qql_cli-1.4.0 → qql_cli-2.0.0}/src/qql/exceptions.py +0 -0
  38. {qql_cli-1.4.0 → qql_cli-2.0.0}/src/qql/script.py +0 -0
  39. {qql_cli-1.4.0 → qql_cli-2.0.0}/tests/__init__.py +0 -0
  40. {qql_cli-1.4.0 → qql_cli-2.0.0}/tests/test_dumper.py +0 -0
  41. {qql_cli-1.4.0 → qql_cli-2.0.0}/tests/test_lexer.py +0 -0
  42. {qql_cli-1.4.0 → qql_cli-2.0.0}/tests/test_script.py +0 -0
qql_cli-2.0.0/PKG-INFO ADDED
@@ -0,0 +1,194 @@
1
+ Metadata-Version: 2.4
2
+ Name: qql-cli
3
+ Version: 2.0.0
4
+ Summary: QQL is a SQL-like query language and CLI for Qdrant vector database. Write INSERT, SEARCH, RECOMMEND, DELETE, and CREATE COLLECTION statements instead of Python SDK calls. Supports hybrid dense+sparse vector search, cross-encoder reranking, quantization (scalar, binary, product), WHERE clause filters, script execution, and collection dump/restore.
5
+ Project-URL: Homepage, https://github.com/pavanjava/qql
6
+ Project-URL: Repository, https://github.com/pavanjava/qql
7
+ Project-URL: Documentation, https://pavanjava.github.io/qql
8
+ Project-URL: Bug Tracker, https://github.com/pavanjava/qql/issues
9
+ Author-email: Kameshwara Pavan Kumar Mantha <pavankumarmantha@gmail.com>
10
+ License: MIT License
11
+
12
+ Copyright (c) 2026 Kameshwara Pavan Kumar Mantha
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+ License-File: LICENSE
32
+ Keywords: cli,embeddings,fastembed,hybrid-search,nlp,qdrant,query-language,rag,semantic-search,sql,vector-database,vector-search
33
+ Classifier: Development Status :: 3 - Alpha
34
+ Classifier: Environment :: Console
35
+ Classifier: Intended Audience :: Developers
36
+ Classifier: License :: OSI Approved :: MIT License
37
+ Classifier: Operating System :: OS Independent
38
+ Classifier: Programming Language :: Python :: 3
39
+ Classifier: Programming Language :: Python :: 3.12
40
+ Classifier: Programming Language :: Python :: 3.13
41
+ Classifier: Topic :: Database :: Front-Ends
42
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
43
+ Classifier: Topic :: Text Processing :: Indexing
44
+ Classifier: Topic :: Utilities
45
+ Requires-Python: >=3.12
46
+ Requires-Dist: click>=8.1.0
47
+ Requires-Dist: prompt-toolkit>=3.0.0
48
+ Requires-Dist: qdrant-client[fastembed]>=1.13.0
49
+ Requires-Dist: rich>=13.0.0
50
+ Description-Content-Type: text/markdown
51
+
52
+ # QQL — Qdrant Query Language
53
+
54
+ > SQL-like query language and CLI for [Qdrant](https://qdrant.tech) vector database.
55
+
56
+ [![PyPI version](https://img.shields.io/pypi/v/qql-cli?color=blue&label=PyPI)](https://pypi.org/project/qql-cli/)
57
+ [![Python 3.12+](https://img.shields.io/pypi/pyversions/qql-cli)](https://pypi.org/project/qql-cli/)
58
+ [![MIT License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
59
+ [![Tests](https://img.shields.io/badge/tests-375%20passing-brightgreen)](tests/)
60
+
61
+ Write `INSERT`, `SEARCH`, `RECOMMEND`, `DELETE`, and `CREATE COLLECTION` statements instead of Python SDK calls. Supports hybrid dense+sparse vector search, cross-encoder reranking, quantization (scalar, binary, product), SQL-style `WHERE` filters, script execution, and collection dump/restore.
62
+
63
+ ```
64
+ qql> INSERT INTO COLLECTION notes VALUES {'text': 'Qdrant is a vector database', 'author': 'alice', 'year': 2024}
65
+ ✓ Inserted 1 point [3f2e1a4b-8c91-4d0e-b123-abc123def456]
66
+
67
+ qql> SEARCH notes SIMILAR TO 'vector storage engines' LIMIT 3 WHERE year >= 2023
68
+ ✓ Found 1 result(s)
69
+ Score │ ID │ Payload
70
+ ────────┼──────────────────────────────────────┼──────────────────────────────────────
71
+ 0.8931 │ 3f2e1a4b-8c91-4d0e-b123-abc123def456 │ {'text': 'Qdrant is a ...', 'author': 'alice', 'year': 2024}
72
+
73
+ qql> SEARCH notes SIMILAR TO 'vector databases' LIMIT 5 USING HYBRID RERANK
74
+ ✓ Found 1 result(s) (hybrid, reranked)
75
+ Score │ ID │ Payload
76
+ ────────┼──────────────────────────────────────┼──────────────────────────────────────
77
+ 5.3754 │ 3f2e1a4b-8c91-4d0e-b123-abc123def456 │ {'text': 'Qdrant is a ...', 'author': 'alice', 'year': 2024}
78
+ ```
79
+
80
+ ---
81
+
82
+ ## How It Works
83
+
84
+ QQL is a thin translation layer between a SQL-like query language and the Qdrant Python client. Every statement you type goes through three stages:
85
+
86
+ ```
87
+ Your query string
88
+
89
+
90
+ [ Lexer ] — tokenizes the input into keywords, identifiers, literals
91
+
92
+
93
+ [ Parser ] — builds a typed AST node (e.g. InsertStmt, SearchStmt)
94
+
95
+
96
+ [ Executor ] — maps the AST node to a Qdrant client call
97
+
98
+
99
+ Qdrant instance
100
+ ```
101
+
102
+ When you run `INSERT`, the `text` field is automatically converted into a dense vector using [Fastembed](https://github.com/qdrant/fastembed). In **hybrid mode** (`USING HYBRID`), a sparse BM25 vector is also generated alongside the dense vector, and searches use Qdrant's Reciprocal Rank Fusion (RRF) to merge the results of both retrieval methods.
103
+
104
+ ---
105
+
106
+ ## Installation
107
+
108
+ **Requirements:** Python 3.12+, a running Qdrant instance.
109
+
110
+ ```bash
111
+ pip install qql-cli
112
+ ```
113
+
114
+ Connect to a Qdrant instance:
115
+
116
+ ```bash
117
+ # Local
118
+ qql connect --url http://localhost:6333
119
+
120
+ # Qdrant Cloud
121
+ qql connect --url https://<your-cluster>.qdrant.io --secret <your-api-key>
122
+ ```
123
+
124
+ Then type `qql` to open the interactive shell.
125
+
126
+ ---
127
+
128
+ ## Documentation
129
+
130
+ Full documentation lives in the [`docs/`](docs/) folder and at **[pavanjava.github.io/qql](https://pavanjava.github.io/qql)**:
131
+
132
+ | Topic | Description |
133
+ |---|---|
134
+ | [Getting Started](docs/getting-started.md) | Installation, connecting, first queries |
135
+ | [INSERT / INSERT BULK](docs/insert.md) | Adding documents, batch inserts, payload types |
136
+ | [SEARCH / RECOMMEND / Hybrid / RERANK](docs/search.md) | Semantic search, hybrid, reranking, recommendations |
137
+ | [WHERE Filters](docs/filters.md) | Full SQL-style filter operators |
138
+ | [Collections & Quantization](docs/collections.md) | CREATE, DROP, QUANTIZE (scalar/binary/product), CREATE INDEX |
139
+ | [Scripts: EXECUTE / DUMP](docs/scripts.md) | Script files, collection backup/restore |
140
+ | [Programmatic Usage](docs/programmatic.md) | Use QQL as a Python library |
141
+ | [Reference: Models / Config / Errors](docs/reference.md) | Embedding models, config file, error reference |
142
+
143
+ ---
144
+
145
+ ## Quick Syntax Reference
146
+
147
+ ```sql
148
+ -- Insert
149
+ INSERT INTO COLLECTION articles VALUES {'text': '...', 'year': 2024}
150
+ INSERT BULK INTO COLLECTION articles VALUES [{'text': '...'}, {'text': '...'}]
151
+
152
+ -- Search
153
+ SEARCH articles SIMILAR TO 'query' LIMIT 10
154
+ SEARCH articles SIMILAR TO 'query' LIMIT 10 WHERE year >= 2020
155
+ SEARCH articles SIMILAR TO 'query' LIMIT 10 USING HYBRID
156
+ SEARCH articles SIMILAR TO 'query' LIMIT 10 USING HYBRID RERANK
157
+
158
+ -- Recommend
159
+ RECOMMEND FROM articles POSITIVE IDS (1001, 1002) LIMIT 5
160
+
161
+ -- Collections
162
+ CREATE COLLECTION articles
163
+ CREATE COLLECTION articles HYBRID
164
+ CREATE COLLECTION articles QUANTIZE SCALAR
165
+ CREATE INDEX ON COLLECTION articles FOR year TYPE integer
166
+ SHOW COLLECTIONS
167
+ DROP COLLECTION articles
168
+
169
+ -- Delete
170
+ DELETE FROM articles WHERE id = '3f2e1a4b-...'
171
+ DELETE FROM articles WHERE year < 2020
172
+
173
+ -- Scripts
174
+ EXECUTE /path/to/script.qql
175
+ DUMP articles /path/to/backup.qql
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Running Tests
181
+
182
+ Tests do not require a running Qdrant instance — the Qdrant client is mocked.
183
+
184
+ ```bash
185
+ pytest tests/ -v
186
+ ```
187
+
188
+ Expected: **375 tests passing**.
189
+
190
+ ---
191
+
192
+ ## License
193
+
194
+ MIT © [Kameshwara Pavan Kumar Mantha](https://github.com/pavanjava)
@@ -0,0 +1,143 @@
1
+ # QQL — Qdrant Query Language
2
+
3
+ > SQL-like query language and CLI for [Qdrant](https://qdrant.tech) vector database.
4
+
5
+ [![PyPI version](https://img.shields.io/pypi/v/qql-cli?color=blue&label=PyPI)](https://pypi.org/project/qql-cli/)
6
+ [![Python 3.12+](https://img.shields.io/pypi/pyversions/qql-cli)](https://pypi.org/project/qql-cli/)
7
+ [![MIT License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
8
+ [![Tests](https://img.shields.io/badge/tests-375%20passing-brightgreen)](tests/)
9
+
10
+ Write `INSERT`, `SEARCH`, `RECOMMEND`, `DELETE`, and `CREATE COLLECTION` statements instead of Python SDK calls. Supports hybrid dense+sparse vector search, cross-encoder reranking, quantization (scalar, binary, product), SQL-style `WHERE` filters, script execution, and collection dump/restore.
11
+
12
+ ```
13
+ qql> INSERT INTO COLLECTION notes VALUES {'text': 'Qdrant is a vector database', 'author': 'alice', 'year': 2024}
14
+ ✓ Inserted 1 point [3f2e1a4b-8c91-4d0e-b123-abc123def456]
15
+
16
+ qql> SEARCH notes SIMILAR TO 'vector storage engines' LIMIT 3 WHERE year >= 2023
17
+ ✓ Found 1 result(s)
18
+ Score │ ID │ Payload
19
+ ────────┼──────────────────────────────────────┼──────────────────────────────────────
20
+ 0.8931 │ 3f2e1a4b-8c91-4d0e-b123-abc123def456 │ {'text': 'Qdrant is a ...', 'author': 'alice', 'year': 2024}
21
+
22
+ qql> SEARCH notes SIMILAR TO 'vector databases' LIMIT 5 USING HYBRID RERANK
23
+ ✓ Found 1 result(s) (hybrid, reranked)
24
+ Score │ ID │ Payload
25
+ ────────┼──────────────────────────────────────┼──────────────────────────────────────
26
+ 5.3754 │ 3f2e1a4b-8c91-4d0e-b123-abc123def456 │ {'text': 'Qdrant is a ...', 'author': 'alice', 'year': 2024}
27
+ ```
28
+
29
+ ---
30
+
31
+ ## How It Works
32
+
33
+ QQL is a thin translation layer between a SQL-like query language and the Qdrant Python client. Every statement you type goes through three stages:
34
+
35
+ ```
36
+ Your query string
37
+
38
+
39
+ [ Lexer ] — tokenizes the input into keywords, identifiers, literals
40
+
41
+
42
+ [ Parser ] — builds a typed AST node (e.g. InsertStmt, SearchStmt)
43
+
44
+
45
+ [ Executor ] — maps the AST node to a Qdrant client call
46
+
47
+
48
+ Qdrant instance
49
+ ```
50
+
51
+ When you run `INSERT`, the `text` field is automatically converted into a dense vector using [Fastembed](https://github.com/qdrant/fastembed). In **hybrid mode** (`USING HYBRID`), a sparse BM25 vector is also generated alongside the dense vector, and searches use Qdrant's Reciprocal Rank Fusion (RRF) to merge the results of both retrieval methods.
52
+
53
+ ---
54
+
55
+ ## Installation
56
+
57
+ **Requirements:** Python 3.12+, a running Qdrant instance.
58
+
59
+ ```bash
60
+ pip install qql-cli
61
+ ```
62
+
63
+ Connect to a Qdrant instance:
64
+
65
+ ```bash
66
+ # Local
67
+ qql connect --url http://localhost:6333
68
+
69
+ # Qdrant Cloud
70
+ qql connect --url https://<your-cluster>.qdrant.io --secret <your-api-key>
71
+ ```
72
+
73
+ Then type `qql` to open the interactive shell.
74
+
75
+ ---
76
+
77
+ ## Documentation
78
+
79
+ Full documentation lives in the [`docs/`](docs/) folder and at **[pavanjava.github.io/qql](https://pavanjava.github.io/qql)**:
80
+
81
+ | Topic | Description |
82
+ |---|---|
83
+ | [Getting Started](docs/getting-started.md) | Installation, connecting, first queries |
84
+ | [INSERT / INSERT BULK](docs/insert.md) | Adding documents, batch inserts, payload types |
85
+ | [SEARCH / RECOMMEND / Hybrid / RERANK](docs/search.md) | Semantic search, hybrid, reranking, recommendations |
86
+ | [WHERE Filters](docs/filters.md) | Full SQL-style filter operators |
87
+ | [Collections & Quantization](docs/collections.md) | CREATE, DROP, QUANTIZE (scalar/binary/product), CREATE INDEX |
88
+ | [Scripts: EXECUTE / DUMP](docs/scripts.md) | Script files, collection backup/restore |
89
+ | [Programmatic Usage](docs/programmatic.md) | Use QQL as a Python library |
90
+ | [Reference: Models / Config / Errors](docs/reference.md) | Embedding models, config file, error reference |
91
+
92
+ ---
93
+
94
+ ## Quick Syntax Reference
95
+
96
+ ```sql
97
+ -- Insert
98
+ INSERT INTO COLLECTION articles VALUES {'text': '...', 'year': 2024}
99
+ INSERT BULK INTO COLLECTION articles VALUES [{'text': '...'}, {'text': '...'}]
100
+
101
+ -- Search
102
+ SEARCH articles SIMILAR TO 'query' LIMIT 10
103
+ SEARCH articles SIMILAR TO 'query' LIMIT 10 WHERE year >= 2020
104
+ SEARCH articles SIMILAR TO 'query' LIMIT 10 USING HYBRID
105
+ SEARCH articles SIMILAR TO 'query' LIMIT 10 USING HYBRID RERANK
106
+
107
+ -- Recommend
108
+ RECOMMEND FROM articles POSITIVE IDS (1001, 1002) LIMIT 5
109
+
110
+ -- Collections
111
+ CREATE COLLECTION articles
112
+ CREATE COLLECTION articles HYBRID
113
+ CREATE COLLECTION articles QUANTIZE SCALAR
114
+ CREATE INDEX ON COLLECTION articles FOR year TYPE integer
115
+ SHOW COLLECTIONS
116
+ DROP COLLECTION articles
117
+
118
+ -- Delete
119
+ DELETE FROM articles WHERE id = '3f2e1a4b-...'
120
+ DELETE FROM articles WHERE year < 2020
121
+
122
+ -- Scripts
123
+ EXECUTE /path/to/script.qql
124
+ DUMP articles /path/to/backup.qql
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Running Tests
130
+
131
+ Tests do not require a running Qdrant instance — the Qdrant client is mocked.
132
+
133
+ ```bash
134
+ pytest tests/ -v
135
+ ```
136
+
137
+ Expected: **375 tests passing**.
138
+
139
+ ---
140
+
141
+ ## License
142
+
143
+ MIT © [Kameshwara Pavan Kumar Mantha](https://github.com/pavanjava)
@@ -0,0 +1,10 @@
1
+ theme: minima
2
+ title: "QQL — Qdrant Query Language"
3
+ description: "SQL-like query language and CLI for Qdrant vector database — INSERT, SEARCH, hybrid search, reranking, quantization, and more."
4
+ url: "https://pavanjava.github.io/qql"
5
+ baseurl: "/qql"
6
+ repository: "pavanjava/qql"
7
+
8
+ # Disable Jekyll processing of the HTML file (it has its own styling)
9
+ include:
10
+ - index.html
@@ -0,0 +1,216 @@
1
+ # Managing Collections
2
+
3
+ ---
4
+
5
+ ## SHOW COLLECTIONS — list collections
6
+
7
+ Lists all collections in the connected Qdrant instance.
8
+
9
+ ```sql
10
+ SHOW COLLECTIONS
11
+ ```
12
+
13
+ **Output:**
14
+ ```
15
+ ✓ 3 collection(s) found
16
+ ┌──────────────────┐
17
+ │ Collection │
18
+ ├──────────────────┤
19
+ │ articles │
20
+ │ notes │
21
+ │ products │
22
+ └──────────────────┘
23
+ ```
24
+
25
+ ---
26
+
27
+ ## CREATE COLLECTION — create a collection
28
+
29
+ Explicitly creates a new empty collection. Collections are also created automatically on the first INSERT, so this command is optional — use it when you want to pre-create a collection before inserting data.
30
+
31
+ **Syntax:**
32
+ ```
33
+ CREATE COLLECTION <collection_name>
34
+ CREATE COLLECTION <collection_name> HYBRID
35
+ CREATE COLLECTION <collection_name> USING MODEL '<model_name>'
36
+ CREATE COLLECTION <collection_name> USING HYBRID
37
+ CREATE COLLECTION <collection_name> USING HYBRID DENSE MODEL '<model>'
38
+ ```
39
+
40
+ Any of the above forms can be followed by an optional `QUANTIZE` clause — see [Quantization](#quantization--quantize-clause) below.
41
+
42
+ **Examples:**
43
+
44
+ Dense-only collection (standard, uses default model dimensions):
45
+ ```sql
46
+ CREATE COLLECTION research_papers
47
+ ```
48
+
49
+ Dense-only collection pinned to a specific model (768-dimensional):
50
+ ```sql
51
+ CREATE COLLECTION research_papers USING MODEL 'BAAI/bge-base-en-v1.5'
52
+ ```
53
+
54
+ Hybrid collection (dense + sparse BM25, default models):
55
+ ```sql
56
+ CREATE COLLECTION research_papers HYBRID
57
+ ```
58
+
59
+ Hybrid collection with a custom dense model:
60
+ ```sql
61
+ CREATE COLLECTION research_papers USING HYBRID DENSE MODEL 'BAAI/bge-base-en-v1.5'
62
+ ```
63
+
64
+ When `USING MODEL` is omitted, the collection uses the **default embedding model's dimensions** (384 for `all-MiniLM-L6-v2`). If the collection already exists, the command succeeds with a message and does nothing.
65
+
66
+ ---
67
+
68
+ ## Quantization — QUANTIZE clause
69
+
70
+ Quantization reduces the memory footprint of vector collections and speeds up search at the cost of a small, controllable accuracy loss. QQL supports all three Qdrant quantization strategies via an optional `QUANTIZE` clause appended to `CREATE COLLECTION`.
71
+
72
+ **Three strategies:**
73
+
74
+ | Type | Compression | Accuracy Loss | Best For |
75
+ |---|---|---|---|
76
+ | `SCALAR` | 4× (float32 → int8) | < 1% | Most collections — best balance |
77
+ | `BINARY` | 32× (float32 → 1-bit) | Higher | High-dimensional vectors (768+), speed priority |
78
+ | `PRODUCT` | 4× (configurable) | Variable | Memory-constrained deployments |
79
+
80
+ **Full syntax:**
81
+ ```
82
+ CREATE COLLECTION <name> ... QUANTIZE SCALAR [QUANTILE <0.0–1.0>] [ALWAYS RAM]
83
+ CREATE COLLECTION <name> ... QUANTIZE BINARY [ALWAYS RAM]
84
+ CREATE COLLECTION <name> ... QUANTIZE PRODUCT [ALWAYS RAM]
85
+ ```
86
+
87
+ - **`QUANTILE <float>`** — (scalar only) calibration quantile for the INT8 conversion; defaults to Qdrant's built-in default (0.99) when omitted.
88
+ - **`ALWAYS RAM`** — keep the **quantized** vectors in RAM at all times, regardless of the collection's `on_disk` setting. Improves search throughput at the cost of higher RAM usage for the compressed index. The original full-precision vectors are stored and managed independently of this flag. Supported by all three quantization types.
89
+ - **`QUANTIZE`** always appears **after** all other clauses (`HYBRID`, `USING MODEL`, etc.).
90
+ - For `PRODUCT`, the compression ratio is fixed at **4×** in this version.
91
+ - When used with `HYBRID` collections, quantization applies only to the **dense** vector.
92
+
93
+ **Examples:**
94
+
95
+ Scalar quantization (recommended default):
96
+ ```sql
97
+ CREATE COLLECTION research_papers QUANTIZE SCALAR
98
+ ```
99
+
100
+ Scalar with explicit calibration and quantized vectors pinned to RAM:
101
+ ```sql
102
+ CREATE COLLECTION research_papers QUANTIZE SCALAR QUANTILE 0.95 ALWAYS RAM
103
+ ```
104
+
105
+ Binary quantization for large high-dimensional embeddings:
106
+ ```sql
107
+ CREATE COLLECTION research_papers QUANTIZE BINARY
108
+ ```
109
+
110
+ Product quantization for maximum memory savings:
111
+ ```sql
112
+ CREATE COLLECTION research_papers QUANTIZE PRODUCT ALWAYS RAM
113
+ ```
114
+
115
+ Combined with hybrid collection:
116
+ ```sql
117
+ CREATE COLLECTION research_papers HYBRID QUANTIZE SCALAR
118
+ ```
119
+
120
+ Combined with a pinned model:
121
+ ```sql
122
+ CREATE COLLECTION research_papers USING MODEL 'BAAI/bge-base-en-v1.5' QUANTIZE SCALAR QUANTILE 0.99
123
+ ```
124
+
125
+ **Valid combinations:**
126
+
127
+ | Base form | + QUANTIZE SCALAR | + QUANTIZE BINARY | + QUANTIZE PRODUCT |
128
+ |---|---|---|---|
129
+ | `CREATE COLLECTION name` | ✓ | ✓ | ✓ |
130
+ | `... HYBRID` | ✓ | ✓ | ✓ |
131
+ | `... USING MODEL 'x'` | ✓ | ✓ | ✓ |
132
+ | `... USING HYBRID` | ✓ | ✓ | ✓ |
133
+ | `... USING HYBRID DENSE MODEL 'x'` | ✓ | ✓ | ✓ |
134
+
135
+ > INSERT and SEARCH on quantized collections work exactly the same as on non-quantized ones — no changes to INSERT or SEARCH syntax are needed.
136
+
137
+ ---
138
+
139
+ ## CREATE INDEX — create a payload index
140
+
141
+ Creates a payload index on a collection field. Payload indexes speed up `WHERE` clause filtering by allowing Qdrant to efficiently match on indexed fields.
142
+
143
+ **Syntax:**
144
+ ```
145
+ CREATE INDEX ON COLLECTION <collection_name> FOR <field_name> TYPE <schema_type>
146
+ ```
147
+
148
+ **Supported schema types:**
149
+
150
+ | Type | Description |
151
+ |---|---|
152
+ | `keyword` | Exact string match (e.g. status, category) |
153
+ | `integer` | Whole numbers |
154
+ | `float` | Decimal numbers |
155
+ | `bool` | Boolean values |
156
+ | `text` | Full-text search (enables `MATCH` operators) |
157
+ | `geo` | Geospatial coordinates |
158
+ | `datetime` | Date/time values |
159
+
160
+ **Examples:**
161
+
162
+ ```sql
163
+ CREATE INDEX ON COLLECTION articles FOR category TYPE keyword
164
+ CREATE INDEX ON COLLECTION articles FOR year TYPE integer
165
+ CREATE INDEX ON COLLECTION articles FOR title TYPE text
166
+ CREATE INDEX ON COLLECTION articles FOR meta.author TYPE keyword
167
+ ```
168
+
169
+ **Rules:**
170
+ - The collection must already exist. Raises an error otherwise.
171
+ - Indexes are idempotent — creating the same index twice succeeds silently.
172
+
173
+ ---
174
+
175
+ ## DROP COLLECTION — delete a collection
176
+
177
+ Permanently deletes a collection and **all points inside it**. This operation is irreversible.
178
+
179
+ ```sql
180
+ DROP COLLECTION old_experiments
181
+ ```
182
+
183
+ Raises an error if the collection does not exist.
184
+
185
+ ---
186
+
187
+ ## DELETE — remove points
188
+
189
+ Deletes one or more points from a collection by specific ID or by a `WHERE` filter.
190
+
191
+ **Syntax:**
192
+ ```
193
+ DELETE FROM <collection_name> WHERE id = '<point_id>'
194
+ DELETE FROM <collection_name> WHERE id = <integer_id>
195
+ DELETE FROM <collection_name> WHERE <filter>
196
+ ```
197
+
198
+ **Examples:**
199
+
200
+ ```sql
201
+ -- Delete by UUID
202
+ DELETE FROM articles WHERE id = '3f2e1a4b-8c91-4d0e-b123-abc123def456'
203
+
204
+ -- Delete by integer ID
205
+ DELETE FROM articles WHERE id = 42
206
+
207
+ -- Delete all points matching a filter
208
+ DELETE FROM articles WHERE category = 'archived'
209
+
210
+ -- Delete with a compound filter
211
+ DELETE FROM articles WHERE year < 2020 AND status = 'draft'
212
+ ```
213
+
214
+ **Notes:**
215
+ - If no points match the filter or ID, the operation succeeds silently with a count of 0.
216
+ - The collection itself must exist; deleting from a non-existent collection raises an error.