2323from pypaimon .globalindex .global_index_reader import GlobalIndexReader , FieldRef
2424from pypaimon .globalindex .global_index_result import GlobalIndexResult
2525from pypaimon .common .predicate import Predicate
26- from pypaimon .globalindex .vector_search import VectorSearch
2726from pypaimon .schema .data_types import DataField
2827
2928
@@ -44,45 +43,14 @@ def __init__(
4443
4544 def evaluate (
4645 self ,
47- predicate : Optional [Predicate ],
48- vector_search : Optional [VectorSearch ]
46+ predicate : Optional [Predicate ]
4947 ) -> Optional [GlobalIndexResult ]:
5048 compound_result : Optional [GlobalIndexResult ] = None
5149
5250 # Evaluate predicate first
5351 if predicate is not None :
5452 compound_result = self ._visit_predicate (predicate )
5553
56- # Evaluate vector search
57- if vector_search is not None :
58- field = self ._field_by_name .get (vector_search .field_name )
59- if field is None :
60- raise ValueError (f"Field not found: { vector_search .field_name } " )
61-
62- field_id = field .id
63- readers = self ._index_readers_cache .get (field_id )
64- if readers is None :
65- readers = self ._readers_function (field )
66- self ._index_readers_cache [field_id ] = readers
67-
68- # If we have a compound result from predicates, use it to filter vector search
69- if compound_result is not None :
70- vector_search = vector_search .with_include_row_ids (compound_result .results ())
71-
72- for reader in readers :
73- child_result = vector_search .visit (reader )
74- if child_result is None :
75- continue
76-
77- # AND operation
78- if compound_result is not None :
79- compound_result = compound_result .and_ (child_result )
80- else :
81- compound_result = child_result
82-
83- if compound_result .is_empty ():
84- return compound_result
85-
8654 return compound_result
8755
8856 def _visit_predicate (self , predicate : Predicate ) -> Optional [GlobalIndexResult ]:
@@ -141,7 +109,7 @@ def _visit_leaf_predicate(self, predicate: Predicate) -> Optional[GlobalIndexRes
141109 continue
142110
143111 if compound_result is not None :
144- compound_result = compound_result .and_ (child_result )
112+ compound_result = compound_result .or_ (child_result )
145113 else :
146114 compound_result = child_result
147115
0 commit comments