writeDocidMap creates the index’s docid.map file, which is a list of \n-separated strings (for easy printing by humans using less(1) or strings(1)), followed by the byte offsets of each entry and, lastly, the offset of the byte offsets (for fast lookup).
(dir string, filenames []string)
| 331 | trigrams := make([]Trigram, 0, len(w.index)) |
| 332 | for t := range w.index { |
| 333 | trigrams = append(trigrams, t) |
| 334 | } |
| 335 | slices.Sort(trigrams) |
| 336 | |
| 337 | if err := w.writeDocid(dir, trigrams); err != nil { |
| 338 | return err |
| 339 | } |
| 340 | |
| 341 | if err := w.writePos(dir, trigrams); err != nil { |
| 342 | return err |
| 343 | } |
| 344 | |
| 345 | if err := w.writePosrel(dir, trigrams); err != nil { |
| 346 | return err |
| 347 | } |
| 348 | |
| 349 | return nil |
| 350 | } |
| 351 | |
| 352 | // writeDocidMap creates the index’s docid.map file, which is a list of |
| 353 | // \n-separated strings (for easy printing by humans using less(1) or |
| 354 | // strings(1)), followed by the byte offsets of each entry and, lastly, the |
| 355 | // offset of the byte offsets (for fast lookup). |
| 356 | func (w *Writer) writeDocidMap(dir string, filenames []string) error { |
no test coverage detected