MCPcopy Create free account
hub / github.com/Debian/dcs / writeDocidMap

Method writeDocidMap

internal/index/write.go:333–353  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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).
356func (w *Writer) writeDocidMap(dir string, filenames []string) error {

Callers 1

flushToMethod · 0.95

Calls 3

newCountingWriterFunction · 0.85
CloseMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected