diff --git a/CHANGELOG.md b/CHANGELOG.md index 82459e469..2681f6d6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +Tantivy 0.4.0 +========================== + +- Removed u32 fields. They are replaced by u64 and i64 fields (#65) +- + + +Tantivy 0.3.1 +========================== + +- Expose a method to trigger files garbage collection +- Raise the limit of number of fields (previously 256 fields) + + Tantivy 0.3 ========================== diff --git a/Cargo.toml b/Cargo.toml index 4316fcbda..274c442b8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tantivy" -version = "0.3.1" +version = "0.4.0-alpha" authors = ["Paul Masurel "] build = "build.rs" license = "MIT" diff --git a/src/core/searcher.rs b/src/core/searcher.rs index 839e00172..fe54d1a5f 100644 --- a/src/core/searcher.rs +++ b/src/core/searcher.rs @@ -68,8 +68,8 @@ impl Searcher { } /// Returns the segment_reader associated with the given segment_ordinal - pub fn segment_reader(&self, segment_ord: usize) -> &SegmentReader { - &self.segment_readers[segment_ord] + pub fn segment_reader(&self, segment_ord: u32) -> &SegmentReader { + &self.segment_readers[segment_ord as usize] } /// Runs a query on the segment readers wrapped by the searcher @@ -78,6 +78,7 @@ impl Searcher { } } + impl From> for Searcher { fn from(segment_readers: Vec) -> Searcher { Searcher { diff --git a/src/fastfield/error.rs b/src/fastfield/error.rs index 71497a315..f9f0be0d6 100644 --- a/src/fastfield/error.rs +++ b/src/fastfield/error.rs @@ -10,6 +10,10 @@ pub struct FastFieldNotAvailableError { } impl FastFieldNotAvailableError { + + /// Creates a `FastFieldNotAvailable` error. + /// `field_entry` is the configuration of the field + /// for which fast fields are not available. pub fn new(field_entry: &FieldEntry) -> FastFieldNotAvailableError { FastFieldNotAvailableError { field_name: field_entry.name().clone(), diff --git a/src/fastfield/writer.rs b/src/fastfield/writer.rs index f606b8176..9c85fa146 100644 --- a/src/fastfield/writer.rs +++ b/src/fastfield/writer.rs @@ -46,7 +46,7 @@ impl FastFieldsWriter { field_writers: field_writers, } } - + pub fn new(fields: Vec) -> FastFieldsWriter { FastFieldsWriter { field_writers: fields @@ -56,6 +56,7 @@ impl FastFieldsWriter { } } + /// Get the `FastFieldWriter` associated to a field. pub fn get_field_writer(&mut self, field: Field) -> Option<&mut IntFastFieldWriter> { // TODO optimize self.field_writers @@ -63,15 +64,19 @@ impl FastFieldsWriter { .find(|field_writer| field_writer.field == field) } + + /// Indexes all of the fastfields of a new document. pub fn add_document(&mut self, doc: &Document) { for field_writer in &mut self.field_writers { field_writer.add_document(doc); } } + /// Serializes all of the `FastFieldWriter`s by pushing them in + /// order to the fast field serializer. pub fn serialize(&self, serializer: &mut FastFieldSerializer) -> io::Result<()> { for field_writer in &self.field_writers { - try!(field_writer.serialize(serializer)); + field_writer.serialize(serializer)?; } Ok(()) } @@ -84,7 +89,6 @@ impl FastFieldsWriter { for field_writer in &mut self.field_writers { field_writer.fill_val_up_to(doc); } - } } @@ -140,7 +144,12 @@ impl IntFastFieldWriter { self.add_val(val_if_missing); } } - + + /// Records a new value. + /// + /// The n-th value being recorded is implicitely + /// associated to the document with the `DocId` n. + /// (Well, `n-1` actually because of 0-indexing) pub fn add_val(&mut self, val: u64) { self.vals.push(val); }