mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-01-29 22:43:09 +08:00
Apply suggestions from code review
Co-authored-by: Tamo <tamo@meilisearch.com>
This commit is contained in:
parent
bd15f5625a
commit
392472f4bb
@ -170,7 +170,7 @@ fn ws<'a, O>(inner: impl FnMut(Span<'a>) -> IResult<O>) -> impl FnMut(Span<'a>)
|
|||||||
delimited(multispace0, inner, multispace0)
|
delimited(multispace0, inner, multispace0)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// or = and ("OR" and)
|
/// or = and ("OR" and)*
|
||||||
fn parse_or(input: Span) -> IResult<FilterCondition> {
|
fn parse_or(input: Span) -> IResult<FilterCondition> {
|
||||||
let (input, lhs) = parse_and(input)?;
|
let (input, lhs) = parse_and(input)?;
|
||||||
// if we found a `OR` then we MUST find something next
|
// if we found a `OR` then we MUST find something next
|
||||||
@ -200,7 +200,7 @@ fn parse_not(input: Span) -> IResult<FilterCondition> {
|
|||||||
alt((map(preceded(tag("NOT"), cut(parse_not)), |e| e.negate()), parse_primary))(input)
|
alt((map(preceded(tag("NOT"), cut(parse_not)), |e| e.negate()), parse_primary))(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// geoRadius = WS* "_geoRadius(float "," float "," float)
|
/// geoRadius = WS* "_geoRadius(float WS* "," WS* float WS* "," WS* float)
|
||||||
/// If we parse `_geoRadius` we MUST parse the rest of the expression.
|
/// If we parse `_geoRadius` we MUST parse the rest of the expression.
|
||||||
fn parse_geo_radius(input: Span) -> IResult<FilterCondition> {
|
fn parse_geo_radius(input: Span) -> IResult<FilterCondition> {
|
||||||
// we want to forbid space BEFORE the _geoRadius but not after
|
// we want to forbid space BEFORE the _geoRadius but not after
|
||||||
@ -224,7 +224,7 @@ fn parse_geo_radius(input: Span) -> IResult<FilterCondition> {
|
|||||||
Ok((input, res))
|
Ok((input, res))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// geoPoint = WS* "_geoPoint(float "," float "," float)
|
/// geoPoint = WS* "_geoPoint(float WS* "," WS* float WS* "," WS* float)
|
||||||
fn parse_geo_point(input: Span) -> IResult<FilterCondition> {
|
fn parse_geo_point(input: Span) -> IResult<FilterCondition> {
|
||||||
// we want to forbid space BEFORE the _geoPoint but not after
|
// we want to forbid space BEFORE the _geoPoint but not after
|
||||||
tuple((
|
tuple((
|
||||||
|
@ -551,7 +551,7 @@ fn biggest_value_sizes(index: &Index, rtxn: &heed::RoTxn, limit: usize) -> anyho
|
|||||||
let db = facet_id_exists_docids.remap_data_type::<ByteSlice>();
|
let db = facet_id_exists_docids.remap_data_type::<ByteSlice>();
|
||||||
for result in facet_values_iter(rtxn, db, facet_id)? {
|
for result in facet_values_iter(rtxn, db, facet_id)? {
|
||||||
let (_fid, value) = result?;
|
let (_fid, value) = result?;
|
||||||
let key = format!("{}", facet_name);
|
let key = facet_name.to_string();
|
||||||
heap.push(Reverse((value.len(), key, facet_id_exists_docids_name)));
|
heap.push(Reverse((value.len(), key, facet_id_exists_docids_name)));
|
||||||
if heap.len() > limit {
|
if heap.len() > limit {
|
||||||
heap.pop();
|
heap.pop();
|
||||||
|
@ -156,8 +156,7 @@ impl Index {
|
|||||||
let word_prefix_position_docids = env.create_database(Some(WORD_PREFIX_POSITION_DOCIDS))?;
|
let word_prefix_position_docids = env.create_database(Some(WORD_PREFIX_POSITION_DOCIDS))?;
|
||||||
let facet_id_f64_docids = env.create_database(Some(FACET_ID_F64_DOCIDS))?;
|
let facet_id_f64_docids = env.create_database(Some(FACET_ID_F64_DOCIDS))?;
|
||||||
let facet_id_string_docids = env.create_database(Some(FACET_ID_STRING_DOCIDS))?;
|
let facet_id_string_docids = env.create_database(Some(FACET_ID_STRING_DOCIDS))?;
|
||||||
let facet_id_exists_docids: Database<FieldIdCodec, CboRoaringBitmapCodec> =
|
let facet_id_exists_docids = env.create_database(Some(FACET_ID_EXISTS_DOCIDS))?;
|
||||||
env.create_database(Some(FACET_ID_EXISTS_DOCIDS))?;
|
|
||||||
|
|
||||||
let field_id_docid_facet_f64s = env.create_database(Some(FIELD_ID_DOCID_FACET_F64S))?;
|
let field_id_docid_facet_f64s = env.create_database(Some(FIELD_ID_DOCID_FACET_F64S))?;
|
||||||
let field_id_docid_facet_strings =
|
let field_id_docid_facet_strings =
|
||||||
|
@ -32,9 +32,7 @@ pub fn extract_facet_exists_docids<R: io::Read + io::Seek>(
|
|||||||
let mut cursor = docid_fid_facet_number.into_cursor()?;
|
let mut cursor = docid_fid_facet_number.into_cursor()?;
|
||||||
while let Some((key_bytes, _)) = cursor.move_on_next()? {
|
while let Some((key_bytes, _)) = cursor.move_on_next()? {
|
||||||
let (field_id, document_id) = FieldIdDocIdCodec::bytes_decode(key_bytes).unwrap();
|
let (field_id, document_id) = FieldIdDocIdCodec::bytes_decode(key_bytes).unwrap();
|
||||||
|
|
||||||
let key_bytes = FieldIdCodec::bytes_encode(&field_id).unwrap();
|
let key_bytes = FieldIdCodec::bytes_encode(&field_id).unwrap();
|
||||||
|
|
||||||
facet_exists_docids_sorter.insert(key_bytes, document_id.to_ne_bytes())?;
|
facet_exists_docids_sorter.insert(key_bytes, document_id.to_ne_bytes())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user