mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Add updatedAt on main index store
This commit is contained in:
parent
a90facaa41
commit
39e2b73718
2 changed files with 11 additions and 0 deletions
|
@ -13,6 +13,7 @@ const RANKED_MAP_KEY: &str = "ranked-map";
|
|||
const SCHEMA_KEY: &str = "schema";
|
||||
const STOP_WORDS_KEY: &str = "stop-words";
|
||||
const SYNONYMS_KEY: &str = "synonyms";
|
||||
const UPDATED_AT: &str = "updated-at";
|
||||
const WORDS_KEY: &str = "words";
|
||||
|
||||
type SerdeDatetime = SerdeBincode<DateTime<Utc>>;
|
||||
|
@ -43,6 +44,14 @@ impl Main {
|
|||
self.main.put::<Str, SerdeDatetime>(writer, CREATED_AT, &Utc::now())
|
||||
}
|
||||
|
||||
pub fn updated_at(self, reader: &heed::RoTxn) -> ZResult<Option<DateTime<Utc>>> {
|
||||
self.main.get::<Str, SerdeDatetime>(reader, UPDATED_AT)
|
||||
}
|
||||
|
||||
pub fn put_updated_at(self, writer: &mut heed::RwTxn) -> ZResult<()> {
|
||||
self.main.put::<Str, SerdeDatetime>(writer, UPDATED_AT, &Utc::now())
|
||||
}
|
||||
|
||||
pub fn put_words_fst(self, writer: &mut heed::RwTxn, fst: &fst::Set) -> ZResult<()> {
|
||||
let bytes = fst.as_fst().as_bytes();
|
||||
self.main.put::<Str, ByteSlice>(writer, WORDS_KEY, bytes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue