-
-
Notifications
You must be signed in to change notification settings - Fork 699
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide StoreReader::enumerate to simplify creation of secondary indexes
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.)
- Loading branch information
1 parent
b493743
commit ebf92f7
Showing
2 changed files
with
19 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters