@@ -29,7 +29,7 @@ type EligibleCollector struct {
2929 took time.Duration
3030 results search.DocumentMatchCollection
3131
32- store collectorStore
32+ ids []index. IndexInternalID
3333}
3434
3535func NewEligibleCollector (size int ) * EligibleCollector {
@@ -38,13 +38,9 @@ func NewEligibleCollector(size int) *EligibleCollector {
3838
3939func newEligibleCollector (size int ) * EligibleCollector {
4040 // No sort order & skip always 0 since this is only to filter eligible docs.
41- ec := & EligibleCollector {size : size }
42-
43- // comparator is a dummy here
44- ec .store = getOptimalCollectorStore (size , 0 , func (i , j * search.DocumentMatch ) int {
45- return 0
46- })
47-
41+ ec := & EligibleCollector {size : size ,
42+ ids : make ([]index.IndexInternalID , 0 , size ),
43+ }
4844 return ec
4945}
5046
@@ -55,8 +51,13 @@ func makeEligibleDocumentMatchHandler(ctx *search.SearchContext) (search.Documen
5551 return nil
5652 }
5753
58- // No elements removed from the store here.
59- _ = ec .store .Add (d )
54+ copyOfID := make ([]byte , len (d .IndexInternalID ))
55+ copy (copyOfID , d .IndexInternalID )
56+ ec .ids = append (ec .ids , copyOfID )
57+
58+ // recycle the DocumentMatch
59+ ctx .DocumentMatchPool .Put (d )
60+
6061 return nil
6162 }, nil
6263 }
@@ -122,26 +123,15 @@ func (ec *EligibleCollector) Collect(ctx context.Context, searcher search.Search
122123 // compute search duration
123124 ec .took = time .Since (startTime )
124125
125- // finalize actual results
126- err = ec .finalizeResults (reader )
127- if err != nil {
128- return err
129- }
130126 return nil
131127}
132128
133- func (ec * EligibleCollector ) finalizeResults (r index.IndexReader ) error {
134- var err error
135- ec .results , err = ec .store .Final (0 , func (doc * search.DocumentMatch ) error {
136- // Adding the results to the store without any modifications since we don't
137- // require the external ID of the filtered hits.
138- return nil
139- })
140- return err
129+ func (ec * EligibleCollector ) Results () search.DocumentMatchCollection {
130+ return nil
141131}
142132
143- func (ec * EligibleCollector ) Results () search. DocumentMatchCollection {
144- return ec .results
133+ func (ec * EligibleCollector ) IDs () []index. IndexInternalID {
134+ return ec .ids
145135}
146136
147137func (ec * EligibleCollector ) Total () uint64 {
0 commit comments