mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-05 21:39:19 +08:00
746bcc8bc0
Signed-off-by: Jael Gu <mengjia.gu@zilliz.com>
1.7 KiB
1.7 KiB
Segcore Search Design
init: 7.23.2021, by FluorineDog
update: 9.16.2021, by xiaofan-luan
Search
Search now supports two modes: json DSL mode and Boolean Expr mode. We will talk about the later one in details because the former has been deprecated and is only used in test.
The execution mode of Boolean Expr works as follows:
- client packs search expr, topk and query vector into proto and sends to proxy node.
- proxynode unmarshals the proto, parses it to logical plan, makes static check, and generates protobuf IR.
- querynode unmarshals the plan, generates an executable plan AST, and queries in the segcore.
See details of expression usage at expr_grammar.md
Segcore Search Process
After obtaining the AST, execution engine uses the visitor mode to explain and executes the whole AST tree:
-
Each Node includes two steps, a mandatory vector search and an optional predicate.
- If Predicate exist, execute predicate expression stage to generate bitset as the vector search bitmask.
- If Predicate does not exist, vector search bitmask will be empty.
- Bitmask will be used to mark filtered out / deleted entities in the vector execution engine.
-
Currently, Milvus supports following node on the AST, visitor mode is used to interpret and execute from top to bottom and generate the final bitmask.
- LogicalUnaryExpr: not expression
- LogicalBinaryExpr: and or expression
- TermExpr: in expression
A in [1, 2, 3]
- CompareExpr: compare expression
A > 1
B <= 1
-
TermExpr and CompareExpr are leaf nodes of execution