Skip to content

Commit ed06a71

Browse files
Milvus-doc-botMilvus-doc-bot
authored andcommitted
Release new docs to preview
1 parent 0ff5586 commit ed06a71

3 files changed

Lines changed: 85 additions & 24 deletions

File tree

v3.0.x/site/en/userGuide/schema/timestamptz-field.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ print(f"Collection '{collection_name}' loaded successfully.")
211211

212212
#### Query with timestamp filtering
213213

214-
Use arithmetic operators like `==`, `!=`, `<`, `>`, `<=`, `>=`. For a full list of arithmetic operators available in Milvus, refer to [Arithmetic Operators](basic-operators.md#Arithmetic-Operators).
214+
Use arithmetic operators like `==`, `!=`, `<`, `>`, `<=`, `>=`. For a full list of arithmetic operators available in Milvus, refer to [Arithmetic operators](basic-operators.md#Arithmetic-operators).
215215

216216
The example below filters entities with timestamps (`tsz`) that are not equal to **2025-01-03T00:00:00+08:00**:
217217

@@ -434,4 +434,4 @@ For step-by-step instructions and code samples, refer to the dedicated pages:
434434

435435
By default, queries on `TIMESTAMPTZ` fields without an index will perform a full scan of all rows, which can be slow on large datasets. To accelerate timestamp queries, create an `STL_SORT` index on your `TIMESTAMPTZ` field.
436436

437-
For details, refer to [STL_SORT](stl-sort.md).
437+
For details, refer to [STL_SORT](stl-sort.md).

v3.0.x/site/en/userGuide/search-query-get/boolean/basic-operators.md

Lines changed: 72 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Milvus provides a rich set of basic operators to help you filter and query data
1212

1313
Comparison operators are used to filter data based on equality, inequality, or size. They are applicable to numeric and text fields.
1414

15-
### Supported Comparison Operators:
15+
### Supported comparison operators
1616

1717
- `==` (Equal to)
1818

@@ -26,47 +26,47 @@ Comparison operators are used to filter data based on equality, inequality, or s
2626

2727
- `<=` (Less than or equal to)
2828

29-
### Example 1: Filtering with Equal To (`==`)
29+
### Example 1: Filtering with equal to (`==`)
3030

3131
Assume you have a field named `status` and you want to find all entities where `status` is "active". You can use the equality operator `==`:
3232

3333
```python
3434
filter = 'status == "active"'
3535
```
3636

37-
### Example 2: Filtering with Not Equal To (`!=`)
37+
### Example 2: Filtering with not equal to (`!=`)
3838

3939
To find entities where `status` is not "inactive":
4040

4141
```python
4242
filter = 'status != "inactive"'
4343
```
4444

45-
### Example 3: Filtering with Greater Than (`>`)
45+
### Example 3: Filtering with greater than (`>`)
4646

4747
If you want to find all entities with an `age` greater than 30:
4848

4949
```python
5050
filter = 'age > 30'
5151
```
5252

53-
### Example 4: Filtering with Less Than
53+
### Example 4: Filtering with less than
5454

5555
To find entities where `price` is less than 100:
5656

5757
```python
5858
filter = 'price < 100'
5959
```
6060

61-
### Example 5: Filtering with Greater Than or Equal To (`>=`)
61+
### Example 5: Filtering with greater than or equal to (`>=`)
6262

6363
If you want to find all entities with `rating` greater than or equal to 4:
6464

6565
```python
6666
filter = 'rating >= 4'
6767
```
6868

69-
### Example 6: Filtering with Less Than or Equal To
69+
### Example 6: Filtering with less than or equal to
7070

7171
To find entities with `discount` less than or equal to 10%:
7272

@@ -116,11 +116,11 @@ filter = 'message !~ "^DEBUG"'
116116

117117
For more details about choosing between `LIKE` and regex, supported field types, regex syntax, escaping rules, and performance, refer to [Pattern Matching](pattern-matching.md). Milvus also allows you to build an `NGRAM` index on `VARCHAR` fields or JSON string paths to accelerate eligible pattern matching filters. For details, refer to [NGRAM](ngram.md).
118118

119-
## Arithmetic Operators
119+
## Arithmetic operators
120120

121121
Arithmetic operators allow you to create conditions based on calculations involving numeric fields.
122122

123-
### Supported Arithmetic Operators:
123+
### Supported arithmetic operators
124124

125125
- `+` (Addition)
126126

@@ -134,59 +134,110 @@ Arithmetic operators allow you to create conditions based on calculations involv
134134

135135
- `**` (Exponentiation)
136136

137-
### Example 1: Using Modulus (`%`)
137+
### Example 1: Using modulus (`%`)
138138

139139
To find entities where the `id` is an even number (i.e., divisible by 2):
140140

141141
```python
142142
filter = 'id % 2 == 0'
143143
```
144144

145-
### Example 2: Using Exponentiation (`**`)
145+
### Example 2: Using exponentiation (`**`)
146146

147147
To find entities where `price` raised to the power of 2 is greater than 1000:
148148

149149
```python
150150
filter = 'price ** 2 > 1000'
151151
```
152152

153-
## Logical Operators
153+
## Bitwise operators | Milvus 3.0.0+
154+
155+
Bitwise operators are useful when an integer field encodes multiple flags, such as permissions, feature flags, or status bits. You can use these operators in filter expressions to check, combine, or compare individual bits in an integer value.
156+
157+
For scalar fields, bitwise operators apply to integer field types, such as `INT8`, `INT16`, `INT32`, and `INT64`.
158+
159+
### Supported bitwise operators
160+
161+
| Operator | Name | Typical use |
162+
| --- | --- | --- |
163+
| `&` | Bitwise AND | Check whether specific bits are set. |
164+
| <code>&#124;</code> | Bitwise OR | Combine bits before comparison. |
165+
| `^` | Bitwise XOR | Compare bit differences between two values. |
166+
167+
### Example: Filtering by permission bits
168+
169+
Assume you have an integer field named `permissions`, and each bit in the integer represents a permission flag:
170+
171+
| Permission flag | Bit value |
172+
| --- | --- |
173+
| `READ` | `1` |
174+
| `WRITE` | `2` |
175+
| `SHARE` | `4` |
176+
| `ADMIN` | `8` |
177+
178+
For example, `permissions = 5` means that the `READ` and `SHARE` bits are set, because `5 = 1 + 4`.
179+
180+
To find entities where the `SHARE` bit is set, use bitwise AND (`&`):
181+
182+
```python
183+
filter = "(permissions & 4) == 4"
184+
```
185+
186+
To find entities where setting the `WRITE` bit produces the `READ + WRITE + SHARE` permission set, use bitwise OR (`|`):
187+
188+
```python
189+
filter = "(permissions | 2) == 7"
190+
```
191+
192+
To find entities whose permission bits differ from `READ + WRITE + SHARE` by only the `WRITE` bit, use bitwise XOR (`^`):
193+
194+
```python
195+
filter = "(permissions ^ 7) == 2"
196+
```
197+
198+
<div class="alert note">
199+
200+
Always wrap the bitwise operation in parentheses before comparing the result, such as `(permissions & 4) == 4`. Milvus 3.0.0 supports `&`, `|`, and `^` in filter expressions. Bitwise NOT (`~`) and shift operators (`<<` and `>>`) are not supported.
201+
202+
</div>
203+
204+
## Logical operators
154205

155206
Logical operators are used to combine multiple conditions into a more complex filter expression. These include `AND`, `OR`, and `NOT`.
156207

157-
### Supported Logical Operators:
208+
### Supported logical operators
158209

159210
- `AND`: Combines multiple conditions that must all be true.
160211

161212
- `OR`: Combines conditions where at least one must be true.
162213

163214
- `NOT`: Negates a condition.
164215

165-
### Example 1: Using `AND` to Combine Conditions
216+
### Example 1: Using `AND` to combine conditions
166217

167218
To find all products where `price` is greater than 100 and `stock` is greater than 50:
168219

169220
```python
170221
filter = 'price > 100 AND stock > 50'
171222
```
172223

173-
### Example 2: Using `OR` to Combine Conditions
224+
### Example 2: Using `OR` to combine conditions
174225

175226
To find all products where `color` is either "red" or "blue":
176227

177228
```python
178229
filter = 'color == "red" OR color == "blue"'
179230
```
180231

181-
### Example 3: Using `NOT` to Exclude a Condition
232+
### Example 3: Using `NOT` to exclude a condition
182233

183234
To find all products where `color` is not "green":
184235

185236
```python
186237
filter = 'NOT color == "green"'
187238
```
188239

189-
## IS NULL and IS NOT NULL Operators
240+
## IS NULL and IS NOT NULL operators
190241

191242
The `IS NULL` and `IS NOT NULL` operators are used to filter fields based on whether they contain a null value (absence of data).
192243

@@ -200,7 +251,7 @@ The operators are case-insensitive, so you can use `IS NULL` or `is null`, and `
200251

201252
</div>
202253

203-
### Regular Scalar Fields with Null Values
254+
### Regular scalar fields with null values
204255

205256
Milvus allows filtering on regular scalar fields, such as strings or numbers, with null values.
206257

@@ -228,7 +279,7 @@ To retrieve entities where the `description` field is not null and the `price` f
228279
filter = 'description IS NOT NULL AND price > 10'
229280
```
230281

231-
### JSON Fields with Null Values
282+
### JSON fields with null values
232283

233284
Milvus allows filtering on JSON fields that contain null values. A JSON field is treated as null in the following ways:
234285

@@ -296,7 +347,7 @@ filter = 'metadata IS NOT NULL'
296347
# ]
297348
```
298349

299-
### ARRAY Fields with Null Values
350+
### ARRAY fields with null values
300351

301352
Milvus allows filtering on ARRAY fields that contain null values. An ARRAY field is treated as null in the following ways:
302353

@@ -362,7 +413,7 @@ filter = 'tags IS NOT NULL'
362413
# ]
363414
```
364415

365-
## Tips on Using Basic Operators with JSON and ARRAY Fields
416+
## Tips on using basic operators with JSON and ARRAY fields
366417

367418
While the basic operators in Milvus are versatile and can be applied to scalar fields, they can also be effectively used with the keys and indexes in the JSON and ARRAY fields.
368419

v3.0.x/site/en/userGuide/search-query-get/boolean/boolean.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ Milvus supports several basic operators for filtering data:
1818

1919
- **Arithmetic Operators**: `+`, `-`, `*`, `/`, `%`, and `**` are used for calculations involving numeric fields.
2020

21+
- **Bitwise Operators**: In Milvus 3.0.0 and later, `&`, `|`, and `^` filter integer fields that encode multiple flags, such as permissions or status bits. For details, refer to [Basic Operators](basic-operators.md#Bitwise-operators).
22+
2123
- **Logical Operators**: `AND`, `OR`, and `NOT` combine multiple conditions into complex expressions.
2224

23-
- **IS NULL and IS NOT NULL Operators**: The `IS NULL` and `IS NOT NULL` operators are used to filter fields based on whether they contain a null value (absence of data). For details, refer to [Basic Operators](basic-operators.md#IS-NULL-and-IS-NOT-NULL-Operators).
25+
- **IS NULL and IS NOT NULL Operators**: The `IS NULL` and `IS NOT NULL` operators are used to filter fields based on whether they contain a null value (absence of data). For details, refer to [Basic Operators](basic-operators.md#IS-NULL-and-IS-NOT-NULL-operators).
2426

2527
### Example: Filtering by Color
2628

@@ -30,6 +32,14 @@ To find entities with primary colors (red, green, or blue) in a scalar field `co
3032
filter='color in ["red", "green", "blue"]'
3133
```
3234

35+
### Example: Filtering by Permission Bits
36+
37+
To find entities whose integer `permissions` field has the `SHARE` bit set, use the bitwise AND operator (`&`):
38+
39+
```python
40+
filter='(permissions & 4) == 4'
41+
```
42+
3343
### Example: Filtering by Regex Pattern
3444

3545
To find entities whose `message` field contains an error code such as `E1001`, use the regex match operator `=~`:

0 commit comments

Comments
 (0)