@@ 976-988 (lines=13) @@ | ||
973 | assert len(res[0]) == top_k |
|
974 | # TODO: |
|
975 | ||
976 | @pytest.mark.level(2) |
|
977 | def test_query_term_values_repeat(self, connect, collection): |
|
978 | ''' |
|
979 | method: build query with vector and term expr, with the same values |
|
980 | expected: filter pass |
|
981 | ''' |
|
982 | entities, ids = init_data(connect, collection) |
|
983 | expr = { |
|
984 | "must": [gen_default_vector_expr(default_query), gen_default_term_expr(values=[1 for i in range(1, nb)])]} |
|
985 | query = update_query_expr(default_query, expr=expr) |
|
986 | res = connect.search(collection, query) |
|
987 | assert len(res) == nq |
|
988 | assert len(res[0]) == 1 |
|
989 | # TODO: |
|
990 | ||
991 | def test_query_term_value_empty(self, connect, collection): |
|
@@ 934-946 (lines=13) @@ | ||
931 | assert len(res[0]) == 1 |
|
932 | # TODO: |
|
933 | ||
934 | @pytest.mark.level(2) |
|
935 | def test_query_term_values_not_in(self, connect, collection): |
|
936 | ''' |
|
937 | method: build query with vector and term expr, with no term can be filtered |
|
938 | expected: filter pass |
|
939 | ''' |
|
940 | entities, ids = init_data(connect, collection) |
|
941 | expr = {"must": [gen_default_vector_expr(default_query), |
|
942 | gen_default_term_expr(values=[i for i in range(100000, 100010)])]} |
|
943 | query = update_query_expr(default_query, expr=expr) |
|
944 | res = connect.search(collection, query) |
|
945 | assert len(res) == nq |
|
946 | assert len(res[0]) == 0 |
|
947 | # TODO: |
|
948 | ||
949 | def test_query_term_values_all_in(self, connect, collection): |
|
@@ 962-973 (lines=12) @@ | ||
959 | assert len(res[0]) == top_k |
|
960 | # TODO: |
|
961 | ||
962 | def test_query_term_values_parts_in(self, connect, collection): |
|
963 | ''' |
|
964 | method: build query with vector and term expr, with parts of term can be filtered |
|
965 | expected: filter pass |
|
966 | ''' |
|
967 | entities, ids = init_data(connect, collection) |
|
968 | expr = {"must": [gen_default_vector_expr(default_query), |
|
969 | gen_default_term_expr(values=[i for i in range(nb // 2, nb + nb // 2)])]} |
|
970 | query = update_query_expr(default_query, expr=expr) |
|
971 | res = connect.search(collection, query) |
|
972 | assert len(res) == nq |
|
973 | assert len(res[0]) == top_k |
|
974 | # TODO: |
|
975 | ||
976 | @pytest.mark.level(2) |