Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 6 additions & 26 deletions index/scorch/snapshot_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import (
"container/heap"
"context"
"encoding/binary"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -59,11 +58,11 @@
var err error
lb1, err = lev.NewLevenshteinAutomatonBuilder(1, true)
if err != nil {
panic(fmt.Errorf("Levenshtein automaton ed1 builder err: %v", err))
panic(fmt.Errorf("levenshtein automaton ed1 builder err: %v", err))
}
lb2, err = lev.NewLevenshteinAutomatonBuilder(2, true)
if err != nil {
panic(fmt.Errorf("Levenshtein automaton ed2 builder err: %v", err))
panic(fmt.Errorf("levenshtein automaton ed2 builder err: %v", err))
}
}

Expand Down Expand Up @@ -501,7 +500,7 @@
return nil, nil
}

docNum, err := docInternalToNumber(next.ID)
docNum, err := next.ID.Value()

Check failure on line 503 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, ubuntu-latest)

next.ID.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 503 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, ubuntu-latest)

next.ID.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 503 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, ubuntu-latest)

next.ID.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 503 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, windows-latest)

next.ID.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 503 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, windows-latest)

next.ID.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 503 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, macos-latest)

next.ID.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 503 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, macos-latest)

next.ID.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 503 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, macos-latest)

next.ID.Value undefined (type index.IndexInternalID has no field or method Value)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -571,7 +570,7 @@
}

func (is *IndexSnapshot) ExternalID(id index.IndexInternalID) (string, error) {
docNum, err := docInternalToNumber(id)
docNum, err := id.Value()

Check failure on line 573 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, ubuntu-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 573 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, ubuntu-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 573 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, ubuntu-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 573 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, windows-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 573 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, windows-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 573 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, macos-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 573 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, macos-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 573 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, macos-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)
if err != nil {
return "", err
}
Expand All @@ -589,7 +588,7 @@
}

func (is *IndexSnapshot) segmentIndexAndLocalDocNum(id index.IndexInternalID) (int, uint64, error) {
docNum, err := docInternalToNumber(id)
docNum, err := id.Value()

Check failure on line 591 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, ubuntu-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 591 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, ubuntu-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 591 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, ubuntu-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 591 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, windows-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 591 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, windows-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 591 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, macos-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 591 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, macos-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 591 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, macos-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)
if err != nil {
return 0, 0, err
}
Expand Down Expand Up @@ -776,25 +775,6 @@
is.m2.Unlock()
}

func docNumberToBytes(buf []byte, in uint64) []byte {
if len(buf) != 8 {
if cap(buf) >= 8 {
buf = buf[0:8]
} else {
buf = make([]byte, 8)
}
}
binary.BigEndian.PutUint64(buf, in)
return buf
}

func docInternalToNumber(in index.IndexInternalID) (uint64, error) {
if len(in) != 8 {
return 0, fmt.Errorf("wrong len for IndexInternalID: %q", in)
}
return binary.BigEndian.Uint64(in), nil
}

func (is *IndexSnapshot) documentVisitFieldTermsOnSegment(
segmentIndex int, localDocNum uint64, fields []string, cFields []string,
visitor index.DocValueVisitor, dvs segment.DocVisitState) (
Expand Down Expand Up @@ -897,7 +877,7 @@
func (dvr *DocValueReader) VisitDocValues(id index.IndexInternalID,
visitor index.DocValueVisitor,
) (err error) {
docNum, err := docInternalToNumber(id)
docNum, err := id.Value()

Check failure on line 880 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, ubuntu-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 880 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, ubuntu-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 880 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, ubuntu-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 880 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, windows-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 880 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, windows-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 880 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, macos-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 880 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, macos-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 880 in index/scorch/snapshot_index.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, macos-latest)

id.Value undefined (type index.IndexInternalID has no field or method Value)
if err != nil {
return err
}
Expand Down
5 changes: 2 additions & 3 deletions index/scorch/snapshot_index_doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package scorch

import (
"bytes"
"reflect"

"github.com/RoaringBitmap/roaring/v2"
Expand Down Expand Up @@ -49,7 +48,7 @@
next := i.iterators[i.segmentOffset].Next()
// make segment number into global number by adding offset
globalOffset := i.snapshot.offsets[i.segmentOffset]
return docNumberToBytes(nil, uint64(next)+globalOffset), nil
return index.NewIndexInternalID(nil, uint64(next)+globalOffset), nil

Check failure on line 51 in index/scorch/snapshot_index_doc.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, ubuntu-latest)

undefined: index.NewIndexInternalID

Check failure on line 51 in index/scorch/snapshot_index_doc.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, ubuntu-latest)

