mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-01-07 09:32:54 +00:00
For secondary indexes, it is often necessary to read all documents, compute
some function on them and associated the result with a document ID.
Currently, this requires something like
```rust
let reader = segment.get_store_reader(1)?;
for doc_id in segment.doc_ids_alive() {
let doc = reader.get(doc_id)?;
// Use doc and doc_id here ...
}
```
which can be simplified to
```rust
let reader = segment.get_store_reader(1)?;
for res in reader.enumerate() {
let (doc_id, doc) = res?;
// Use doc and doc_id here ...
}
```
using the method proposed here.
(I added a new method instead of modifying `StoreReader::iter` to make the
change backwards compatible, i.e. possible to include in a point release.)