Skip to content

Commit

Permalink
Update VectorIndexReader interface compliant to [email protected]
Browse files Browse the repository at this point in the history
+ If VectorReaderWithFilter has filterIDs != 1, the document is not
  eligible while pre-filtering.
+ Also upgrade GO version and workflows.
  • Loading branch information
abhinavdangeti committed Sep 9, 2024
1 parent be9427b commit 9bfd790
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.19.x, 1.20.x, 1.21.x]
go-version: [1.20.x, 1.21.x, 1.22.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module github.com/blevesearch/sear

go 1.20
go 1.21

require (
github.com/blevesearch/bleve_index_api v1.1.11
github.com/blevesearch/bleve_index_api v1.1.12
github.com/blevesearch/vellum v1.0.10
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/bits-and-blooms/bitset v1.2.0 h1:Kn4yilvwNtMACtf1eYDlG8H77R07mZSPbMjLyS07ChA=
github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
github.com/blevesearch/bleve_index_api v1.1.11 h1:OTNpRnxPWFIhMSgBUBlkD7RVWYrfsojtQeACb8tGGpw=
github.com/blevesearch/bleve_index_api v1.1.11/go.mod h1:PbcwjIcRmjhGbkS/lJCpfgVSMROV6TRubGGAODaK1W8=
github.com/blevesearch/bleve_index_api v1.1.12 h1:P4bw9/G/5rulOF7SJ9l4FsDoo7UFJ+5kexNy1RXfegY=
github.com/blevesearch/bleve_index_api v1.1.12/go.mod h1:PbcwjIcRmjhGbkS/lJCpfgVSMROV6TRubGGAODaK1W8=
github.com/blevesearch/mmap-go v1.0.4 h1:OVhDhT5B/M1HNPpYPBKIEJaD0F3Si+CrEKULGCDPWmc=
github.com/blevesearch/mmap-go v1.0.4/go.mod h1:EWmEAOmdAS9z/pi/+Toxu99DnsbhG1TIxUoRmJw/pSs=
github.com/blevesearch/vellum v1.0.10 h1:HGPJDT2bTva12hrHepVT3rOyIKFFF4t7Gf6yMxyMIPI=
Expand Down
13 changes: 13 additions & 0 deletions vector.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,21 @@ func (r *Reader) VectorReader(ctx context.Context, vector []float32,
return NewVectorFieldReaderEmpty(), nil
}

// searchParams not applicable for single document index

return NewVectorFieldReaderMatch(dims), nil
}

func (r *Reader) VectorReaderWithFilter(ctx context.Context, vector []float32,
field string, k int64, searchParams json.RawMessage,
filterIDs []index.IndexInternalID) (index.VectorReader, error) {
// if fildterIDs len == 0, current document is not eligible (in the single document
// index scenario)
if len(filterIDs) != 1 {
return NewVectorFieldReaderEmpty(), nil
}

return r.VectorReader(ctx, vector, field, k, searchParams)
}

// -----------------------------------------------------------------------------
Expand Down

0 comments on commit 9bfd790

Please sign in to comment.