undefined: index.NewIndexInternalID

Check failure on line 51 in index/scorch/snapshot_index_doc.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, ubuntu-latest)

undefined: index.NewIndexInternalID

Check failure on line 51 in index/scorch/snapshot_index_doc.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, windows-latest)

undefined: index.NewIndexInternalID

Check failure on line 51 in index/scorch/snapshot_index_doc.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, windows-latest)

undefined: index.NewIndexInternalID

Check failure on line 51 in index/scorch/snapshot_index_doc.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, macos-latest)

undefined: index.NewIndexInternalID

Check failure on line 51 in index/scorch/snapshot_index_doc.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, macos-latest)

undefined: index.NewIndexInternalID

Check failure on line 51 in index/scorch/snapshot_index_doc.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, macos-latest)

undefined: index.NewIndexInternalID
}
return nil, nil
}
Expand All @@ -63,7 +62,7 @@
if next == nil {
return nil, nil
}
for bytes.Compare(next, ID) < 0 {
for next.Compare(ID) < 0 {
next, err = i.Next()
if err != nil {
return nil, err
Expand Down
9 changes: 4 additions & 5 deletions index/scorch/snapshot_index_tfr.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package scorch

import (
"bytes"
"context"
"fmt"
"reflect"
Expand Down Expand Up @@ -94,7 +93,7 @@
// make segment number into global number by adding offset
globalOffset := i.snapshot.offsets[i.segmentOffset]
nnum := next.Number()
rv.ID = docNumberToBytes(rv.ID, nnum+globalOffset)
rv.ID = index.NewIndexInternalID(rv.ID, nnum+globalOffset)

Check failure on line 96 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, ubuntu-latest)

undefined: index.NewIndexInternalID

Check failure on line 96 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, ubuntu-latest)

undefined: index.NewIndexInternalID

Check failure on line 96 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, ubuntu-latest)

undefined: index.NewIndexInternalID

Check failure on line 96 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, windows-latest)

undefined: index.NewIndexInternalID

Check failure on line 96 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, windows-latest)

undefined: index.NewIndexInternalID

Check failure on line 96 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, macos-latest)

undefined: index.NewIndexInternalID

Check failure on line 96 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, macos-latest)

undefined: index.NewIndexInternalID

Check failure on line 96 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, macos-latest)

undefined: index.NewIndexInternalID
i.postingToTermFieldDoc(next, rv)

i.currID = rv.ID
Expand Down Expand Up @@ -146,7 +145,7 @@
func (i *IndexSnapshotTermFieldReader) Advance(ID index.IndexInternalID, preAlloced *index.TermFieldDoc) (*index.TermFieldDoc, error) {
// FIXME do something better
// for now, if we need to seek backwards, then restart from the beginning
if i.currPosting != nil && bytes.Compare(i.currID, ID) >= 0 {
if i.currPosting != nil && i.currID.Compare(ID) >= 0 {
// Check if the TFR is a special unadorned composite optimization.
// Such a TFR will NOT have a valid `term` or `field` set, making it
// impossible for the TFR to replace itself with a new one.
Expand All @@ -171,7 +170,7 @@
}
}
}
num, err := docInternalToNumber(ID)
num, err := ID.Value()

Check failure on line 173 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, ubuntu-latest)

ID.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 173 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, ubuntu-latest)

ID.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 173 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, ubuntu-latest)

ID.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 173 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, windows-latest)

ID.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 173 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, windows-latest)

ID.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 173 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, macos-latest)

ID.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 173 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, macos-latest)

ID.Value undefined (type index.IndexInternalID has no field or method Value)

Check failure on line 173 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, macos-latest)

