()
| 241 | } |
| 242 | |
| 243 | func (r *postReader) next() bool { |
| 244 | for r.count > 0 { |
| 245 | r.count-- |
| 246 | delta64, n := binary.Uvarint(r.d) |
| 247 | delta := uint32(delta64) |
| 248 | if n <= 0 || delta == 0 { |
| 249 | corrupt() |
| 250 | } |
| 251 | r.d = r.d[n:] |
| 252 | r.fileid += delta |
| 253 | if r.restrict != nil { |
| 254 | i := 0 |
| 255 | for i < len(r.restrict) && r.restrict[i] < r.fileid { |
| 256 | i++ |
| 257 | } |
| 258 | r.restrict = r.restrict[i:] |
| 259 | if len(r.restrict) == 0 || r.restrict[0] != r.fileid { |
| 260 | continue |
| 261 | } |
| 262 | } |
| 263 | return true |
| 264 | } |
| 265 | // list should end with terminating 0 delta |
| 266 | if r.d != nil && (len(r.d) == 0 || r.d[0] != 0) { |
| 267 | corrupt() |
| 268 | } |
| 269 | r.fileid = ^uint32(0) |
| 270 | return false |
| 271 | } |
| 272 | |
| 273 | func (ix *Index) PostingList(trigram uint32) []uint32 { |
| 274 | return ix.postingList(trigram, nil) |
no test coverage detected