Skip to content

Commit

Permalink
Merge pull request #14 from blevesearch/verUpdate
Browse files Browse the repository at this point in the history
Update to bleve_index_api@v1.0.5, vellum@v1.0.9
  • Loading branch information
abhinavdangeti committed Nov 14, 2022
2 parents da072a9 + 0636f08 commit 3d1f557
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 69 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cover.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: '1.14.x'
go-version: '1.18.x'
- name: Checkout code
uses: actions/checkout@v2
- name: Test
Expand All @@ -20,4 +20,4 @@ jobs:
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov
path-to-profile: profile.cov
16 changes: 0 additions & 16 deletions .github/workflows/lint.yml

This file was deleted.

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.14.x, 1.15.x]
go-version: [1.18.x, 1.19.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand Down
10 changes: 10 additions & 0 deletions dict.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ func (d *FieldDict) Next() (*index.DictEntry, error) {
return nil, nil
}

func (d *FieldDict) BytesRead() uint64 {
// not implemented
return 0
}

func (d *FieldDict) Close() error {
return nil
}
Expand Down Expand Up @@ -92,3 +97,8 @@ func (d *FieldDictContains) Contains(key []byte) (bool, error) {
}
return false, nil
}

func (d *FieldDictContains) BytesRead() uint64 {
// not implemented
return 0
}
4 changes: 4 additions & 0 deletions doc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ func (t *testDoc) NumPlainTextBytes() uint64 {

func (t *testDoc) AddIDField() {}

func (t *testDoc) StoredFieldsBytes() uint64 {
return 0
}

type testField struct {
name string
val []byte
Expand Down
5 changes: 5 additions & 0 deletions docvalue.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,8 @@ func (d *DocValueReader) VisitDocValues(id index.IndexInternalID, visitor index.
}
return nil
}

func (d *DocValueReader) BytesRead() uint64 {
// not implemented
return 0
}
13 changes: 9 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
module github.com/blevesearch/sear

go 1.13
go 1.18

require (
github.com/blevesearch/bleve_index_api v1.0.1
github.com/blevesearch/vellum v1.0.7
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 // indirect
github.com/blevesearch/bleve_index_api v1.0.5
github.com/blevesearch/vellum v1.0.9
)

require (
github.com/bits-and-blooms/bitset v1.2.0 // indirect
github.com/blevesearch/mmap-go v1.0.4 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
)
47 changes: 8 additions & 39 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,41 +1,10 @@
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
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.0.1 h1:nx9++0hnyiGOHJwQQYfsUGzpRdEVE5LsylmmngQvaFk=
github.com/blevesearch/bleve_index_api v1.0.1/go.mod h1:fiwKS0xLEm+gBRgv5mumf0dhgFr2mDgZah1pqv1c1M4=
github.com/blevesearch/mmap-go v1.0.3 h1:7QkALgFNooSq3a46AE+pWeKASAZc9SiNFJhDGF1NDx4=
github.com/blevesearch/mmap-go v1.0.3/go.mod h1:pYvKl/grLQrBxuaRYgoTssa4rVujYYeenDp++2E+yvs=
github.com/blevesearch/vellum v1.0.7 h1:+vn8rfyCRHxKVRgDLeR0FAXej2+6mEb5Q15aQE/XESQ=
github.com/blevesearch/vellum v1.0.7/go.mod h1:doBZpmRhwTsASB4QdUZANlJvqVAUdUyX0ZK7QJCTeBE=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
github.com/blevesearch/bleve_index_api v1.0.5 h1:Lc986kpC4Z0/n1g3gg8ul7H+lxgOQPcXb9SxvQGu+tw=
github.com/blevesearch/bleve_index_api v1.0.5/go.mod h1:YXMDwaXFFXwncRS8UobWs7nvo0DmusriM1nztTlj1ms=
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.9 h1:PL+NWVk3dDGPCV0hoDu9XLLJgqU4E5s/dOeEJByQ2uQ=
github.com/blevesearch/vellum v1.0.9/go.mod h1:ul1oT0FhSMDIExNjIxHqJoGpVrBpKCdgDQNxfqgJt7k=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
12 changes: 6 additions & 6 deletions index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ func TestIndexCrud(t *testing.T) {
assertTermDictionary(t, fd, []string{"code", "match"})

// tfr for field that doesn't exist
tfr, err := reader.TermFieldReader([]byte("marty"), "invalidfield", true, true, true)
tfr, err := reader.TermFieldReader(nil, []byte("marty"), "invalidfield", true, true, true)
if err != nil {
t.Fatalf("error getting term field reader: %v", err)
}
assertTermFieldReaderEmpty(t, tfr)

tfr, err = reader.TermFieldReader([]byte("marty"), "name", true, true, true)
tfr, err = reader.TermFieldReader(nil, []byte("marty"), "name", true, true, true)
if err != nil {
t.Fatalf("error getting term field reader: %v", err)
}
Expand Down Expand Up @@ -125,14 +125,14 @@ func TestIndexCrud(t *testing.T) {
})

// make sure previous name fails
tfr, err = reader.TermFieldReader([]byte("marty"), "name", true, true, true)
tfr, err = reader.TermFieldReader(nil, []byte("marty"), "name", true, true, true)
if err != nil {
t.Fatalf("error getting term field reader: %v", err)
}
assertTermFieldReaderEmpty(t, tfr)

// now look for what we expect to find
tfr, err = reader.TermFieldReader([]byte("tiger"), "name", true, true, true)
tfr, err = reader.TermFieldReader(nil, []byte("tiger"), "name", true, true, true)
if err != nil {
t.Fatalf("error getting term field reader: %v", err)
}
Expand Down Expand Up @@ -419,7 +419,7 @@ func assertEmptyIndex(t *testing.T, reader index.IndexReader) {
t.Errorf("expected doc count 0, got %d", count)
}

tfr, err := reader.TermFieldReader([]byte("b"), "field", true, true, true)
tfr, err := reader.TermFieldReader(nil, []byte("b"), "field", true, true, true)
if err != nil {
t.Fatalf("error getting term field reader: %v", err)
}
Expand Down Expand Up @@ -650,7 +650,7 @@ func TestMB47265(t *testing.T) {
}

for _, term := range []string{"one", "two", "three"} {
tfr, err := reader.TermFieldReader([]byte(term), "body", false, false, false)
tfr, err := reader.TermFieldReader(nil, []byte(term), "body", false, false, false)
if err != nil {
t.Fatalf("error setting up term field reader: %v, ", err)
}
Expand Down
3 changes: 2 additions & 1 deletion reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package sear

import (
"bytes"
"context"
"fmt"
"sort"
"strings"
Expand Down Expand Up @@ -50,7 +51,7 @@ func NewReader(m *Sear) *Reader {
return rv
}

func (r *Reader) TermFieldReader(term []byte, field string, includeFreq, includeNorm,
func (r *Reader) TermFieldReader(ctx context.Context, term []byte, field string, includeFreq, includeNorm,
includeTermVectors bool) (index.TermFieldReader, error) {
if r.s.doc == nil {
return termFieldReaderEmpty, nil
Expand Down

0 comments on commit 3d1f557

Please sign in to comment.