Insert a posting for a term. Surrogate is supplied by the caller.
(&self, term: &str, posting: CompactPosting)
| 72 | |
| 73 | /// Insert a posting for a term. Surrogate is supplied by the caller. |
| 74 | pub fn insert(&self, term: &str, posting: CompactPosting) { |
| 75 | let mut map = self.postings.borrow_mut(); |
| 76 | map.entry(term.to_string()).or_default().push(posting); |
| 77 | *self.total_postings.borrow_mut() += 1; |
| 78 | } |
| 79 | |
| 80 | /// Record a document's stats (call once per indexed document). |
| 81 | pub fn record_doc(&self, doc_id: Surrogate, doc_len: u32) { |