Wire fast-field sorting via tique's new interface
Now it should be easy to add support for reversing the order when sorting by a fast-field. For reversing the relevance (default) ordering I'll need to implement functionality to modify the score (as opposed to just supplying one via a fast field)
- Id
- 588bad261dcc3b6b9a1844c2fe1c74612007bed6
- Author
- Caio
- Commit time
- 2020-01-09T19:37:07+01:00
Modified cantine/src/index.rs
};
use tique::top_collector::{
- ordered_by_f64_fast_field, ordered_by_u64_fast_field, CheckCondition, ConditionForSegment,
- ConditionalTopCollector, SearchMarker,
+ fastfield, CheckCondition, ConditionForSegment, ConditionalTopCollector,
+ CustomScoreTopCollector, SearchMarker,
};
#[derive(Clone)]
field: Field,
) -> Result<(usize, Vec<RecipeId>, Option<After>)> {
let condition = Paginator::new_u64(self.id, after);
- let top_collector = ordered_by_u64_fast_field(field, limit, condition);
+ let top_collector =
+ CustomScoreTopCollector::new(limit, condition, fastfield::descending::<u64>(field));
let result = searcher.search(query, &top_collector)?;
let items = self.addresses_to_ids(&searcher, &result.items)?;
field: Field,
) -> Result<(usize, Vec<RecipeId>, Option<After>)> {
let condition = Paginator::new_f64(self.id, after);
- let top_collector = ordered_by_f64_fast_field(field, limit, condition);
+ let top_collector =
+ CustomScoreTopCollector::new(limit, condition, fastfield::descending::<f64>(field));
let result = searcher.search(query, &top_collector)?;
let items = self.addresses_to_ids(&searcher, &result.items)?;