fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

Handle error in symbol search for older indexes (#33)

author
Kevin Zheng
committer
GitHub
date (Oct 17, 2019, 11:42 PM -0700) commit 90218876 parent 5d69bfbb
+18 -2
+18 -2
matchtree.go
··· 199 199 200 200 doc uint32 201 201 sections []DocumentSection 202 + 203 + secID uint32 202 204 } 203 205 204 206 func (t *symbolSubstrMatchTree) prepare(doc uint32) { ··· 212 214 213 215 var sections []DocumentSection 214 216 if len(t.sections) > 0 { 215 - sections = t.sections[t.fileEndSymbol[doc]:t.fileEndSymbol[doc+1]] 217 + most := t.fileEndSymbol[len(t.fileEndSymbol)-1] 218 + if most == uint32(len(t.sections)) { 219 + sections = t.sections[t.fileEndSymbol[doc]:t.fileEndSymbol[doc+1]] 220 + } else { 221 + for t.secID < uint32(len(t.sections)) && t.sections[t.secID].Start < fileStart { 222 + t.secID++ 223 + } 224 + 225 + fileEnd, symbolEnd := t.fileEndRunes[doc], t.secID 226 + for symbolEnd < uint32(len(t.sections)) && t.sections[symbolEnd].Start < fileEnd { 227 + symbolEnd++ 228 + } 229 + 230 + sections = t.sections[t.secID:symbolEnd] 231 + } 216 232 } 217 - secIdx := 0 218 233 234 + secIdx := 0 219 235 trimmed := t.current[:0] 220 236 for len(sections) > secIdx && len(t.current) > 0 { 221 237 start := fileStart + t.current[0].runeOffset