Skip to content

Commit 2a4e02a

Browse files
committed
code cleanup + review comments
1 parent 17efedf commit 2a4e02a

2 files changed

Lines changed: 4 additions & 25 deletions

File tree

index/scorch/unadorned.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,6 @@ func (i *unadornedPostingsIterator1Hit) BytesWritten() uint64 {
168168

169169
func (i *unadornedPostingsIterator1Hit) ResetBytesRead(uint64) {}
170170

171-
// Implement OptimizablePostingsIterator so a 1-hit iterator produced by one
172-
// optimization pass (e.g. the unadorned conjunction/disjunction Finish) can be
173-
// re-optimized when it feeds into a nested conjunction/disjunction, rather than
174-
// aborting the outer optimization on a failed type assertion.
175171
func (i *unadornedPostingsIterator1Hit) ActualBitmap() *roaring.Bitmap { return nil }
176172

177173
func (i *unadornedPostingsIterator1Hit) DocNum1Hit() (uint64, bool) {
@@ -198,23 +194,6 @@ type ResetablePostingsIterator interface {
198194
ResetIterator()
199195
}
200196

201-
// Compile-time guarantee that every postings-iterator type placed into an
202-
// optimized termFieldReader's per-segment iterator slice implements
203-
// OptimizablePostingsIterator, so a nested conjunction/disjunction optimization
204-
// composes it instead of silently aborting on a failed type assertion.
205-
//
206-
// The two stateful iterators must additionally be resettable so termFieldReader
207-
// reuse rewinds them; the empty iterator is stateless and intentionally opts out
208-
// (ResetIterator is invoked via an optional type assertion).
209-
var (
210-
_ segment.OptimizablePostingsIterator = (*emptyPostingsIterator)(nil)
211-
_ segment.OptimizablePostingsIterator = (*unadornedPostingsIteratorBitmap)(nil)
212-
_ segment.OptimizablePostingsIterator = (*unadornedPostingsIterator1Hit)(nil)
213-
214-
_ ResetablePostingsIterator = (*unadornedPostingsIteratorBitmap)(nil)
215-
_ ResetablePostingsIterator = (*unadornedPostingsIterator1Hit)(nil)
216-
)
217-
218197
type UnadornedPosting struct {
219198
docNum uint64
220199
}

search/collector/topn.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ type TopNCollector struct {
8383

8484
nestedStore *collectStoreNested
8585

86-
// fastPrepare is true when a hit needs only basicPrepare plus the shared
87-
// score sort value (see canFastPrepare) — set once in Collect after loadID
88-
// is known. Applies only to score-sorted queries with no field-loading needs.
8986
fastPrepare bool
9087
}
9188

@@ -341,6 +338,10 @@ func (hc *TopNCollector) Collect(ctx context.Context, searcher search.Searcher,
341338
}
342339

343340
hc.needDocIds = hc.needDocIds || loadID
341+
342+
// fastPrepare is set to true when a hit needs only basicPrepare plus the shared
343+
// score sort value (see canFastPrepare). Applies only to score-sorted queries
344+
// with no field-loading needs.
344345
hc.fastPrepare = hc.canFastPrepare()
345346
select {
346347
case <-ctx.Done():
@@ -499,7 +500,6 @@ func (hc *TopNCollector) basicPrepare(d *search.DocumentMatch) {
499500
}
500501

501502
func (hc *TopNCollector) canFastPrepare() bool {
502-
503503
return len(hc.neededFields) == 0 && !hc.needDocIds &&
504504
len(hc.sort) == 1 && hc.cachedScoring[0]
505505
}

0 commit comments

Comments
 (0)