mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 21:20:24 +01:00
Merge #548
548: Setup the new limits on the number of facet values to return r=ManyTheFish a=Kerollmops This PR implements the early draft of the new spec (waiting for it) specifying how the new facet limit feature should work and which limit we apply to the number of facet values to return by facet. Co-authored-by: Kerollmops <clement@meilisearch.com>
This commit is contained in:
commit
a762d7f462
@ -1,6 +1,6 @@
|
||||
use std::collections::{BTreeMap, HashSet};
|
||||
use std::ops::Bound::Unbounded;
|
||||
use std::{cmp, fmt, mem};
|
||||
use std::{fmt, mem};
|
||||
|
||||
use heed::types::ByteSlice;
|
||||
use roaring::RoaringBitmap;
|
||||
@ -15,11 +15,7 @@ use crate::{FieldId, Index, Result};
|
||||
|
||||
/// The default number of values by facets that will
|
||||
/// be fetched from the key-value store.
|
||||
const DEFAULT_VALUES_BY_FACET: usize = 1000;
|
||||
|
||||
/// The hard limit in the number of values by facets that will be fetched from
|
||||
/// the key-value store. Searching for more values could slow down the engine.
|
||||
const MAX_VALUES_BY_FACET: usize = 10000;
|
||||
const DEFAULT_VALUES_BY_FACET: usize = 100;
|
||||
|
||||
/// Threshold on the number of candidates that will make
|
||||
/// the system to choose between one algorithm or another.
|
||||
@ -50,7 +46,7 @@ impl<'a> FacetDistribution<'a> {
|
||||
}
|
||||
|
||||
pub fn max_values_by_facet(&mut self, max: usize) -> &mut Self {
|
||||
self.max_values_by_facet = cmp::min(max, MAX_VALUES_BY_FACET);
|
||||
self.max_values_by_facet = max;
|
||||
self
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user