From 15763184b350db730727f5d268e78f43987eb6a6 Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Fri, 26 Dec 2025 17:41:49 +0530 Subject: [PATCH 1/5] adapt to new interface --- vector.go | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/vector.go b/vector.go index 9de303c..883006b 100644 --- a/vector.go +++ b/vector.go @@ -37,9 +37,11 @@ type eligibleDocumentSelector struct { docNums []uint64 } -func (eds *eligibleDocumentSelector) SegmentEligibleDocs(segmentID int) []uint64 { +func (eds *eligibleDocumentSelector) SegmentEligibleDocuments(segmentID int) index.EligibleDocumentList { // segmentID not applicable for single doc index - return eds.docNums + return &eligibleDocumentList{ + docNums: eds.docNums, + } } func (eds *eligibleDocumentSelector) AddEligibleDocumentMatch(id index.IndexInternalID) error { @@ -50,6 +52,29 @@ func (eds *eligibleDocumentSelector) AddEligibleDocumentMatch(id index.IndexInte return nil } +type eligibleDocumentList struct { + docNums []uint64 +} + +func (edl *eligibleDocumentList) Count() int { + return len(edl.docNums) +} + +func (edl *eligibleDocumentList) Iterator() index.EligibleDocumentIterator { + return eligibleDocumentIterator(edl.docNums) +} + +type eligibleDocumentIterator []uint64 + +func (edi eligibleDocumentIterator) Next() (uint64, bool) { + if len(edi) == 0 { + return 0, false + } + rv := edi[0] + edi = edi[1:] + return rv, true +} + func (r *Reader) NewEligibleDocumentSelector() index.EligibleDocumentSelector { return &eligibleDocumentSelector{} } @@ -57,7 +82,7 @@ func (r *Reader) NewEligibleDocumentSelector() index.EligibleDocumentSelector { func (r *Reader) VectorReader(ctx context.Context, vector []float32, field string, k int64, searchParams json.RawMessage, selector index.EligibleDocumentSelector) (index.VectorReader, error) { - if selector != nil && len(selector.SegmentEligibleDocs(0)) == 0 { + if selector != nil && selector.SegmentEligibleDocuments(0).Count() == 0 { // if selector/filter is applicable but no eligible docs, // then current document does not qualify return NewVectorFieldReaderEmpty(), nil From b9dff3602ba039167180e61ca968f3aecef67ba9 Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Sun, 28 Dec 2025 19:45:21 +0530 Subject: [PATCH 2/5] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- vector.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/vector.go b/vector.go index 883006b..00d06a7 100644 --- a/vector.go +++ b/vector.go @@ -61,17 +61,22 @@ func (edl *eligibleDocumentList) Count() int { } func (edl *eligibleDocumentList) Iterator() index.EligibleDocumentIterator { - return eligibleDocumentIterator(edl.docNums) + return &eligibleDocumentIterator{ + docNums: edl.docNums, + } } -type eligibleDocumentIterator []uint64 +type eligibleDocumentIterator struct { + docNums []uint64 + idx int +} -func (edi eligibleDocumentIterator) Next() (uint64, bool) { - if len(edi) == 0 { +func (edi *eligibleDocumentIterator) Next() (uint64, bool) { + if edi.idx >= len(edi.docNums) { return 0, false } - rv := edi[0] - edi = edi[1:] + rv := edi.docNums[edi.idx] + edi.idx++ return rv, true } From 2a092df37fb4a0e5b87688e879659f7e84f157b5 Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Fri, 9 Jan 2026 16:48:03 +0530 Subject: [PATCH 3/5] interface check --- vector.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vector.go b/vector.go index 00d06a7..4c16d10 100644 --- a/vector.go +++ b/vector.go @@ -56,8 +56,8 @@ type eligibleDocumentList struct { docNums []uint64 } -func (edl *eligibleDocumentList) Count() int { - return len(edl.docNums) +func (edl *eligibleDocumentList) Count() uint64 { + return uint64(len(edl.docNums)) } func (edl *eligibleDocumentList) Iterator() index.EligibleDocumentIterator { From 9ba1e8b168ec3948d35cab80bbd8e91a397bc612 Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Fri, 9 Jan 2026 17:29:29 +0530 Subject: [PATCH 4/5] update `actions/setup-go` to `v5` --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e0c425b..e2cdef8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: runs-on: ${{ matrix.platform }} steps: - name: Install Go - uses: actions/setup-go@v1 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} - name: Checkout code From 305903e4778fa53a0bd0f070a459e4d10ee5ad4b Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Fri, 9 Jan 2026 17:33:33 +0530 Subject: [PATCH 5/5] fix coverage --- .github/workflows/cover.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cover.yml b/.github/workflows/cover.yml index e1a845d..2beeefa 100644 --- a/.github/workflows/cover.yml +++ b/.github/workflows/cover.yml @@ -9,9 +9,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v1 + uses: actions/setup-go@v5 with: - go-version: '1.20.x' + go-version: '1.23.x' - name: Checkout code uses: actions/checkout@v2 - name: Test