mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 12:05:05 +08:00
fix: Change the way the iterator upper bound is computed
This commit is contained in:
parent
4626c77eac
commit
7c98771068
@ -43,7 +43,7 @@ impl<'de, 'a, 'b> de::Deserializer<'de> for &'b mut Deserializer<'a> {
|
|||||||
{
|
{
|
||||||
let mut options = ReadOptions::new();
|
let mut options = ReadOptions::new();
|
||||||
let lower = DocumentKey::new(self.document_id);
|
let lower = DocumentKey::new(self.document_id);
|
||||||
let upper = DocumentKey::new(self.document_id + 1);
|
let upper = lower.with_attribute_max();
|
||||||
options.set_iterate_lower_bound(lower.as_ref());
|
options.set_iterate_lower_bound(lower.as_ref());
|
||||||
options.set_iterate_upper_bound(upper.as_ref());
|
options.set_iterate_upper_bound(upper.as_ref());
|
||||||
|
|
||||||
|
@ -38,6 +38,10 @@ impl DocumentKey {
|
|||||||
DocumentKeyAttr::new(self.document_id(), attr)
|
DocumentKeyAttr::new(self.document_id(), attr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn with_attribute_max(&self) -> DocumentKeyAttr {
|
||||||
|
DocumentKeyAttr::new(self.document_id(), SchemaAttr::max())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn document_id(&self) -> DocumentId {
|
pub fn document_id(&self) -> DocumentId {
|
||||||
(&self.0[4..]).read_u64::<NativeEndian>().unwrap()
|
(&self.0[4..]).read_u64::<NativeEndian>().unwrap()
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use std::collections::{HashMap, BTreeMap};
|
use std::collections::{HashMap, BTreeMap};
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
|
use std::{fmt, u32};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::ops::BitOr;
|
use std::ops::BitOr;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::fmt;
|
|
||||||
|
|
||||||
use serde_derive::{Serialize, Deserialize};
|
use serde_derive::{Serialize, Deserialize};
|
||||||
use linked_hash_map::LinkedHashMap;
|
use linked_hash_map::LinkedHashMap;
|
||||||
@ -127,6 +127,10 @@ impl SchemaAttr {
|
|||||||
SchemaAttr(value)
|
SchemaAttr(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn max() -> SchemaAttr {
|
||||||
|
SchemaAttr(u32::MAX)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn as_u32(&self) -> u32 {
|
pub fn as_u32(&self) -> u32 {
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user