ID.Value undefined (type index.IndexInternalID has no field or method Value)
if err != nil {
return nil, fmt.Errorf("error converting to doc number % x - %v", ID, err)
}
Expand All @@ -196,7 +195,7 @@
if preAlloced == nil {
preAlloced = &index.TermFieldDoc{}
}
preAlloced.ID = docNumberToBytes(preAlloced.ID, next.Number()+
preAlloced.ID = index.NewIndexInternalID(preAlloced.ID, next.Number()+

Check failure on line 198 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, ubuntu-latest)

undefined: index.NewIndexInternalID

Check failure on line 198 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, ubuntu-latest)

undefined: index.NewIndexInternalID

Check failure on line 198 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, ubuntu-latest)

undefined: index.NewIndexInternalID

Check failure on line 198 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, windows-latest)

undefined: index.NewIndexInternalID

Check failure on line 198 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, windows-latest)

undefined: index.NewIndexInternalID

Check failure on line 198 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, macos-latest)

undefined: index.NewIndexInternalID

Check failure on line 198 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, macos-latest)

undefined: index.NewIndexInternalID

Check failure on line 198 in index/scorch/snapshot_index_tfr.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, macos-latest)

undefined: index.NewIndexInternalID
i.snapshot.offsets[segIndex])
i.postingToTermFieldDoc(next, preAlloced)
i.currID = preAlloced.ID
Expand Down
9 changes: 4 additions & 5 deletions index/scorch/snapshot_index_vr.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package scorch

import (
"bytes"
"context"
"encoding/json"
"fmt"
Expand Down Expand Up @@ -96,7 +95,7 @@ func (i *IndexSnapshotVectorReader) Next(preAlloced *index.VectorDoc) (
// make segment number into global number by adding offset
globalOffset := i.snapshot.offsets[i.segmentOffset]
nnum := next.Number()
rv.ID = docNumberToBytes(rv.ID, nnum+globalOffset)
rv.ID = index.NewIndexInternalID(rv.ID, nnum+globalOffset)
rv.Score = float64(next.Score())

i.currID = rv.ID
Expand All @@ -113,7 +112,7 @@ func (i *IndexSnapshotVectorReader) Next(preAlloced *index.VectorDoc) (
func (i *IndexSnapshotVectorReader) Advance(ID index.IndexInternalID,
preAlloced *index.VectorDoc) (*index.VectorDoc, error) {

if i.currPosting != nil && bytes.Compare(i.currID, ID) >= 0 {
if i.currPosting != nil && i.currID.Compare(ID) >= 0 {
i2, err := i.snapshot.VectorReader(i.ctx, i.vector, i.field, i.k,
i.searchParams, i.eligibleSelector)
if err != nil {
Expand All @@ -124,7 +123,7 @@ func (i *IndexSnapshotVectorReader) Advance(ID index.IndexInternalID,
*i = *(i2.(*IndexSnapshotVectorReader))
}

num, err := docInternalToNumber(ID)
num, err := ID.Value()
if err != nil {
return nil, fmt.Errorf("error converting to doc number % x - %v", ID, err)
}
Expand All @@ -149,7 +148,7 @@ func (i *IndexSnapshotVectorReader) Advance(ID index.IndexInternalID,
if preAlloced == nil {
preAlloced = &index.VectorDoc{}
}
preAlloced.ID = docNumberToBytes(preAlloced.ID, next.Number()+
preAlloced.ID = index.NewIndexInternalID(preAlloced.ID, next.Number()+
i.snapshot.offsets[segIndex])
i.currID = preAlloced.ID
i.currPosting = next
Expand Down
2 changes: 1 addition & 1 deletion search/scorer/scorer_knn.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (sqs *KNNQueryScorer) Score(ctx *search.SearchContext,
if sqs.options.Explain {
rv.Expl = scoreExplanation
}
rv.IndexInternalID = append(rv.IndexInternalID, knnMatch.ID...)
rv.IndexInternalID = index.NewIndexInternalIDFrom(rv.IndexInternalID, knnMatch.ID)
return rv
}

Expand Down
6 changes: 3 additions & 3 deletions search/scorer/scorer_term.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@
childrenExplanations := s.scoreExplanation(tf, termMatch)
scoreExplanation = &search.Explanation{
Value: score,
Message: fmt.Sprintf("fieldWeight(%s:%s in %s), as per %s model, "+
"product of:", s.queryField, s.queryTerm, termMatch.ID, scoringModel),
Message: fmt.Sprintf("fieldWeight(%s:%s in %s), as per %s model, product of:",
s.queryField, s.queryTerm, termMatch.ID, scoringModel),
Children: childrenExplanations,
}
}
Expand Down Expand Up @@ -243,7 +243,7 @@
}
}

rv.IndexInternalID = append(rv.IndexInternalID, termMatch.ID...)
rv.IndexInternalID = index.NewIndexInternalIDFrom(rv.IndexInternalID, termMatch.ID)

Check failure on line 246 in search/scorer/scorer_term.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, ubuntu-latest)

undefined: index.NewIndexInternalIDFrom

Check failure on line 246 in search/scorer/scorer_term.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, ubuntu-latest)

undefined: index.NewIndexInternalIDFrom

Check failure on line 246 in search/scorer/scorer_term.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, ubuntu-latest)

undefined: index.NewIndexInternalIDFrom

Check failure on line 246 in search/scorer/scorer_term.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, windows-latest)

undefined: index.NewIndexInternalIDFrom

Check failure on line 246 in search/scorer/scorer_term.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, windows-latest)

undefined: index.NewIndexInternalIDFrom

Check failure on line 246 in search/scorer/scorer_term.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, macos-latest)

