Skip to content

Commit

Permalink
index: add debug code to ConcatN (compiled out unless enabled)
Browse files Browse the repository at this point in the history
  • Loading branch information
stapelberg committed Feb 2, 2023
1 parent 10f220f commit f133123
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions internal/index/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ func readPosrelMeta(dir string, idx map[Trigram][]posrelMetaEntry, idxid uint32)
return nil
}

const debug = false

var debugTrigram = func(trigram string) Trigram {
t := []byte(trigram)
return Trigram(uint32(t[0])<<16 | uint32(t[1])<<8 | uint32(t[2]))
}("_op")

func ConcatN(destdir string, srcdirs []string) error {
fDocidMap, err := os.Create(filepath.Join(destdir, "docid.map"))
if err != nil {
Expand Down Expand Up @@ -215,6 +222,12 @@ func ConcatN(destdir string, srcdirs []string) error {
meBuf := make([]byte, metaEntrySize)
dr := NewDeltaReader()
for _, t := range trigrams {
if debug {
if t != debugTrigram {
continue
}
}

//for _, t := range []trigram{trigram(6650227), trigram(7959906)} {
//ctrl, data := dw.Offsets()
me := MetaEntry{
Expand Down Expand Up @@ -292,6 +305,11 @@ func ConcatN(destdir string, srcdirs []string) error {
cw := newCountingWriter(fposrel)
pw := newPosrelWriter(&cw)
for _, t := range trigrams {
if debug {
if t != debugTrigram {
continue
}
}
if t == 2105376 { // TODO: document: " "?
continue
}
Expand Down Expand Up @@ -359,6 +377,12 @@ func ConcatN(destdir string, srcdirs []string) error {
dr := NewDeltaReader()
//for _, t := range []trigram{trigram(6650227), trigram(7959906)} {
for _, t := range trigrams {
if debug {
if t != debugTrigram {
continue
}
}

if t == 2105376 { // TODO: document: " "?
continue
}
Expand Down

0 comments on commit f133123

Please sign in to comment.