mirror of https://github.com/milvus-io/milvus.git
[skip ci]Format markdown doc for Search.md (#10639)
Signed-off-by: ruiyi.jiang <ruiyi.jiang@zilliz.com>pull/10583/head
parent
50b06f4149
commit
612f8df045
|
@ -1,12 +1,15 @@
|
||||||
# Segcore Search Design
|
# Segcore Search Design
|
||||||
|
|
||||||
init: 7.23.2021, by [FluorineDog](https://github.com/FluorineDog)
|
init: 7.23.2021, by [FluorineDog](https://github.com/FluorineDog)
|
||||||
|
|
||||||
update: 9.16.2021, by [xiaofan-luan](https://github.com/xiaofan-luan)
|
update: 9.16.2021, by [xiaofan-luan](https://github.com/xiaofan-luan)
|
||||||
|
|
||||||
## Search
|
## 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.
|
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:
|
The execution mode of Boolean Expr works as follows:
|
||||||
|
|
||||||
1. client packs search expr, topk and query vector into proto and sends to proxy node.
|
1. client packs search expr, topk and query vector into proto and sends to proxy node.
|
||||||
2. proxynode unmarshals the proto, parses it to logical plan, makes static check, and generates protobuf IR.
|
2. proxynode unmarshals the proto, parses it to logical plan, makes static check, and generates protobuf IR.
|
||||||
3. querynode unmarshals the plan, generates an executable plan AST, and queries in the segcore.
|
3. querynode unmarshals the plan, generates an executable plan AST, and queries in the segcore.
|
||||||
|
@ -14,17 +17,20 @@ The execution mode of Boolean Expr works as follows:
|
||||||
See details of expression usage at [expr_grammar.md](https://milvus.io/docs/v2.0.0/expression.md)
|
See details of expression usage at [expr_grammar.md](https://milvus.io/docs/v2.0.0/expression.md)
|
||||||
|
|
||||||
## Segcore Search Process
|
## Segcore Search Process
|
||||||
|
|
||||||
After obtaining the AST, execution engine uses the visitor mode to explain and executes the whole AST tree:
|
After obtaining the AST, execution engine uses the visitor mode to explain and executes the whole AST tree:
|
||||||
|
|
||||||
1. Each Node includes two steps, a mandatory vector search and an optional predicate.
|
1. Each Node includes two steps, a mandatory vector search and an optional predicate.
|
||||||
1. If Predicate exist, execute predicate expression stage to generate bitset as the vector search bitmask.
|
|
||||||
2. If Predicate does not exist, vector search bitmask will be empty.
|
1. If Predicate exist, execute predicate expression stage to generate bitset as the vector search bitmask.
|
||||||
3. Bitmask will be used to mark filtered out / deleted entities in the vector execution engine.
|
2. If Predicate does not exist, vector search bitmask will be empty.
|
||||||
|
3. Bitmask will be used to mark filtered out / deleted entities in the vector execution engine.
|
||||||
|
|
||||||
2. 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.
|
2. 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.
|
||||||
1. LogicalUnaryExpr: not expression
|
|
||||||
2. LogicalBinaryExpr: and or expression
|
1. LogicalUnaryExpr: not expression
|
||||||
3. TermExpr: in expression `A in [1, 2, 3]`
|
2. LogicalBinaryExpr: and or expression
|
||||||
4. CompareExpr: compare expression `A > 1` `B <= 1`
|
3. TermExpr: in expression `A in [1, 2, 3]`
|
||||||
|
4. CompareExpr: compare expression `A > 1` `B <= 1`
|
||||||
|
|
||||||
3. TermExpr and CompareExpr are leaf nodes of execution
|
3. TermExpr and CompareExpr are leaf nodes of execution
|
||||||
|
|
Loading…
Reference in New Issue