Make sure that meilisearch-http works without index wrapper

This commit is contained in:
Kerollmops 2022-10-04 11:06:48 +02:00 committed by Clément Renault
parent c70f375669
commit cf6084151b
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
9 changed files with 230 additions and 43 deletions

View file

@ -104,12 +104,14 @@ impl IndexMapper {
Ok(index)
}
pub fn indexes(&self, rtxn: &RoTxn) -> Result<Vec<Index>> {
pub fn indexes(&self, rtxn: &RoTxn) -> Result<Vec<(String, Index)>> {
self.index_mapping
.iter(rtxn)?
.map(|ret| {
ret.map_err(Error::from)
.and_then(|(name, _)| self.index(rtxn, name))
ret.map_err(Error::from).and_then(|(name, _)| {
self.index(rtxn, name)
.map(|index| (name.to_string(), index))
})
})
.collect()
}

View file

@ -231,7 +231,7 @@ impl IndexScheduler {
}
/// Return and open all the indexes.
pub fn indexes(&self) -> Result<Vec<Index>> {
pub fn indexes(&self) -> Result<Vec<(String, Index)>> {
let rtxn = self.env.read_txn()?;
self.index_mapper.indexes(&rtxn)
}