undefined: index.NewIndexInternalIDFrom

Check failure on line 246 in search/scorer/scorer_term.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, macos-latest)

undefined: index.NewIndexInternalIDFrom

Check failure on line 246 in search/scorer/scorer_term.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, macos-latest)

undefined: index.NewIndexInternalIDFrom

if len(termMatch.Vectors) > 0 {
if cap(rv.FieldTermLocations) < len(termMatch.Vectors) {
Expand Down
7 changes: 3 additions & 4 deletions search/searcher/search_disjunction_heap.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package searcher

import (
"bytes"
"container/heap"
"context"
"math"
Expand Down Expand Up @@ -169,7 +168,7 @@ func (s *DisjunctionHeapSearcher) updateMatches() error {
matchingIdxs = append(matchingIdxs, next.matchingIdx)

// now as long as top of heap matches, keep popping
for len(s.heap) > 0 && bytes.Compare(next.curr.IndexInternalID, s.heap[0].curr.IndexInternalID) == 0 {
for len(s.heap) > 0 && next.curr.IndexInternalID.Equals(s.heap[0].curr.IndexInternalID) {
next = heap.Pop(s).(*SearcherCurr)
matching = append(matching, next.curr)
matchingCurrs = append(matchingCurrs, next)
Expand Down Expand Up @@ -264,7 +263,7 @@ func (s *DisjunctionHeapSearcher) Advance(ctx *search.SearchContext,

// find all searchers that actually need to be advanced
// advance them, using s.matchingCurrs as temp storage
for len(s.heap) > 0 && bytes.Compare(s.heap[0].curr.IndexInternalID, ID) < 0 {
for len(s.heap) > 0 && s.heap[0].curr.IndexInternalID.Compare(ID) < 0 {
searcherCurr := heap.Pop(s).(*SearcherCurr)
ctx.DocumentMatchPool.Put(searcherCurr.curr)
curr, err := searcherCurr.searcher.Advance(ctx, ID)
Expand Down Expand Up @@ -347,7 +346,7 @@ func (s *DisjunctionHeapSearcher) Less(i, j int) bool {
} else if s.heap[j].curr == nil {
return false
}
return bytes.Compare(s.heap[i].curr.IndexInternalID, s.heap[j].curr.IndexInternalID) < 0
return s.heap[i].curr.IndexInternalID.Compare(s.heap[j].curr.IndexInternalID) < 0
}

func (s *DisjunctionHeapSearcher) Swap(i, j int) {
Expand Down
2 changes: 1 addition & 1 deletion search/searcher/search_numeric_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func filterCandidateTerms(indexReader index.IndexReader,
for err == nil && tfd != nil {
termBytes := []byte(tfd.Term)
i := sort.Search(len(terms), func(i int) bool { return bytes.Compare(terms[i], termBytes) >= 0 })
if i < len(terms) && bytes.Compare(terms[i], termBytes) == 0 {
if i < len(terms) && bytes.Equal(terms[i], termBytes) {
rv = append(rv, terms[i])
}
terms = terms[i:]
Expand Down
Loading