@@ -175,12 +175,12 @@ pub trait Collector: Sync + Send {
175
175
if let Some ( alive_bitset) = reader. alive_bitset ( ) {
176
176
weight. for_each ( reader, & mut |doc, score| {
177
177
if alive_bitset. is_alive ( doc) {
178
- segment_collector. collect ( doc, score) ;
178
+ segment_collector. collect ( doc, score) . unwrap ( ) ; // TODO
179
179
}
180
180
} ) ?;
181
181
} else {
182
182
weight. for_each ( reader, & mut |doc, score| {
183
- segment_collector. collect ( doc, score) ;
183
+ segment_collector. collect ( doc, score) . unwrap ( ) ; // TODO
184
184
} ) ?;
185
185
}
186
186
Ok ( segment_collector. harvest ( ) )
@@ -190,10 +190,11 @@ pub trait Collector: Sync + Send {
190
190
impl < TSegmentCollector : SegmentCollector > SegmentCollector for Option < TSegmentCollector > {
191
191
type Fruit = Option < TSegmentCollector :: Fruit > ;
192
192
193
- fn collect ( & mut self , doc : DocId , score : Score ) {
193
+ fn collect ( & mut self , doc : DocId , score : Score ) -> crate :: Result < ( ) > {
194
194
if let Some ( segment_collector) = self {
195
- segment_collector. collect ( doc, score) ;
195
+ segment_collector. collect ( doc, score) ? ;
196
196
}
197
+ Ok ( ( ) )
197
198
}
198
199
199
200
fn harvest ( self ) -> Self :: Fruit {
@@ -253,7 +254,7 @@ pub trait SegmentCollector: 'static {
253
254
type Fruit : Fruit ;
254
255
255
256
/// The query pushes the scored document to the collector via this method.
256
- fn collect ( & mut self , doc : DocId , score : Score ) ;
257
+ fn collect ( & mut self , doc : DocId , score : Score ) -> crate :: Result < ( ) > ;
257
258
258
259
/// Extract the fruit of the collection from the `SegmentCollector`.
259
260
fn harvest ( self ) -> Self :: Fruit ;
@@ -308,9 +309,10 @@ where
308
309
{
309
310
type Fruit = ( Left :: Fruit , Right :: Fruit ) ;
310
311
311
- fn collect ( & mut self , doc : DocId , score : Score ) {
312
- self . 0 . collect ( doc, score) ;
313
- self . 1 . collect ( doc, score) ;
312
+ fn collect ( & mut self , doc : DocId , score : Score ) -> crate :: Result < ( ) > {
313
+ self . 0 . collect ( doc, score) ?;
314
+ self . 1 . collect ( doc, score) ?;
315
+ Ok ( ( ) )
314
316
}
315
317
316
318
fn harvest ( self ) -> <Self as SegmentCollector >:: Fruit {
@@ -372,10 +374,11 @@ where
372
374
{
373
375
type Fruit = ( One :: Fruit , Two :: Fruit , Three :: Fruit ) ;
374
376
375
- fn collect ( & mut self , doc : DocId , score : Score ) {
376
- self . 0 . collect ( doc, score) ;
377
- self . 1 . collect ( doc, score) ;
378
- self . 2 . collect ( doc, score) ;
377
+ fn collect ( & mut self , doc : DocId , score : Score ) -> crate :: Result < ( ) > {
378
+ self . 0 . collect ( doc, score) ?;
379
+ self . 1 . collect ( doc, score) ?;
380
+ self . 2 . collect ( doc, score) ?;
381
+ Ok ( ( ) )
379
382
}
380
383
381
384
fn harvest ( self ) -> <Self as SegmentCollector >:: Fruit {
@@ -446,11 +449,12 @@ where
446
449
{
447
450
type Fruit = ( One :: Fruit , Two :: Fruit , Three :: Fruit , Four :: Fruit ) ;
448
451
449
- fn collect ( & mut self , doc : DocId , score : Score ) {
450
- self . 0 . collect ( doc, score) ;
451
- self . 1 . collect ( doc, score) ;
452
- self . 2 . collect ( doc, score) ;
453
- self . 3 . collect ( doc, score) ;
452
+ fn collect ( & mut self , doc : DocId , score : Score ) -> crate :: Result < ( ) > {
453
+ self . 0 . collect ( doc, score) ?;
454
+ self . 1 . collect ( doc, score) ?;
455
+ self . 2 . collect ( doc, score) ?;
456
+ self . 3 . collect ( doc, score) ?;
457
+ Ok ( ( ) )
454
458
}
455
459
456
460
fn harvest ( self ) -> <Self as SegmentCollector >:: Fruit {
0 commit comments