From bb883f67f9373d8becb581d5c3a05d4c37e88660 Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Tue, 10 Nov 2020 11:40:04 -0500 Subject: [PATCH 01/28] initial refactor to remove circular deps --- analysis/freq.go | 113 +----- analysis/freq_test.go | 124 +----- builder.go | 2 +- cmd/bleve/cmd/scorch/snapshot.go | 2 +- config.go | 2 +- document/document.go | 37 +- document/document_test.go | 2 +- document/field.go | 12 +- document/field_boolean.go | 38 +- document/field_composite.go | 39 +- document/field_datetime.go | 38 +- document/field_geopoint.go | 38 +- document/field_geopoint_test.go | 4 +- document/field_numeric.go | 38 +- document/field_numeric_test.go | 4 +- document/field_text.go | 38 +- go.mod | 12 +- go.sum | 145 +++++++ http/doc_get.go | 10 +- index.go | 8 +- index/analysis.go | 110 ----- index/field_cache.go | 88 ---- index/index.go | 376 ------------------ index/scorch/builder.go | 9 +- index/scorch/builder_test.go | 2 +- index/scorch/event_test.go | 2 +- index/scorch/field_dict_test.go | 2 +- index/scorch/introducer.go | 4 +- index/scorch/merge.go | 2 +- index/scorch/merge_test.go | 2 +- index/scorch/optimize.go | 4 +- index/scorch/persister.go | 4 +- index/scorch/reader_test.go | 2 +- index/scorch/rollback.go | 2 +- index/scorch/rollback_test.go | 2 +- index/scorch/scorch.go | 36 +- index/scorch/scorch_test.go | 22 +- index/scorch/segment/empty.go | 137 ------- index/scorch/segment/int.go | 176 -------- index/scorch/segment/int_test.go | 167 -------- index/scorch/segment/plugin.go | 58 --- index/scorch/segment/regexp.go | 75 ---- index/scorch/segment/regexp_test.go | 57 --- index/scorch/segment/segment.go | 153 ------- index/scorch/segment/unadorned.go | 160 -------- index/scorch/segment_plugin.go | 12 +- index/scorch/snapshot_index.go | 20 +- index/scorch/snapshot_index_dict.go | 4 +- index/scorch/snapshot_index_doc.go | 2 +- index/scorch/snapshot_index_tfr.go | 4 +- index/scorch/snapshot_segment.go | 4 +- index/store/batch.go | 62 --- index/store/boltdb/reader.go | 2 +- index/store/boltdb/store.go | 2 +- index/store/boltdb/store_test.go | 2 +- index/store/boltdb/writer.go | 2 +- index/store/goleveldb/batch.go | 2 +- index/store/goleveldb/reader.go | 2 +- index/store/goleveldb/store.go | 2 +- index/store/goleveldb/store_test.go | 2 +- index/store/goleveldb/writer.go | 2 +- index/store/gtreap/reader.go | 2 +- index/store/gtreap/store.go | 2 +- index/store/gtreap/store_test.go | 2 +- index/store/gtreap/writer.go | 2 +- index/store/kvstore.go | 174 -------- index/store/merge.go | 64 --- index/store/metrics/batch.go | 2 +- index/store/metrics/iterator.go | 2 +- index/store/metrics/reader.go | 2 +- index/store/metrics/stats.go | 2 +- index/store/metrics/store.go | 2 +- index/store/metrics/store_test.go | 2 +- index/store/metrics/writer.go | 2 +- index/store/moss/batch.go | 2 +- index/store/moss/lower.go | 2 +- index/store/moss/lower_test.go | 2 +- index/store/moss/reader.go | 2 +- index/store/moss/stats.go | 2 +- index/store/moss/store.go | 2 +- index/store/moss/store_test.go | 2 +- index/store/moss/writer.go | 2 +- index/store/multiget.go | 33 -- index/store/null/null.go | 2 +- index/store/null/null_test.go | 2 +- index/store/test/bytes.go | 2 +- index/store/test/crud.go | 2 +- index/store/test/isolation.go | 2 +- index/store/test/iterator.go | 2 +- index/store/test/merge.go | 2 +- index/upsidedown/analysis.go | 42 +- index/upsidedown/analysis_test.go | 2 +- index/upsidedown/benchmark_common_test.go | 6 +- index/upsidedown/dump.go | 2 +- index/upsidedown/dump_test.go | 2 +- index/upsidedown/field_dict.go | 4 +- index/upsidedown/field_dict_test.go | 2 +- index/upsidedown/index_reader.go | 15 +- index/upsidedown/reader.go | 4 +- index/upsidedown/reader_test.go | 2 +- index/upsidedown/stats.go | 2 +- index/upsidedown/upsidedown.go | 23 +- index/upsidedown/upsidedown_test.go | 17 +- index_alias_impl.go | 7 +- index_alias_impl_test.go | 6 +- index_impl.go | 12 +- index_test.go | 26 +- registry/index_type.go | 2 +- registry/store.go | 2 +- search/collector.go | 2 +- search/collector/bench_test.go | 2 +- search/collector/search_test.go | 5 +- search/collector/topn.go | 2 +- search/collector/topn_test.go | 2 +- search/facets_builder.go | 2 +- search/highlight/highlighter.go | 6 +- .../highlighter/simple/highlighter_simple.go | 9 +- search/query/bool_field.go | 2 +- search/query/boolean.go | 2 +- search/query/conjunction.go | 2 +- search/query/date_range.go | 2 +- search/query/disjunction.go | 2 +- search/query/docid.go | 2 +- search/query/fuzzy.go | 2 +- search/query/geo_boundingbox.go | 2 +- search/query/geo_boundingpolygon.go | 2 +- search/query/geo_distance.go | 2 +- search/query/match.go | 2 +- search/query/match_all.go | 2 +- search/query/match_none.go | 2 +- search/query/match_phrase.go | 2 +- search/query/multi_phrase.go | 2 +- search/query/numeric_range.go | 2 +- search/query/phrase.go | 2 +- search/query/prefix.go | 2 +- search/query/query.go | 2 +- search/query/query_string.go | 2 +- search/query/regexp.go | 2 +- search/query/term.go | 2 +- search/query/term_range.go | 2 +- search/query/wildcard.go | 2 +- search/scorer/scorer_constant.go | 2 +- search/scorer/scorer_constant_test.go | 2 +- search/scorer/scorer_term.go | 2 +- search/scorer/scorer_term_test.go | 2 +- search/search.go | 2 +- search/searcher/base_test.go | 2 +- search/searcher/search_boolean.go | 2 +- search/searcher/search_boolean_test.go | 2 +- search/searcher/search_conjunction.go | 2 +- search/searcher/search_conjunction_test.go | 2 +- search/searcher/search_disjunction.go | 2 +- search/searcher/search_disjunction_heap.go | 2 +- search/searcher/search_disjunction_slice.go | 2 +- search/searcher/search_disjunction_test.go | 2 +- search/searcher/search_docid.go | 2 +- search/searcher/search_docid_test.go | 11 +- search/searcher/search_filter.go | 2 +- search/searcher/search_fuzzy.go | 2 +- search/searcher/search_fuzzy_test.go | 2 +- search/searcher/search_geoboundingbox.go | 2 +- search/searcher/search_geoboundingbox_test.go | 92 ++--- search/searcher/search_geopointdistance.go | 2 +- .../searcher/search_geopointdistance_test.go | 2 +- search/searcher/search_geopolygon.go | 2 +- search/searcher/search_geopolygon_test.go | 128 ++---- search/searcher/search_match_all.go | 2 +- search/searcher/search_match_all_test.go | 2 +- search/searcher/search_match_none.go | 2 +- search/searcher/search_multi_term.go | 2 +- search/searcher/search_numeric_range.go | 2 +- search/searcher/search_phrase.go | 2 +- search/searcher/search_phrase_test.go | 2 +- search/searcher/search_regexp.go | 2 +- search/searcher/search_regexp_test.go | 2 +- search/searcher/search_term.go | 2 +- search/searcher/search_term_prefix.go | 2 +- search/searcher/search_term_range.go | 2 +- search/searcher/search_term_test.go | 92 ++--- 179 files changed, 817 insertions(+), 2637 deletions(-) create mode 100644 go.sum delete mode 100644 index/analysis.go delete mode 100644 index/field_cache.go delete mode 100644 index/index.go delete mode 100644 index/scorch/segment/empty.go delete mode 100644 index/scorch/segment/int.go delete mode 100644 index/scorch/segment/int_test.go delete mode 100644 index/scorch/segment/plugin.go delete mode 100644 index/scorch/segment/regexp.go delete mode 100644 index/scorch/segment/regexp_test.go delete mode 100644 index/scorch/segment/segment.go delete mode 100644 index/scorch/segment/unadorned.go delete mode 100644 index/store/batch.go delete mode 100644 index/store/kvstore.go delete mode 100644 index/store/merge.go delete mode 100644 index/store/multiget.go diff --git a/analysis/freq.go b/analysis/freq.go index 198c149b2..e44c90eb9 100644 --- a/analysis/freq.go +++ b/analysis/freq.go @@ -15,105 +15,18 @@ package analysis import ( - "reflect" - - "github.com/blevesearch/bleve/size" + index "github.com/blevesearch/bleve_index_api" ) -var reflectStaticSizeTokenLocation int -var reflectStaticSizeTokenFreq int - -func init() { - var tl TokenLocation - reflectStaticSizeTokenLocation = int(reflect.TypeOf(tl).Size()) - var tf TokenFreq - reflectStaticSizeTokenFreq = int(reflect.TypeOf(tf).Size()) -} - -// TokenLocation represents one occurrence of a term at a particular location in -// a field. Start, End and Position have the same meaning as in analysis.Token. -// Field and ArrayPositions identify the field value in the source document. -// See document.Field for details. -type TokenLocation struct { - Field string - ArrayPositions []uint64 - Start int - End int - Position int -} - -func (tl *TokenLocation) Size() int { - rv := reflectStaticSizeTokenLocation - rv += len(tl.ArrayPositions) * size.SizeOfUint64 - return rv -} - -// TokenFreq represents all the occurrences of a term in all fields of a -// document. -type TokenFreq struct { - Term []byte - Locations []*TokenLocation - frequency int -} - -func (tf *TokenFreq) Size() int { - rv := reflectStaticSizeTokenFreq - rv += len(tf.Term) - for _, loc := range tf.Locations { - rv += loc.Size() - } - return rv -} - -func (tf *TokenFreq) Frequency() int { - return tf.frequency -} - -// TokenFrequencies maps document terms to their combined frequencies from all -// fields. -type TokenFrequencies map[string]*TokenFreq - -func (tfs TokenFrequencies) Size() int { - rv := size.SizeOfMap - rv += len(tfs) * (size.SizeOfString + size.SizeOfPtr) - for k, v := range tfs { - rv += len(k) - rv += v.Size() - } - return rv -} - -func (tfs TokenFrequencies) MergeAll(remoteField string, other TokenFrequencies) { - // walk the new token frequencies - for tfk, tf := range other { - // set the remoteField value in incoming token freqs - for _, l := range tf.Locations { - l.Field = remoteField - } - existingTf, exists := tfs[tfk] - if exists { - existingTf.Locations = append(existingTf.Locations, tf.Locations...) - existingTf.frequency = existingTf.frequency + tf.frequency - } else { - tfs[tfk] = &TokenFreq{ - Term: tf.Term, - frequency: tf.frequency, - Locations: make([]*TokenLocation, len(tf.Locations)), - } - copy(tfs[tfk].Locations, tf.Locations) - } - } -} - -func TokenFrequency(tokens TokenStream, arrayPositions []uint64, includeTermVectors bool) TokenFrequencies { - rv := make(map[string]*TokenFreq, len(tokens)) +func TokenFrequency(tokens TokenStream, arrayPositions []uint64, includeTermVectors bool) index.TokenFrequencies { + rv := make(map[string]*index.TokenFreq, len(tokens)) if includeTermVectors { - tls := make([]TokenLocation, len(tokens)) + tls := make([]index.TokenLocation, len(tokens)) tlNext := 0 for _, token := range tokens { - tls[tlNext] = TokenLocation{ + tls[tlNext] = index.TokenLocation{ ArrayPositions: arrayPositions, Start: token.Start, End: token.End, @@ -123,13 +36,13 @@ func TokenFrequency(tokens TokenStream, arrayPositions []uint64, includeTermVect curr, ok := rv[string(token.Term)] if ok { curr.Locations = append(curr.Locations, &tls[tlNext]) - curr.frequency++ + curr.SetFrequency(curr.Frequency() + 1) } else { - rv[string(token.Term)] = &TokenFreq{ + rv[string(token.Term)] = &index.TokenFreq{ Term: token.Term, - Locations: []*TokenLocation{&tls[tlNext]}, - frequency: 1, + Locations: []*index.TokenLocation{&tls[tlNext]}, } + rv[string(token.Term)].SetFrequency(1) } tlNext++ @@ -138,12 +51,12 @@ func TokenFrequency(tokens TokenStream, arrayPositions []uint64, includeTermVect for _, token := range tokens { curr, exists := rv[string(token.Term)] if exists { - curr.frequency++ + curr.SetFrequency(curr.Frequency() + 1) } else { - rv[string(token.Term)] = &TokenFreq{ - Term: token.Term, - frequency: 1, + rv[string(token.Term)] = &index.TokenFreq{ + Term: token.Term, } + rv[string(token.Term)].SetFrequency(1) } } } diff --git a/analysis/freq_test.go b/analysis/freq_test.go index 36dce23c7..19d2c82d9 100644 --- a/analysis/freq_test.go +++ b/analysis/freq_test.go @@ -12,9 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. + package analysis import ( + index "github.com/blevesearch/bleve_index_api" "reflect" "testing" ) @@ -34,10 +36,10 @@ func TestTokenFrequency(t *testing.T) { End: 11, }, } - expectedResult := TokenFrequencies{ - "water": &TokenFreq{ + expectedResult := index.TokenFrequencies{ + "water": &index.TokenFreq{ Term: []byte("water"), - Locations: []*TokenLocation{ + Locations: []*index.TokenLocation{ { Position: 1, Start: 0, @@ -49,125 +51,11 @@ func TestTokenFrequency(t *testing.T) { End: 11, }, }, - frequency: 2, }, } + expectedResult["water"].SetFrequency(2) result := TokenFrequency(tokens, nil, true) if !reflect.DeepEqual(result, expectedResult) { t.Errorf("expected %#v, got %#v", expectedResult, result) } } - -func TestTokenFrequenciesMergeAll(t *testing.T) { - tf1 := TokenFrequencies{ - "water": &TokenFreq{ - Term: []byte("water"), - Locations: []*TokenLocation{ - { - Position: 1, - Start: 0, - End: 5, - }, - { - Position: 2, - Start: 6, - End: 11, - }, - }, - }, - } - tf2 := TokenFrequencies{ - "water": &TokenFreq{ - Term: []byte("water"), - Locations: []*TokenLocation{ - { - Position: 1, - Start: 0, - End: 5, - }, - { - Position: 2, - Start: 6, - End: 11, - }, - }, - }, - } - expectedResult := TokenFrequencies{ - "water": &TokenFreq{ - Term: []byte("water"), - Locations: []*TokenLocation{ - { - Position: 1, - Start: 0, - End: 5, - }, - { - Position: 2, - Start: 6, - End: 11, - }, - { - Field: "tf2", - Position: 1, - Start: 0, - End: 5, - }, - { - Field: "tf2", - Position: 2, - Start: 6, - End: 11, - }, - }, - }, - } - tf1.MergeAll("tf2", tf2) - if !reflect.DeepEqual(tf1, expectedResult) { - t.Errorf("expected %#v, got %#v", expectedResult, tf1) - } -} - -func TestTokenFrequenciesMergeAllLeftEmpty(t *testing.T) { - tf1 := TokenFrequencies{} - tf2 := TokenFrequencies{ - "water": &TokenFreq{ - Term: []byte("water"), - Locations: []*TokenLocation{ - { - Position: 1, - Start: 0, - End: 5, - }, - { - Position: 2, - Start: 6, - End: 11, - }, - }, - }, - } - expectedResult := TokenFrequencies{ - "water": &TokenFreq{ - Term: []byte("water"), - Locations: []*TokenLocation{ - { - Field: "tf2", - Position: 1, - Start: 0, - End: 5, - }, - { - Field: "tf2", - Position: 2, - Start: 6, - End: 11, - }, - }, - }, - } - tf1.MergeAll("tf2", tf2) - if !reflect.DeepEqual(tf1, expectedResult) { - t.Errorf("expected %#v, got %#v", expectedResult, tf1) - } -} diff --git a/builder.go b/builder.go index de00c97b6..011933497 100644 --- a/builder.go +++ b/builder.go @@ -19,9 +19,9 @@ import ( "fmt" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" "github.com/blevesearch/bleve/index/scorch" "github.com/blevesearch/bleve/mapping" + index "github.com/blevesearch/bleve_index_api" ) type builderImpl struct { diff --git a/cmd/bleve/cmd/scorch/snapshot.go b/cmd/bleve/cmd/scorch/snapshot.go index 3dee55895..db8e1c51d 100644 --- a/cmd/bleve/cmd/scorch/snapshot.go +++ b/cmd/bleve/cmd/scorch/snapshot.go @@ -18,7 +18,7 @@ import ( "fmt" "strconv" - seg "github.com/blevesearch/bleve/index/scorch/segment" + seg "github.com/blevesearch/scorch_segment_api" "github.com/spf13/cobra" ) diff --git a/config.go b/config.go index 99f2e081f..41cd2502c 100644 --- a/config.go +++ b/config.go @@ -20,11 +20,11 @@ import ( "log" "time" - "github.com/blevesearch/bleve/index" "github.com/blevesearch/bleve/index/store/gtreap" "github.com/blevesearch/bleve/index/upsidedown" "github.com/blevesearch/bleve/registry" "github.com/blevesearch/bleve/search/highlight/highlighter/html" + index "github.com/blevesearch/bleve_index_api" // force import of scorch so its accessible by default _ "github.com/blevesearch/bleve/index/scorch" diff --git a/document/document.go b/document/document.go index 6ac17b9ab..98d855966 100644 --- a/document/document.go +++ b/document/document.go @@ -19,6 +19,7 @@ import ( "reflect" "github.com/blevesearch/bleve/size" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeDocument int @@ -29,14 +30,14 @@ func init() { } type Document struct { - ID string `json:"id"` + id string `json:"id"` Fields []Field `json:"fields"` CompositeFields []*CompositeField } func NewDocument(id string) *Document { return &Document{ - ID: id, + id: id, Fields: make([]Field, 0), CompositeFields: make([]*CompositeField, 0), } @@ -44,7 +45,7 @@ func NewDocument(id string) *Document { func (d *Document) Size() int { sizeInBytes := reflectStaticSizeDocument + size.SizeOfPtr + - len(d.ID) + len(d.id) for _, entry := range d.Fields { sizeInBytes += entry.Size() @@ -82,7 +83,7 @@ func (d *Document) GoString() string { } compositeFields += fmt.Sprintf("%#v", field) } - return fmt.Sprintf("&document.Document{ID:%s, Fields: %s, CompositeFields: %s}", d.ID, fields, compositeFields) + return fmt.Sprintf("&document.Document{ID:%s, Fields: %s, CompositeFields: %s}", d.ID(), fields, compositeFields) } func (d *Document) NumPlainTextBytes() uint64 { @@ -99,3 +100,31 @@ func (d *Document) NumPlainTextBytes() uint64 { } return rv } + +func (d *Document) ID() string { + return d.id +} + +func (d *Document) SetID(id string) { + d.id = id +} + +func (d *Document) AddIDField() { + d.AddField(NewTextFieldCustom("_id", nil, []byte(d.ID()), IndexField|StoreField, nil)) +} + +func (d *Document) VisitFields(visitor index.FieldVisitor) { + for _, f := range d.Fields { + visitor(f) + } +} + +func (d *Document) VisitComposite(visitor index.CompositeFieldVisitor) { + for _, f := range d.CompositeFields { + visitor(f) + } +} + +func (d *Document) HasComposite() bool { + return len(d.CompositeFields) > 0 +} diff --git a/document/document_test.go b/document/document_test.go index 7db862aed..22aff7a9f 100644 --- a/document/document_test.go +++ b/document/document_test.go @@ -67,7 +67,7 @@ func TestDocumentNumPlainTextBytes(t *testing.T) { for _, test := range tests { actual := test.doc.NumPlainTextBytes() if actual != test.num { - t.Errorf("expected doc '%s' to have %d plain text bytes, got %d", test.doc.ID, test.num, actual) + t.Errorf("expected doc '%s' to have %d plain text bytes, got %d", test.doc.ID(), test.num, actual) } } } diff --git a/document/field.go b/document/field.go index 2fe916698..c94f5d4d5 100644 --- a/document/field.go +++ b/document/field.go @@ -15,7 +15,7 @@ package document import ( - "github.com/blevesearch/bleve/analysis" + index "github.com/blevesearch/bleve_index_api" ) type Field interface { @@ -29,7 +29,7 @@ type Field interface { // "doc1", then "field" in "doc2". ArrayPositions() []uint64 Options() IndexingOptions - Analyze() (int, analysis.TokenFrequencies) + Analyze() Value() []byte // NumPlainTextBytes should return the number of plain text bytes @@ -38,4 +38,12 @@ type Field interface { NumPlainTextBytes() uint64 Size() int + + EncodedFieldType() byte + IsIndexed() bool + IsStored() bool + IncludeDocValues() bool + IncludeTermVectors() bool + AnalyzedLength() int + AnalyzedTokenFrequencies() index.TokenFrequencies } diff --git a/document/field_boolean.go b/document/field_boolean.go index 6864b16f4..36bbf8f9e 100644 --- a/document/field_boolean.go +++ b/document/field_boolean.go @@ -20,6 +20,7 @@ import ( "github.com/blevesearch/bleve/analysis" "github.com/blevesearch/bleve/size" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeBooleanField int @@ -37,6 +38,8 @@ type BooleanField struct { options IndexingOptions value []byte numPlainTextBytes uint64 + length int + frequencies index.TokenFrequencies } func (b *BooleanField) Size() int { @@ -58,7 +61,7 @@ func (b *BooleanField) Options() IndexingOptions { return b.options } -func (b *BooleanField) Analyze() (int, analysis.TokenFrequencies) { +func (b *BooleanField) Analyze() { tokens := make(analysis.TokenStream, 0) tokens = append(tokens, &analysis.Token{ Start: 0, @@ -68,9 +71,8 @@ func (b *BooleanField) Analyze() (int, analysis.TokenFrequencies) { Type: analysis.Boolean, }) - fieldLength := len(tokens) - tokenFreqs := analysis.TokenFrequency(tokens, b.arrayPositions, b.options.IncludeTermVectors()) - return fieldLength, tokenFreqs + b.length = len(tokens) + b.frequencies = analysis.TokenFrequency(tokens, b.arrayPositions, b.options.IncludeTermVectors()) } func (b *BooleanField) Value() []byte { @@ -92,6 +94,34 @@ func (b *BooleanField) NumPlainTextBytes() uint64 { return b.numPlainTextBytes } +func (b *BooleanField) EncodedFieldType() byte { + return 'b' +} + +func (b *BooleanField) IsIndexed() bool { + return b.options.IsIndexed() +} + +func (b *BooleanField) IsStored() bool { + return b.options.IsStored() +} + +func (b *BooleanField) IncludeDocValues() bool { + return b.options.IncludeDocValues() +} + +func (b *BooleanField) IncludeTermVectors() bool { + return b.options.IncludeTermVectors() +} + +func (b *BooleanField) AnalyzedLength() int { + return b.length +} + +func (b *BooleanField) AnalyzedTokenFrequencies() index.TokenFrequencies { + return b.frequencies +} + func NewBooleanFieldFromBytes(name string, arrayPositions []uint64, value []byte) *BooleanField { return &BooleanField{ name: name, diff --git a/document/field_composite.go b/document/field_composite.go index a8285880f..e9458dbb3 100644 --- a/document/field_composite.go +++ b/document/field_composite.go @@ -17,8 +17,8 @@ package document import ( "reflect" - "github.com/blevesearch/bleve/analysis" "github.com/blevesearch/bleve/size" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeCompositeField int @@ -37,7 +37,7 @@ type CompositeField struct { defaultInclude bool options IndexingOptions totalLength int - compositeFrequencies analysis.TokenFrequencies + compositeFrequencies index.TokenFrequencies } func NewCompositeField(name string, defaultInclude bool, include []string, exclude []string) *CompositeField { @@ -51,7 +51,7 @@ func NewCompositeFieldWithIndexingOptions(name string, defaultInclude bool, incl defaultInclude: defaultInclude, includedFields: make(map[string]bool, len(include)), excludedFields: make(map[string]bool, len(exclude)), - compositeFrequencies: make(analysis.TokenFrequencies), + compositeFrequencies: make(index.TokenFrequencies), } for _, i := range include { @@ -91,8 +91,7 @@ func (c *CompositeField) Options() IndexingOptions { return c.options } -func (c *CompositeField) Analyze() (int, analysis.TokenFrequencies) { - return c.totalLength, c.compositeFrequencies +func (c *CompositeField) Analyze() { } func (c *CompositeField) Value() []byte { @@ -116,9 +115,37 @@ func (c *CompositeField) includesField(field string) bool { return shouldInclude } -func (c *CompositeField) Compose(field string, length int, freq analysis.TokenFrequencies) { +func (c *CompositeField) Compose(field string, length int, freq index.TokenFrequencies) { if c.includesField(field) { c.totalLength += length c.compositeFrequencies.MergeAll(field, freq) } } + +func (c *CompositeField) EncodedFieldType() byte { + return 'c' +} + +func (c *CompositeField) IsIndexed() bool { + return c.options.IsIndexed() +} + +func (c *CompositeField) IsStored() bool { + return c.options.IsStored() +} + +func (c *CompositeField) IncludeDocValues() bool { + return c.options.IncludeDocValues() +} + +func (c *CompositeField) IncludeTermVectors() bool { + return c.options.IncludeTermVectors() +} + +func (c *CompositeField) AnalyzedLength() int { + return c.totalLength +} + +func (c *CompositeField) AnalyzedTokenFrequencies() index.TokenFrequencies { + return c.compositeFrequencies +} diff --git a/document/field_datetime.go b/document/field_datetime.go index 583b44cde..f61d15db9 100644 --- a/document/field_datetime.go +++ b/document/field_datetime.go @@ -23,6 +23,7 @@ import ( "github.com/blevesearch/bleve/analysis" "github.com/blevesearch/bleve/numeric" "github.com/blevesearch/bleve/size" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeDateTimeField int @@ -44,6 +45,8 @@ type DateTimeField struct { options IndexingOptions value numeric.PrefixCoded numPlainTextBytes uint64 + length int + frequencies index.TokenFrequencies } func (n *DateTimeField) Size() int { @@ -64,7 +67,35 @@ func (n *DateTimeField) Options() IndexingOptions { return n.options } -func (n *DateTimeField) Analyze() (int, analysis.TokenFrequencies) { +func (n *DateTimeField) EncodedFieldType() byte { + return 'd' +} + +func (n *DateTimeField) IsIndexed() bool { + return n.options.IsIndexed() +} + +func (n *DateTimeField) IsStored() bool { + return n.options.IsStored() +} + +func (n *DateTimeField) IncludeDocValues() bool { + return n.options.IncludeDocValues() +} + +func (n *DateTimeField) IncludeTermVectors() bool { + return n.options.IncludeTermVectors() +} + +func (n *DateTimeField) AnalyzedLength() int { + return n.length +} + +func (n *DateTimeField) AnalyzedTokenFrequencies() index.TokenFrequencies { + return n.frequencies +} + +func (n *DateTimeField) Analyze() { tokens := make(analysis.TokenStream, 0) tokens = append(tokens, &analysis.Token{ Start: 0, @@ -95,9 +126,8 @@ func (n *DateTimeField) Analyze() (int, analysis.TokenFrequencies) { } } - fieldLength := len(tokens) - tokenFreqs := analysis.TokenFrequency(tokens, n.arrayPositions, n.options.IncludeTermVectors()) - return fieldLength, tokenFreqs + n.length = len(tokens) + n.frequencies = analysis.TokenFrequency(tokens, n.arrayPositions, n.options.IncludeTermVectors()) } func (n *DateTimeField) Value() []byte { diff --git a/document/field_geopoint.go b/document/field_geopoint.go index 91fe23f96..48e63965b 100644 --- a/document/field_geopoint.go +++ b/document/field_geopoint.go @@ -22,6 +22,7 @@ import ( "github.com/blevesearch/bleve/geo" "github.com/blevesearch/bleve/numeric" "github.com/blevesearch/bleve/size" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeGeoPointField int @@ -39,6 +40,8 @@ type GeoPointField struct { options IndexingOptions value numeric.PrefixCoded numPlainTextBytes uint64 + length int + frequencies index.TokenFrequencies } func (n *GeoPointField) Size() int { @@ -59,7 +62,35 @@ func (n *GeoPointField) Options() IndexingOptions { return n.options } -func (n *GeoPointField) Analyze() (int, analysis.TokenFrequencies) { +func (n *GeoPointField) EncodedFieldType() byte { + return 'g' +} + +func (n *GeoPointField) IsIndexed() bool { + return n.options.IsIndexed() +} + +func (n *GeoPointField) IsStored() bool { + return n.options.IsStored() +} + +func (n *GeoPointField) IncludeDocValues() bool { + return n.options.IncludeDocValues() +} + +func (n *GeoPointField) IncludeTermVectors() bool { + return n.options.IncludeTermVectors() +} + +func (n *GeoPointField) AnalyzedLength() int { + return n.length +} + +func (n *GeoPointField) AnalyzedTokenFrequencies() index.TokenFrequencies { + return n.frequencies +} + +func (n *GeoPointField) Analyze() { tokens := make(analysis.TokenStream, 0) tokens = append(tokens, &analysis.Token{ Start: 0, @@ -90,9 +121,8 @@ func (n *GeoPointField) Analyze() (int, analysis.TokenFrequencies) { } } - fieldLength := len(tokens) - tokenFreqs := analysis.TokenFrequency(tokens, n.arrayPositions, n.options.IncludeTermVectors()) - return fieldLength, tokenFreqs + n.length = len(tokens) + n.frequencies = analysis.TokenFrequency(tokens, n.arrayPositions, n.options.IncludeTermVectors()) } func (n *GeoPointField) Value() []byte { diff --git a/document/field_geopoint_test.go b/document/field_geopoint_test.go index d705ac709..286026482 100644 --- a/document/field_geopoint_test.go +++ b/document/field_geopoint_test.go @@ -4,7 +4,9 @@ import "testing" func TestGeoPointField(t *testing.T) { gf := NewGeoPointField("loc", []uint64{}, 0.0015, 0.0015) - numTokens, tokenFreqs := gf.Analyze() + gf.Analyze() + numTokens := gf.AnalyzedLength() + tokenFreqs := gf.AnalyzedTokenFrequencies() if numTokens != 8 { t.Errorf("expected 8 tokens, got %d", numTokens) } diff --git a/document/field_numeric.go b/document/field_numeric.go index 46c685e84..994848f41 100644 --- a/document/field_numeric.go +++ b/document/field_numeric.go @@ -21,6 +21,7 @@ import ( "github.com/blevesearch/bleve/analysis" "github.com/blevesearch/bleve/numeric" "github.com/blevesearch/bleve/size" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeNumericField int @@ -40,6 +41,8 @@ type NumericField struct { options IndexingOptions value numeric.PrefixCoded numPlainTextBytes uint64 + length int + frequencies index.TokenFrequencies } func (n *NumericField) Size() int { @@ -60,7 +63,35 @@ func (n *NumericField) Options() IndexingOptions { return n.options } -func (n *NumericField) Analyze() (int, analysis.TokenFrequencies) { +func (n *NumericField) EncodedFieldType() byte { + return 'n' +} + +func (n *NumericField) IsIndexed() bool { + return n.options.IsIndexed() +} + +func (n *NumericField) IsStored() bool { + return n.options.IsStored() +} + +func (n *NumericField) IncludeDocValues() bool { + return n.options.IncludeDocValues() +} + +func (n *NumericField) IncludeTermVectors() bool { + return n.options.IncludeTermVectors() +} + +func (n *NumericField) AnalyzedLength() int { + return n.length +} + +func (n *NumericField) AnalyzedTokenFrequencies() index.TokenFrequencies { + return n.frequencies +} + +func (n *NumericField) Analyze() { tokens := make(analysis.TokenStream, 0) tokens = append(tokens, &analysis.Token{ Start: 0, @@ -91,9 +122,8 @@ func (n *NumericField) Analyze() (int, analysis.TokenFrequencies) { } } - fieldLength := len(tokens) - tokenFreqs := analysis.TokenFrequency(tokens, n.arrayPositions, n.options.IncludeTermVectors()) - return fieldLength, tokenFreqs + n.length = len(tokens) + n.frequencies = analysis.TokenFrequency(tokens, n.arrayPositions, n.options.IncludeTermVectors()) } func (n *NumericField) Value() []byte { diff --git a/document/field_numeric_test.go b/document/field_numeric_test.go index 5134f8ea6..5f36d6875 100644 --- a/document/field_numeric_test.go +++ b/document/field_numeric_test.go @@ -20,7 +20,9 @@ import ( func TestNumericField(t *testing.T) { nf := NewNumericField("age", []uint64{}, 3.4) - numTokens, tokenFreqs := nf.Analyze() + nf.Analyze() + numTokens := nf.AnalyzedLength() + tokenFreqs := nf.AnalyzedTokenFrequencies() if numTokens != 16 { t.Errorf("expected 16 tokens") } diff --git a/document/field_text.go b/document/field_text.go index 6bd74c712..1396dc76f 100644 --- a/document/field_text.go +++ b/document/field_text.go @@ -20,6 +20,7 @@ import ( "github.com/blevesearch/bleve/analysis" "github.com/blevesearch/bleve/size" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeTextField int @@ -38,6 +39,8 @@ type TextField struct { analyzer *analysis.Analyzer value []byte numPlainTextBytes uint64 + length int + frequencies index.TokenFrequencies } func (t *TextField) Size() int { @@ -59,7 +62,35 @@ func (t *TextField) Options() IndexingOptions { return t.options } -func (t *TextField) Analyze() (int, analysis.TokenFrequencies) { +func (t *TextField) EncodedFieldType() byte { + return 't' +} + +func (t *TextField) IsIndexed() bool { + return t.options.IsIndexed() +} + +func (t *TextField) IsStored() bool { + return t.options.IsStored() +} + +func (t *TextField) IncludeDocValues() bool { + return t.options.IncludeDocValues() +} + +func (t *TextField) IncludeTermVectors() bool { + return t.options.IncludeTermVectors() +} + +func (t *TextField) AnalyzedLength() int { + return t.length +} + +func (t *TextField) AnalyzedTokenFrequencies() index.TokenFrequencies { + return t.frequencies +} + +func (t *TextField) Analyze() { var tokens analysis.TokenStream if t.analyzer != nil { bytesToAnalyze := t.Value() @@ -81,9 +112,8 @@ func (t *TextField) Analyze() (int, analysis.TokenFrequencies) { }, } } - fieldLength := len(tokens) // number of tokens in this doc field - tokenFreqs := analysis.TokenFrequency(tokens, t.arrayPositions, t.options.IncludeTermVectors()) - return fieldLength, tokenFreqs + t.length = len(tokens) // number of tokens in this doc field + t.frequencies = analysis.TokenFrequency(tokens, t.arrayPositions, t.options.IncludeTermVectors()) } func (t *TextField) Analyzer() *analysis.Analyzer { diff --git a/go.mod b/go.mod index fe5d25a35..8cee3123a 100644 --- a/go.mod +++ b/go.mod @@ -4,15 +4,17 @@ go 1.13 require ( github.com/RoaringBitmap/roaring v0.4.23 + github.com/blevesearch/bleve_index_api v0.0.0-20201109204916-3d41c3915248 github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040 github.com/blevesearch/go-porterstemmer v1.0.3 + github.com/blevesearch/scorch_segment_api v0.0.0-20201109215555-85deb08a9c2d github.com/blevesearch/segment v0.9.0 github.com/blevesearch/snowballstem v0.9.0 - github.com/blevesearch/zap/v11 v11.0.12 - github.com/blevesearch/zap/v12 v12.0.12 - github.com/blevesearch/zap/v13 v13.0.4 - github.com/blevesearch/zap/v14 v14.0.3 - github.com/blevesearch/zap/v15 v15.0.1 + github.com/blevesearch/zapx/v11 v11.1.0 + github.com/blevesearch/zapx/v12 v12.1.0 + github.com/blevesearch/zapx/v13 v13.1.0 + github.com/blevesearch/zapx/v14 v14.1.0 + github.com/blevesearch/zapx/v15 v15.1.0 github.com/couchbase/moss v0.1.0 github.com/couchbase/vellum v1.0.2 github.com/golang/protobuf v1.3.2 diff --git a/go.sum b/go.sum new file mode 100644 index 000000000..ce5eea393 --- /dev/null +++ b/go.sum @@ -0,0 +1,145 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/RoaringBitmap/roaring v0.4.23 h1:gpyfd12QohbqhFO4NVDUdoPOCXsyahYRQhINmlHxKeo= +github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= +github.com/RoaringBitmap/roaring v0.5.5 h1:naNqvO1mNnghk2UvcsqnzHDBn9DRbCIRy94GmDTRVTQ= +github.com/RoaringBitmap/roaring v0.5.5/go.mod h1:puNo5VdzwbaIQxSiDIwfXl4Hnc+fbovcX4IW/dSTtUk= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/blevesearch/bleve v1.0.12/go.mod h1:G0ErXWdIrUSYZLPoMpS9Z3saTnTsk4ebhPsVv/+0nxk= +github.com/blevesearch/bleve_index_api v0.0.0-20201109204916-3d41c3915248 h1:3KzsHcOHdbPPc3MSxtqfpXxgchiAqiU0ov2VnHqm+Nc= +github.com/blevesearch/bleve_index_api v0.0.0-20201109204916-3d41c3915248/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= +github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040/go.mod h1:WH+MU2F4T0VmSdaPX+Wu5GYoZBrYWdOZWSjzvYcDmqQ= +github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo= +github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M= +github.com/blevesearch/mmap-go v1.0.2 h1:JtMHb+FgQCTTYIhtMvimw15dJwu1Y5lrZDMOFXVWPk0= +github.com/blevesearch/mmap-go v1.0.2/go.mod h1:ol2qBqYaOUsGdm7aRMRrYGgPvnwLe6Y+7LMvAB5IbSA= +github.com/blevesearch/scorch_segment_api v0.0.0-20201109215555-85deb08a9c2d h1:24HCXKs9lFipAFIp1mA72sMqjw1lG0rR4o23ADkUPQk= +github.com/blevesearch/scorch_segment_api v0.0.0-20201109215555-85deb08a9c2d/go.mod h1:VF37IOJNFEiW0R5t2sJbGGylO1J2hkLOlbhY27n6T7Y= +github.com/blevesearch/segment v0.9.0 h1:5lG7yBCx98or7gK2cHMKPukPZ/31Kag7nONpoBt22Ac= +github.com/blevesearch/segment v0.9.0/go.mod h1:9PfHYUdQCgHktBgvtUOF4x+pc4/l8rdH0u5spnW85UQ= +github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s= +github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs= +github.com/blevesearch/zap/v11 v11.0.12 h1:ZA+80yajko2tXr1kmbSoVRMCo0mFZAVJmoijjYsZuwc= +github.com/blevesearch/zap/v11 v11.0.12/go.mod h1:JLfFhc8DWP01zMG/6VwEY2eAnlJsTN1vDE4S0rC5Y78= +github.com/blevesearch/zap/v12 v12.0.12 h1:9eWaL9/2hcjy1VR3lrl/b+kWh5G7w/BkNYI07mWActw= +github.com/blevesearch/zap/v12 v12.0.12/go.mod h1:1HrB4hhPfI8u8x4SPYbluhb8xhflpPvvj8EcWImNnJY= +github.com/blevesearch/zap/v13 v13.0.4 h1:eoRvJmLeIQUs1mAF+fAFALg1dPHOI1e1KFuXL0I7us4= +github.com/blevesearch/zap/v13 v13.0.4/go.mod h1:YdB7UuG7TBWu/1dz9e2SaLp1RKfFfdJx+ulIK5HR1bA= +github.com/blevesearch/zap/v14 v14.0.3 h1:ccEv296u6DEUHFF9U4W2E/6/WkbuDrS9/1VJM34SCzA= +github.com/blevesearch/zap/v14 v14.0.3/go.mod h1:oObAhcDHw7p1ahiTCqhRkdxdl7UA8qpvX10pSgrTMHc= +github.com/blevesearch/zap/v15 v15.0.1 h1:jEism63eY+qdcvwXH0K8MiKhv5tb10T1k7SNx6fauCM= +github.com/blevesearch/zap/v15 v15.0.1/go.mod h1:ho0frqAex2ktT9cYFAxQpoQXsxb/KEfdjpx4s49rf/M= +github.com/blevesearch/zapx/v11 v11.1.0 h1:nawLAzWX6NNlW4tofiseMEYODurqmOIuRRxZ9LYs4q4= +github.com/blevesearch/zapx/v11 v11.1.0/go.mod h1:7mOK0QCn13lexQdbNi168i6zMPGsitUg1j/UUaIvHO0= +github.com/blevesearch/zapx/v12 v12.1.0 h1:GETlxxKR/VGu90ayfYdLGqCnZ9Rw991l4dCQu62pXZc= +github.com/blevesearch/zapx/v12 v12.1.0/go.mod h1:j2e+SnS//OuIFivU+GG7RltQ/OsOrCtuEuGc+r4GPvE= +github.com/blevesearch/zapx/v13 v13.1.0 h1:s0KmvcC9nWSZY5ix/f/5B0YLDgfPH+mM4q6myXtRWvs= +github.com/blevesearch/zapx/v13 v13.1.0/go.mod h1:lmWI+m3uCO9NEX4FkJEDyaRskFcHTaG778NfkcI3O/E= +github.com/blevesearch/zapx/v14 v14.1.0 h1:Fzp2MRhA33UulavOamWCcvrHaNB33Q0HofJJjxkeUw0= +github.com/blevesearch/zapx/v14 v14.1.0/go.mod h1:xxv3ClQ8oc4bPknqQf9Vg3H3bQkN3Oq6OqKYPqmh5K0= +github.com/blevesearch/zapx/v15 v15.1.0 h1:Lu0/N1JLm2dR3GSKzM2BNsnAqw+0zmY3X9SWOZgVjMw= +github.com/blevesearch/zapx/v15 v15.1.0/go.mod h1:aq1biCn7cpLDcuO8e6j3QY9vYohEMUiH8T7kaA7lV0g= +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/couchbase/ghistogram v0.1.0 h1:b95QcQTCzjTUocDXp/uMgSNQi8oj1tGwnJ4bODWZnps= +github.com/couchbase/ghistogram v0.1.0/go.mod h1:s1Jhy76zqfEecpNWJfWUiKZookAFaiGOEoyzgHt9i7k= +github.com/couchbase/moss v0.1.0 h1:HCL+xxHUwmOaL44kMM/gU08OW6QGCui1WVFO58bjhNI= +github.com/couchbase/moss v0.1.0/go.mod h1:9MaHIaRuy9pvLPUJxB8sh8OrLfyDczECVL37grCIubs= +github.com/couchbase/vellum v1.0.2 h1:BrbP0NKiyDdndMPec8Jjhy0U47CZ0Lgx3xUC2r9rZqw= +github.com/couchbase/vellum v1.0.2/go.mod h1:FcwrEivFpNi24R3jLOs3n+fs5RnuQnQqCLBJ1uAg1W4= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2 h1:Ujru1hufTHVb++eG6OuNDKMxZnGIvF6o/u8q/8h2+I4= +github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= +github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/kljensen/snowball v0.6.0 h1:6DZLCcZeL0cLfodx+Md4/OLC6b/bfurWUOUGs1ydfOU= +github.com/kljensen/snowball v0.6.0/go.mod h1:27N7E8fVU5H68RlUmnWwZCfxgt4POBJfENGMvNRhldw= +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/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= +github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/philhofer/fwd v1.0.0 h1:UbZqGr5Y38ApvM/V/jEljVxwocdweyH+vmYvRPBnbqQ= +github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563 h1:dY6ETXrvDG7Sa4vE8ZQG4yqWg6UnOcbqTAahkV813vQ= +github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +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 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= +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 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= +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/steveyen/gtreap v0.1.0 h1:CjhzTa274PyJLJuMZwIzCO1PfC00oRa8d1Kc78bFXJM= +github.com/steveyen/gtreap v0.1.0/go.mod h1:kl/5J7XbrOmlIbYIXdRHDDE5QxHqpk0cmkT7Z4dM9/Y= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= +github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= +github.com/tinylib/msgp v1.1.0 h1:9fQd+ICuRIu/ue4vxJZu6/LzxN0HwMds2nq/0cFvxHU= +github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/willf/bitset v1.1.10 h1:NotGKqX0KwQ72NUzqrjZq5ipPNDQex9lo3WpaS8L2sc= +github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +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/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200928182047-19e03678916f/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/http/doc_get.go b/http/doc_get.go index 7d174d790..f9bc93837 100644 --- a/http/doc_get.go +++ b/http/doc_get.go @@ -59,15 +59,21 @@ func (h *DocGetHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - doc, err := index.Document(docID) + docInt, err := index.Document(docID) if err != nil { showError(w, req, fmt.Sprintf("error deleting document '%s': %v", docID, err), 500) return } - if doc == nil { + if docInt == nil { showError(w, req, fmt.Sprintf("no such document '%s'", docID), 404) return } + doc, ok := docInt.(*document.Document) + if !ok { + showError(w, req, fmt.Sprintf("unexpected document type: %T", doc), 500) + return + + } rv := struct { ID string `json:"id"` diff --git a/index.go b/index.go index 974358b81..06d79f57f 100644 --- a/index.go +++ b/index.go @@ -18,10 +18,10 @@ import ( "context" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/store" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/size" + index "github.com/blevesearch/bleve_index_api" + store "github.com/blevesearch/bleve_index_api/store" ) // A Batch groups together multiple Index and Delete @@ -71,7 +71,7 @@ func (b *Batch) TotalDocsSize() uint64 { // batch which skips the mapping. NOTE: the bleve Index is not updated // until the batch is executed. func (b *Batch) IndexAdvanced(doc *document.Document) (err error) { - if doc.ID == "" { + if doc.ID() == "" { return ErrorEmptyID } b.internal.Update(doc) @@ -216,7 +216,7 @@ type Index interface { // Document returns specified document or nil if the document is not // indexed or stored. - Document(id string) (*document.Document, error) + Document(id string) (index.Document, error) // DocCount returns the number of documents in the index. DocCount() (uint64, error) diff --git a/index/analysis.go b/index/analysis.go deleted file mode 100644 index 82883af01..000000000 --- a/index/analysis.go +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2015 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package index - -import ( - "reflect" - - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/size" -) - -var reflectStaticSizeAnalysisResult int - -func init() { - var ar AnalysisResult - reflectStaticSizeAnalysisResult = int(reflect.TypeOf(ar).Size()) -} - -type IndexRow interface { - KeySize() int - KeyTo([]byte) (int, error) - Key() []byte - - ValueSize() int - ValueTo([]byte) (int, error) - Value() []byte -} - -type AnalysisResult struct { - DocID string - Rows []IndexRow - - // scorch - Document *document.Document - Analyzed []analysis.TokenFrequencies - Length []int -} - -func (a *AnalysisResult) Size() int { - rv := reflectStaticSizeAnalysisResult - for _, analyzedI := range a.Analyzed { - rv += analyzedI.Size() - } - rv += len(a.Length) * size.SizeOfInt - return rv -} - -type AnalysisWork struct { - i Index - d *document.Document - rc chan *AnalysisResult -} - -func NewAnalysisWork(i Index, d *document.Document, rc chan *AnalysisResult) *AnalysisWork { - return &AnalysisWork{ - i: i, - d: d, - rc: rc, - } -} - -type AnalysisQueue struct { - queue chan *AnalysisWork - done chan struct{} -} - -func (q *AnalysisQueue) Queue(work *AnalysisWork) { - q.queue <- work -} - -func (q *AnalysisQueue) Close() { - close(q.done) -} - -func NewAnalysisQueue(numWorkers int) *AnalysisQueue { - rv := AnalysisQueue{ - queue: make(chan *AnalysisWork), - done: make(chan struct{}), - } - for i := 0; i < numWorkers; i++ { - go AnalysisWorker(rv) - } - return &rv -} - -func AnalysisWorker(q AnalysisQueue) { - // read work off the queue - for { - select { - case <-q.done: - return - case w := <-q.queue: - r := w.i.Analyze(w.d) - w.rc <- r - } - } -} diff --git a/index/field_cache.go b/index/field_cache.go deleted file mode 100644 index 9354081f1..000000000 --- a/index/field_cache.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2015 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package index - -import ( - "sync" -) - -type FieldCache struct { - fieldIndexes map[string]uint16 - indexFields []string - lastFieldIndex int - mutex sync.RWMutex -} - -func NewFieldCache() *FieldCache { - return &FieldCache{ - fieldIndexes: make(map[string]uint16), - lastFieldIndex: -1, - } -} - -func (f *FieldCache) AddExisting(field string, index uint16) { - f.mutex.Lock() - f.addLOCKED(field, index) - f.mutex.Unlock() -} - -func (f *FieldCache) addLOCKED(field string, index uint16) uint16 { - f.fieldIndexes[field] = index - if len(f.indexFields) < int(index)+1 { - prevIndexFields := f.indexFields - f.indexFields = make([]string, int(index)+16) - copy(f.indexFields, prevIndexFields) - } - f.indexFields[int(index)] = field - if int(index) > f.lastFieldIndex { - f.lastFieldIndex = int(index) - } - return index -} - -// FieldNamed returns the index of the field, and whether or not it existed -// before this call. if createIfMissing is true, and new field index is assigned -// but the second return value will still be false -func (f *FieldCache) FieldNamed(field string, createIfMissing bool) (uint16, bool) { - f.mutex.RLock() - if index, ok := f.fieldIndexes[field]; ok { - f.mutex.RUnlock() - return index, true - } else if !createIfMissing { - f.mutex.RUnlock() - return 0, false - } - // trade read lock for write lock - f.mutex.RUnlock() - f.mutex.Lock() - // need to check again with write lock - if index, ok := f.fieldIndexes[field]; ok { - f.mutex.Unlock() - return index, true - } - // assign next field id - index := f.addLOCKED(field, uint16(f.lastFieldIndex+1)) - f.mutex.Unlock() - return index, false -} - -func (f *FieldCache) FieldIndexed(index uint16) (field string) { - f.mutex.RLock() - if int(index) < len(f.indexFields) { - field = f.indexFields[int(index)] - } - f.mutex.RUnlock() - return field -} diff --git a/index/index.go b/index/index.go deleted file mode 100644 index 551f8de84..000000000 --- a/index/index.go +++ /dev/null @@ -1,376 +0,0 @@ -// Copyright (c) 2014 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package index - -import ( - "bytes" - "encoding/json" - "fmt" - "reflect" - - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index/store" - "github.com/blevesearch/bleve/size" -) - -var reflectStaticSizeTermFieldDoc int -var reflectStaticSizeTermFieldVector int - -func init() { - var tfd TermFieldDoc - reflectStaticSizeTermFieldDoc = int(reflect.TypeOf(tfd).Size()) - var tfv TermFieldVector - reflectStaticSizeTermFieldVector = int(reflect.TypeOf(tfv).Size()) -} - -var ErrorUnknownStorageType = fmt.Errorf("unknown storage type") - -type Index interface { - Open() error - Close() error - - Update(doc *document.Document) error - Delete(id string) error - Batch(batch *Batch) error - - SetInternal(key, val []byte) error - DeleteInternal(key []byte) error - - // Reader returns a low-level accessor on the index data. Close it to - // release associated resources. - Reader() (IndexReader, error) - - Stats() json.Marshaler - StatsMap() map[string]interface{} - - Analyze(d *document.Document) *AnalysisResult - - Advanced() (store.KVStore, error) -} - -type DocumentFieldTermVisitor func(field string, term []byte) - -type IndexReader interface { - TermFieldReader(term []byte, field string, includeFreq, includeNorm, includeTermVectors bool) (TermFieldReader, error) - - // DocIDReader returns an iterator over all doc ids - // The caller must close returned instance to release associated resources. - DocIDReaderAll() (DocIDReader, error) - - DocIDReaderOnly(ids []string) (DocIDReader, error) - - FieldDict(field string) (FieldDict, error) - - // FieldDictRange is currently defined to include the start and end terms - FieldDictRange(field string, startTerm []byte, endTerm []byte) (FieldDict, error) - FieldDictPrefix(field string, termPrefix []byte) (FieldDict, error) - - Document(id string) (*document.Document, error) - DocumentVisitFieldTerms(id IndexInternalID, fields []string, visitor DocumentFieldTermVisitor) error - - DocValueReader(fields []string) (DocValueReader, error) - - Fields() ([]string, error) - - GetInternal(key []byte) ([]byte, error) - - DocCount() (uint64, error) - - ExternalID(id IndexInternalID) (string, error) - InternalID(id string) (IndexInternalID, error) - - DumpAll() chan interface{} - DumpDoc(id string) chan interface{} - DumpFields() chan interface{} - - Close() error -} - -// The Regexp interface defines the subset of the regexp.Regexp API -// methods that are used by bleve indexes, allowing callers to pass in -// alternate implementations. -type Regexp interface { - FindStringIndex(s string) (loc []int) - - LiteralPrefix() (prefix string, complete bool) - - String() string -} - -type IndexReaderRegexp interface { - FieldDictRegexp(field string, regex string) (FieldDict, error) -} - -type IndexReaderFuzzy interface { - FieldDictFuzzy(field string, term string, fuzziness int, prefix string) (FieldDict, error) -} - -type IndexReaderOnly interface { - FieldDictOnly(field string, onlyTerms [][]byte, includeCount bool) (FieldDict, error) -} - -type IndexReaderContains interface { - FieldDictContains(field string) (FieldDictContains, error) -} - -// FieldTerms contains the terms used by a document, keyed by field -type FieldTerms map[string][]string - -// FieldsNotYetCached returns a list of fields not yet cached out of a larger list of fields -func (f FieldTerms) FieldsNotYetCached(fields []string) []string { - rv := make([]string, 0, len(fields)) - for _, field := range fields { - if _, ok := f[field]; !ok { - rv = append(rv, field) - } - } - return rv -} - -// Merge will combine two FieldTerms -// it assumes that the terms lists are complete (thus do not need to be merged) -// field terms from the other list always replace the ones in the receiver -func (f FieldTerms) Merge(other FieldTerms) { - for field, terms := range other { - f[field] = terms - } -} - -type TermFieldVector struct { - Field string - ArrayPositions []uint64 - Pos uint64 - Start uint64 - End uint64 -} - -func (tfv *TermFieldVector) Size() int { - return reflectStaticSizeTermFieldVector + size.SizeOfPtr + - len(tfv.Field) + len(tfv.ArrayPositions)*size.SizeOfUint64 -} - -// IndexInternalID is an opaque document identifier interal to the index impl -type IndexInternalID []byte - -func (id IndexInternalID) Equals(other IndexInternalID) bool { - return id.Compare(other) == 0 -} - -func (id IndexInternalID) Compare(other IndexInternalID) int { - return bytes.Compare(id, other) -} - -type TermFieldDoc struct { - Term string - ID IndexInternalID - Freq uint64 - Norm float64 - Vectors []*TermFieldVector -} - -func (tfd *TermFieldDoc) Size() int { - sizeInBytes := reflectStaticSizeTermFieldDoc + size.SizeOfPtr + - len(tfd.Term) + len(tfd.ID) - - for _, entry := range tfd.Vectors { - sizeInBytes += entry.Size() - } - - return sizeInBytes -} - -// Reset allows an already allocated TermFieldDoc to be reused -func (tfd *TermFieldDoc) Reset() *TermFieldDoc { - // remember the []byte used for the ID - id := tfd.ID - vectors := tfd.Vectors - // idiom to copy over from empty TermFieldDoc (0 allocations) - *tfd = TermFieldDoc{} - // reuse the []byte already allocated (and reset len to 0) - tfd.ID = id[:0] - tfd.Vectors = vectors[:0] - return tfd -} - -// TermFieldReader is the interface exposing the enumeration of documents -// containing a given term in a given field. Documents are returned in byte -// lexicographic order over their identifiers. -type TermFieldReader interface { - // Next returns the next document containing the term in this field, or nil - // when it reaches the end of the enumeration. The preAlloced TermFieldDoc - // is optional, and when non-nil, will be used instead of allocating memory. - Next(preAlloced *TermFieldDoc) (*TermFieldDoc, error) - - // Advance resets the enumeration at specified document or its immediate - // follower. - Advance(ID IndexInternalID, preAlloced *TermFieldDoc) (*TermFieldDoc, error) - - // Count returns the number of documents contains the term in this field. - Count() uint64 - Close() error - - Size() int -} - -type DictEntry struct { - Term string - Count uint64 -} - -type FieldDict interface { - Next() (*DictEntry, error) - Close() error -} - -type FieldDictContains interface { - Contains(key []byte) (bool, error) -} - -// DocIDReader is the interface exposing enumeration of documents identifiers. -// Close the reader to release associated resources. -type DocIDReader interface { - // Next returns the next document internal identifier in the natural - // index order, nil when the end of the sequence is reached. - Next() (IndexInternalID, error) - - // Advance resets the iteration to the first internal identifier greater than - // or equal to ID. If ID is smaller than the start of the range, the iteration - // will start there instead. If ID is greater than or equal to the end of - // the range, Next() call will return io.EOF. - Advance(ID IndexInternalID) (IndexInternalID, error) - - Size() int - - Close() error -} - -type BatchCallback func(error) - -type Batch struct { - IndexOps map[string]*document.Document - InternalOps map[string][]byte - persistedCallback BatchCallback -} - -func NewBatch() *Batch { - return &Batch{ - IndexOps: make(map[string]*document.Document), - InternalOps: make(map[string][]byte), - } -} - -func (b *Batch) Update(doc *document.Document) { - b.IndexOps[doc.ID] = doc -} - -func (b *Batch) Delete(id string) { - b.IndexOps[id] = nil -} - -func (b *Batch) SetInternal(key, val []byte) { - b.InternalOps[string(key)] = val -} - -func (b *Batch) DeleteInternal(key []byte) { - b.InternalOps[string(key)] = nil -} - -func (b *Batch) SetPersistedCallback(f BatchCallback) { - b.persistedCallback = f -} - -func (b *Batch) PersistedCallback() BatchCallback { - return b.persistedCallback -} - -func (b *Batch) String() string { - rv := fmt.Sprintf("Batch (%d ops, %d internal ops)\n", len(b.IndexOps), len(b.InternalOps)) - for k, v := range b.IndexOps { - if v != nil { - rv += fmt.Sprintf("\tINDEX - '%s'\n", k) - } else { - rv += fmt.Sprintf("\tDELETE - '%s'\n", k) - } - } - for k, v := range b.InternalOps { - if v != nil { - rv += fmt.Sprintf("\tSET INTERNAL - '%s'\n", k) - } else { - rv += fmt.Sprintf("\tDELETE INTERNAL - '%s'\n", k) - } - } - return rv -} - -func (b *Batch) Reset() { - b.IndexOps = make(map[string]*document.Document) - b.InternalOps = make(map[string][]byte) - b.persistedCallback = nil -} - -func (b *Batch) Merge(o *Batch) { - for k, v := range o.IndexOps { - b.IndexOps[k] = v - } - for k, v := range o.InternalOps { - b.InternalOps[k] = v - } -} - -func (b *Batch) TotalDocSize() int { - var s int - for k, v := range b.IndexOps { - if v != nil { - s += v.Size() + size.SizeOfString - } - s += len(k) - } - return s -} - -// Optimizable represents an optional interface that implementable by -// optimizable resources (e.g., TermFieldReaders, Searchers). These -// optimizable resources are provided the same OptimizableContext -// instance, so that they can coordinate via dynamic interface -// casting. -type Optimizable interface { - Optimize(kind string, octx OptimizableContext) (OptimizableContext, error) -} - -// Represents a result of optimization -- see the Finish() method. -type Optimized interface{} - -type OptimizableContext interface { - // Once all the optimzable resources have been provided the same - // OptimizableContext instance, the optimization preparations are - // finished or completed via the Finish() method. - // - // Depending on the optimization being performed, the Finish() - // method might return a non-nil Optimized instance. For example, - // the Optimized instance might represent an optimized - // TermFieldReader instance. - Finish() (Optimized, error) -} - -type DocValueReader interface { - VisitDocValues(id IndexInternalID, visitor DocumentFieldTermVisitor) error -} - -// IndexBuilder is an interface supported by some index schemes -// to allow direct write-only index building -type IndexBuilder interface { - Index(doc *document.Document) error - Close() error -} diff --git a/index/scorch/builder.go b/index/scorch/builder.go index 1f4b41d63..fbe05d4f7 100644 --- a/index/scorch/builder.go +++ b/index/scorch/builder.go @@ -21,9 +21,8 @@ import ( "sync" "github.com/RoaringBitmap/roaring" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/scorch/segment" + index "github.com/blevesearch/bleve_index_api" + segment "github.com/blevesearch/scorch_segment_api" bolt "go.etcd.io/bbolt" ) @@ -117,7 +116,7 @@ func (o *Builder) parseConfig(config map[string]interface{}) (err error) { // Index will place the document into the index. // It is invalid to index the same document multiple times. -func (o *Builder) Index(doc *document.Document) error { +func (o *Builder) Index(doc index.Document) error { o.m.Lock() defer o.m.Unlock() @@ -139,7 +138,7 @@ func (o *Builder) executeBatchLOCKED(batch *index.Batch) (err error) { for _, doc := range batch.IndexOps { if doc != nil { // insert _id field - doc.AddField(document.NewTextFieldCustom("_id", nil, []byte(doc.ID), document.IndexField|document.StoreField, nil)) + doc.AddIDField() // perform analysis directly analysisResult := analyze(doc) analysisResults = append(analysisResults, analysisResult) diff --git a/index/scorch/builder_test.go b/index/scorch/builder_test.go index 1d0ce7160..2f7e7abb7 100644 --- a/index/scorch/builder_test.go +++ b/index/scorch/builder_test.go @@ -21,7 +21,7 @@ import ( "testing" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" ) func TestBuilder(t *testing.T) { diff --git a/index/scorch/event_test.go b/index/scorch/event_test.go index 9d39332e9..c72cfe122 100644 --- a/index/scorch/event_test.go +++ b/index/scorch/event_test.go @@ -18,7 +18,7 @@ import ( "testing" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" ) func TestEventBatchIntroductionStart(t *testing.T) { diff --git a/index/scorch/field_dict_test.go b/index/scorch/field_dict_test.go index 8cffe9e62..f88ffe0e1 100644 --- a/index/scorch/field_dict_test.go +++ b/index/scorch/field_dict_test.go @@ -19,7 +19,7 @@ import ( "testing" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" ) func TestIndexFieldDict(t *testing.T) { diff --git a/index/scorch/introducer.go b/index/scorch/introducer.go index 7770c41c5..4f71048fd 100644 --- a/index/scorch/introducer.go +++ b/index/scorch/introducer.go @@ -19,8 +19,8 @@ import ( "sync/atomic" "github.com/RoaringBitmap/roaring" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/scorch/segment" + index "github.com/blevesearch/bleve_index_api" + segment "github.com/blevesearch/scorch_segment_api" ) type segmentIntroduction struct { diff --git a/index/scorch/merge.go b/index/scorch/merge.go index 56c0953f4..0a1c5ccb0 100644 --- a/index/scorch/merge.go +++ b/index/scorch/merge.go @@ -25,7 +25,7 @@ import ( "github.com/RoaringBitmap/roaring" "github.com/blevesearch/bleve/index/scorch/mergeplan" - "github.com/blevesearch/bleve/index/scorch/segment" + segment "github.com/blevesearch/scorch_segment_api" ) func (s *Scorch) mergerLoop() { diff --git a/index/scorch/merge_test.go b/index/scorch/merge_test.go index 41f6892e7..ed5770b09 100644 --- a/index/scorch/merge_test.go +++ b/index/scorch/merge_test.go @@ -20,7 +20,7 @@ import ( "testing" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" ) func TestObsoleteSegmentMergeIntroduction(t *testing.T) { diff --git a/index/scorch/optimize.go b/index/scorch/optimize.go index 658354cd7..b62869b52 100644 --- a/index/scorch/optimize.go +++ b/index/scorch/optimize.go @@ -17,8 +17,8 @@ package scorch import ( "fmt" "github.com/RoaringBitmap/roaring" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/scorch/segment" + index "github.com/blevesearch/bleve_index_api" + segment "github.com/blevesearch/scorch_segment_api" "sync/atomic" ) diff --git a/index/scorch/persister.go b/index/scorch/persister.go index 498378a4f..2d0df8a96 100644 --- a/index/scorch/persister.go +++ b/index/scorch/persister.go @@ -30,8 +30,8 @@ import ( "time" "github.com/RoaringBitmap/roaring" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/scorch/segment" + index "github.com/blevesearch/bleve_index_api" + segment "github.com/blevesearch/scorch_segment_api" bolt "go.etcd.io/bbolt" ) diff --git a/index/scorch/reader_test.go b/index/scorch/reader_test.go index a1d612b5f..754dc17eb 100644 --- a/index/scorch/reader_test.go +++ b/index/scorch/reader_test.go @@ -20,7 +20,7 @@ import ( "testing" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" ) func TestIndexReader(t *testing.T) { diff --git a/index/scorch/rollback.go b/index/scorch/rollback.go index 7cc87bdea..353b1f531 100644 --- a/index/scorch/rollback.go +++ b/index/scorch/rollback.go @@ -19,7 +19,7 @@ import ( "log" "os" - "github.com/blevesearch/bleve/index/scorch/segment" + segment "github.com/blevesearch/scorch_segment_api" bolt "go.etcd.io/bbolt" ) diff --git a/index/scorch/rollback_test.go b/index/scorch/rollback_test.go index e137e0f09..c9b1ddd66 100644 --- a/index/scorch/rollback_test.go +++ b/index/scorch/rollback_test.go @@ -18,7 +18,7 @@ import ( "testing" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" ) func TestIndexRollback(t *testing.T) { diff --git a/index/scorch/scorch.go b/index/scorch/scorch.go index fccff67ab..909fb43e8 100644 --- a/index/scorch/scorch.go +++ b/index/scorch/scorch.go @@ -24,12 +24,10 @@ import ( "time" "github.com/RoaringBitmap/roaring" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/scorch/segment" - "github.com/blevesearch/bleve/index/store" "github.com/blevesearch/bleve/registry" + index "github.com/blevesearch/bleve_index_api" + "github.com/blevesearch/bleve_index_api/store" + segment "github.com/blevesearch/scorch_segment_api" bolt "go.etcd.io/bbolt" ) @@ -293,7 +291,7 @@ func (s *Scorch) Close() (err error) { return } -func (s *Scorch) Update(doc *document.Document) error { +func (s *Scorch) Update(doc index.Document) error { b := index.NewBatch() b.Update(doc) return s.Batch(b) @@ -322,7 +320,7 @@ func (s *Scorch) Batch(batch *index.Batch) (err error) { for docID, doc := range batch.IndexOps { if doc != nil { // insert _id field - doc.AddField(document.NewTextFieldCustom("_id", nil, []byte(doc.ID), document.IndexField|document.StoreField, nil)) + doc.AddIDField() numUpdates++ numPlainTextBytes += doc.NumPlainTextBytes() } else { @@ -566,31 +564,27 @@ func (s *Scorch) StatsMap() map[string]interface{} { return m } -func (s *Scorch) Analyze(d *document.Document) *index.AnalysisResult { +func (s *Scorch) Analyze(d index.Document) *index.AnalysisResult { return analyze(d) } -func analyze(d *document.Document) *index.AnalysisResult { +func analyze(d index.Document) *index.AnalysisResult { rv := &index.AnalysisResult{ Document: d, - Analyzed: make([]analysis.TokenFrequencies, len(d.Fields)+len(d.CompositeFields)), - Length: make([]int, len(d.Fields)+len(d.CompositeFields)), } - for i, field := range d.Fields { - if field.Options().IsIndexed() { - fieldLength, tokenFreqs := field.Analyze() - rv.Analyzed[i] = tokenFreqs - rv.Length[i] = fieldLength + d.VisitFields(func(field index.Field) { + if field.IsIndexed() { + field.Analyze() - if len(d.CompositeFields) > 0 && field.Name() != "_id" { + if d.HasComposite() && field.Name() != "_id" { // see if any of the composite fields need this - for _, compositeField := range d.CompositeFields { - compositeField.Compose(field.Name(), fieldLength, tokenFreqs) - } + d.VisitComposite(func(cf index.CompositeField) { + cf.Compose(field.Name(), field.AnalyzedLength(), field.AnalyzedTokenFrequencies()) + }) } } - } + }) return rv } diff --git a/index/scorch/scorch_test.go b/index/scorch/scorch_test.go index 5f0ec1b75..a7215307a 100644 --- a/index/scorch/scorch_test.go +++ b/index/scorch/scorch_test.go @@ -33,7 +33,7 @@ import ( "github.com/blevesearch/bleve/analysis/analyzer/standard" regexpTokenizer "github.com/blevesearch/bleve/analysis/tokenizer/regexp" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/index/scorch/mergeplan" "github.com/blevesearch/bleve/mapping" ) @@ -788,11 +788,14 @@ func TestIndexInsertWithStore(t *testing.T) { } }() - storedDoc, err := indexReader.Document("1") + storedDocInt, err := indexReader.Document("1") if err != nil { t.Error(err) } + storedDoc := storedDocInt.(*document.Document) + + if len(storedDoc.Fields) != 1 { t.Errorf("expected 1 stored field, got %d", len(storedDoc.Fields)) } @@ -1172,11 +1175,13 @@ func TestIndexInsertUpdateDeleteWithMultipleTypesStored(t *testing.T) { t.Error(err) } - storedDoc, err := indexReader.Document("1") + storedDocInt, err := indexReader.Document("1") if err != nil { t.Error(err) } + storedDoc := storedDocInt.(*document.Document) + err = indexReader.Close() if err != nil { t.Error(err) @@ -1250,11 +1255,13 @@ func TestIndexInsertUpdateDeleteWithMultipleTypesStored(t *testing.T) { } // should only get 2 fields back now though - storedDoc, err = indexReader2.Document("1") + storedDocInt, err = indexReader2.Document("1") if err != nil { t.Error(err) } + storedDoc = storedDocInt.(*document.Document) + err = indexReader2.Close() if err != nil { t.Error(err) @@ -1448,10 +1455,11 @@ func TestIndexUpdateComposites(t *testing.T) { }() // make sure new values are in index - storedDoc, err := indexReader.Document("1") + storedDocInt, err := indexReader.Document("1") if err != nil { t.Error(err) } + storedDoc := storedDocInt.(*document.Document) if len(storedDoc.Fields) != 2 { t.Errorf("expected 2 stored field, got %d", len(storedDoc.Fields)) } @@ -1751,11 +1759,13 @@ func TestConcurrentUpdate(t *testing.T) { } }() - doc, err := r.Document("1") + docInt, err := r.Document("1") if err != nil { log.Fatal(err) } + doc := docInt.(*document.Document) + if len(doc.Fields) > 2 { t.Errorf("expected no more than 2 fields, found %d", len(doc.Fields)) } diff --git a/index/scorch/segment/empty.go b/index/scorch/segment/empty.go deleted file mode 100644 index 340db73a6..000000000 --- a/index/scorch/segment/empty.go +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) 2017 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package segment - -import ( - "github.com/RoaringBitmap/roaring" - "github.com/blevesearch/bleve/index" - "github.com/couchbase/vellum" -) - -type EmptySegment struct{} - -func (e *EmptySegment) Dictionary(field string) (TermDictionary, error) { - return &EmptyDictionary{}, nil -} - -func (e *EmptySegment) VisitDocument(num uint64, visitor DocumentFieldValueVisitor) error { - return nil -} - -func (e *EmptySegment) DocID(num uint64) ([]byte, error) { - return nil, nil -} - -func (e *EmptySegment) Count() uint64 { - return 0 -} - -func (e *EmptySegment) DocNumbers([]string) (*roaring.Bitmap, error) { - r := roaring.NewBitmap() - return r, nil -} - -func (e *EmptySegment) Fields() []string { - return []string{} -} - -func (e *EmptySegment) Close() error { - return nil -} - -func (e *EmptySegment) Size() uint64 { - return 0 -} - -func (e *EmptySegment) AddRef() { -} - -func (e *EmptySegment) DecRef() error { - return nil -} - -type EmptyDictionary struct{} - -func (e *EmptyDictionary) PostingsList(term []byte, - except *roaring.Bitmap, prealloc PostingsList) (PostingsList, error) { - return &EmptyPostingsList{}, nil -} - -func (e *EmptyDictionary) Iterator() DictionaryIterator { - return &EmptyDictionaryIterator{} -} - -func (e *EmptyDictionary) PrefixIterator(prefix string) DictionaryIterator { - return &EmptyDictionaryIterator{} -} - -func (e *EmptyDictionary) RangeIterator(start, end string) DictionaryIterator { - return &EmptyDictionaryIterator{} -} - -func (e *EmptyDictionary) AutomatonIterator(a vellum.Automaton, - startKeyInclusive, endKeyExclusive []byte) DictionaryIterator { - return &EmptyDictionaryIterator{} -} - -func (e *EmptyDictionary) OnlyIterator(onlyTerms [][]byte, - includeCount bool) DictionaryIterator { - return &EmptyDictionaryIterator{} -} - -func (e *EmptyDictionary) Contains(key []byte) (bool, error) { - return false, nil -} - -type EmptyDictionaryIterator struct{} - -func (e *EmptyDictionaryIterator) Next() (*index.DictEntry, error) { - return nil, nil -} - -func (e *EmptyDictionaryIterator) Contains(key []byte) (bool, error) { - return false, nil -} - -type EmptyPostingsList struct{} - -func (e *EmptyPostingsList) Iterator(includeFreq, includeNorm, includeLocations bool, - prealloc PostingsIterator) PostingsIterator { - return &EmptyPostingsIterator{} -} - -func (e *EmptyPostingsList) Size() int { - return 0 -} - -func (e *EmptyPostingsList) Count() uint64 { - return 0 -} - -type EmptyPostingsIterator struct{} - -func (e *EmptyPostingsIterator) Next() (Posting, error) { - return nil, nil -} - -func (e *EmptyPostingsIterator) Advance(uint64) (Posting, error) { - return nil, nil -} - -func (e *EmptyPostingsIterator) Size() int { - return 0 -} - -var AnEmptyPostingsIterator = &EmptyPostingsIterator{} diff --git a/index/scorch/segment/int.go b/index/scorch/segment/int.go deleted file mode 100644 index 55299d8f7..000000000 --- a/index/scorch/segment/int.go +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2014 The Cockroach Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -// implied. See the License for the specific language governing -// permissions and limitations under the License. - -// This code originated from: -// https://github.com/cockroachdb/cockroach/blob/2dd65dde5d90c157f4b93f92502ca1063b904e1d/pkg/util/encoding/encoding.go - -// Modified to not use pkg/errors - -package segment - -import ( - "errors" - "fmt" -) - -const ( - MaxVarintSize = 9 - - // IntMin is chosen such that the range of int tags does not overlap the - // ascii character set that is frequently used in testing. - IntMin = 0x80 // 128 - intMaxWidth = 8 - intZero = IntMin + intMaxWidth // 136 - intSmall = IntMax - intZero - intMaxWidth // 109 - // IntMax is the maximum int tag value. - IntMax = 0xfd // 253 -) - -// EncodeUvarintAscending encodes the uint64 value using a variable length -// (length-prefixed) representation. The length is encoded as a single -// byte indicating the number of encoded bytes (-8) to follow. See -// EncodeVarintAscending for rationale. The encoded bytes are appended to the -// supplied buffer and the final buffer is returned. -func EncodeUvarintAscending(b []byte, v uint64) []byte { - switch { - case v <= intSmall: - return append(b, intZero+byte(v)) - case v <= 0xff: - return append(b, IntMax-7, byte(v)) - case v <= 0xffff: - return append(b, IntMax-6, byte(v>>8), byte(v)) - case v <= 0xffffff: - return append(b, IntMax-5, byte(v>>16), byte(v>>8), byte(v)) - case v <= 0xffffffff: - return append(b, IntMax-4, byte(v>>24), byte(v>>16), byte(v>>8), byte(v)) - case v <= 0xffffffffff: - return append(b, IntMax-3, byte(v>>32), byte(v>>24), byte(v>>16), byte(v>>8), - byte(v)) - case v <= 0xffffffffffff: - return append(b, IntMax-2, byte(v>>40), byte(v>>32), byte(v>>24), byte(v>>16), - byte(v>>8), byte(v)) - case v <= 0xffffffffffffff: - return append(b, IntMax-1, byte(v>>48), byte(v>>40), byte(v>>32), byte(v>>24), - byte(v>>16), byte(v>>8), byte(v)) - default: - return append(b, IntMax, byte(v>>56), byte(v>>48), byte(v>>40), byte(v>>32), - byte(v>>24), byte(v>>16), byte(v>>8), byte(v)) - } -} - -// DecodeUvarintAscending decodes a varint encoded uint64 from the input -// buffer. The remainder of the input buffer and the decoded uint64 -// are returned. -func DecodeUvarintAscending(b []byte) ([]byte, uint64, error) { - if len(b) == 0 { - return nil, 0, fmt.Errorf("insufficient bytes to decode uvarint value") - } - length := int(b[0]) - intZero - b = b[1:] // skip length byte - if length <= intSmall { - return b, uint64(length), nil - } - length -= intSmall - if length < 0 || length > 8 { - return nil, 0, fmt.Errorf("invalid uvarint length of %d", length) - } else if len(b) < length { - return nil, 0, fmt.Errorf("insufficient bytes to decode uvarint value: %q", b) - } - var v uint64 - // It is faster to range over the elements in a slice than to index - // into the slice on each loop iteration. - for _, t := range b[:length] { - v = (v << 8) | uint64(t) - } - return b[length:], v, nil -} - -// ------------------------------------------------------------ - -type MemUvarintReader struct { - C int // index of next byte to read from S - S []byte -} - -func NewMemUvarintReader(s []byte) *MemUvarintReader { - return &MemUvarintReader{S: s} -} - -// Len returns the number of unread bytes. -func (r *MemUvarintReader) Len() int { - n := len(r.S) - r.C - if n < 0 { - return 0 - } - return n -} - -var ErrMemUvarintReaderOverflow = errors.New("MemUvarintReader overflow") - -// ReadUvarint reads an encoded uint64. The original code this was -// based on is at encoding/binary/ReadUvarint(). -func (r *MemUvarintReader) ReadUvarint() (uint64, error) { - var x uint64 - var s uint - var C = r.C - var S = r.S - - for { - b := S[C] - C++ - - if b < 0x80 { - r.C = C - - // why 63? The original code had an 'i += 1' loop var and - // checked for i > 9 || i == 9 ...; but, we no longer - // check for the i var, but instead check here for s, - // which is incremented by 7. So, 7*9 == 63. - // - // why the "extra" >= check? The normal case is that s < - // 63, so we check this single >= guard first so that we - // hit the normal, nil-error return pathway sooner. - if s >= 63 && (s > 63 || s == 63 && b > 1) { - return 0, ErrMemUvarintReaderOverflow - } - - return x | uint64(b)< 0 { - if (descending && bytes.Compare(enc, lastEnc) >= 0) || - (!descending && bytes.Compare(enc, lastEnc) < 0) { - t.Errorf("ordered constraint violated for %d: [% x] vs. [% x]", v, enc, lastEnc) - } - } - b, decode, err := decFunc(enc) - if err != nil { - t.Error(err) - continue - } - if len(b) != 0 { - t.Errorf("leftover bytes: [% x]", b) - } - if decode != v { - t.Errorf("decode yielded different value than input: %d vs. %d", decode, v) - } - lastEnc = enc - } -} - -func testCustomEncodeUint64( - testCases []testCaseUint64, encFunc func([]byte, uint64) []byte, t *testing.T, -) { - for _, test := range testCases { - enc := encFunc(nil, test.value) - if !bytes.Equal(enc, test.expEnc) { - t.Errorf("expected [% x]; got [% x] (value: %d)", test.expEnc, enc, test.value) - } - } -} - -func BenchmarkUvarint(b *testing.B) { - n, buf := generateCommonUvarints(64, 512) - - reader := bytes.NewReader(buf) - seen := 0 - - b.ResetTimer() - - for i := 0; i < b.N; i = i + 1 { - if seen >= n { - reader.Reset(buf) - seen = 0 - } - - _, _ = binary.ReadUvarint(reader) - seen = seen + 1 - } -} - -func BenchmarkMemUvarintReader(b *testing.B) { - n, buf := generateCommonUvarints(64, 512) - - reader := &MemUvarintReader{S: buf} - seen := 0 - - b.ResetTimer() - - for i := 0; i < b.N; i = i + 1 { - if seen >= n { - reader.Reset(buf) - seen = 0 - } - - _, _ = reader.ReadUvarint() - seen = seen + 1 - } -} - -// generate some common, encoded uvarint's that we might see as -// freq-norm's or locations. -func generateCommonUvarints(maxFreq, maxFieldLen int) (n int, rv []byte) { - buf := make([]byte, binary.MaxVarintLen64) - - var out bytes.Buffer - - encode := func(val uint64) { - bufLen := binary.PutUvarint(buf, val) - out.Write(buf[:bufLen]) - n = n + 1 - } - - for i := 1; i < maxFreq; i = i * 2 { // Common freqHasLoc's. - freqHasLocs := uint64(i << 1) - encode(freqHasLocs) - encode(freqHasLocs | 0x01) // 0'th LSB encodes whether there are locations. - } - - encodeNorm := func(fieldLen int) { - norm := float32(1.0 / math.Sqrt(float64(fieldLen))) - normUint64 := uint64(math.Float32bits(float32(norm))) - encode(normUint64) - } - - for i := 1; i < maxFieldLen; i = i * 2 { // Common norm's. - encodeNorm(i) - } - - return n, out.Bytes() -} diff --git a/index/scorch/segment/plugin.go b/index/scorch/segment/plugin.go deleted file mode 100644 index d8aaa0b6d..000000000 --- a/index/scorch/segment/plugin.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2020 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package segment - -import ( - "github.com/RoaringBitmap/roaring" - "github.com/blevesearch/bleve/index" -) - -// Plugin represents the essential functions required by a package to plug in -// it's segment implementation -type Plugin interface { - - // Type is the name for this segment plugin - Type() string - - // Version is a numeric value identifying a specific version of this type. - // When incompatible changes are made to a particular type of plugin, the - // version must be incremented. - Version() uint32 - - // New takes a set of AnalysisResults and turns them into a new Segment - New(results []*index.AnalysisResult) (Segment, uint64, error) - - // Open attempts to open the file at the specified path and - // return the corresponding Segment - Open(path string) (Segment, error) - - // Merge takes a set of Segments, and creates a new segment on disk at - // the specified path. - // Drops is a set of bitmaps (one for each segment) indicating which - // documents can be dropped from the segments during the merge. - // If the closeCh channel is closed, Merge will cease doing work at - // the next opportunity, and return an error (closed). - // StatsReporter can optionally be provided, in which case progress - // made during the merge is reported while operation continues. - // Returns: - // A slice of new document numbers (one for each input segment), - // this allows the caller to know a particular document's new - // document number in the newly merged segment. - // The number of bytes written to the new segment file. - // An error, if any occurred. - Merge(segments []Segment, drops []*roaring.Bitmap, path string, - closeCh chan struct{}, s StatsReporter) ( - [][]uint64, uint64, error) -} diff --git a/index/scorch/segment/regexp.go b/index/scorch/segment/regexp.go deleted file mode 100644 index 3a31f4149..000000000 --- a/index/scorch/segment/regexp.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2018 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package segment - -import ( - "regexp/syntax" - - "github.com/couchbase/vellum/regexp" -) - -func ParseRegexp(pattern string) (a *regexp.Regexp, prefixBeg, prefixEnd []byte, err error) { - // TODO: potential optimization where syntax.Regexp supports a Simplify() API? - - parsed, err := syntax.Parse(pattern, syntax.Perl) - if err != nil { - return nil, nil, nil, err - } - - re, err := regexp.NewParsedWithLimit(pattern, parsed, regexp.DefaultLimit) - if err != nil { - return nil, nil, nil, err - } - - prefix := LiteralPrefix(parsed) - if prefix != "" { - prefixBeg := []byte(prefix) - prefixEnd := IncrementBytes(prefixBeg) - return re, prefixBeg, prefixEnd, nil - } - - return re, nil, nil, nil -} - -// Returns the literal prefix given the parse tree for a regexp -func LiteralPrefix(s *syntax.Regexp) string { - // traverse the left-most branch in the parse tree as long as the - // node represents a concatenation - for s != nil && s.Op == syntax.OpConcat { - if len(s.Sub) < 1 { - return "" - } - - s = s.Sub[0] - } - - if s.Op == syntax.OpLiteral && (s.Flags&syntax.FoldCase == 0) { - return string(s.Rune) - } - - return "" // no literal prefix -} - -func IncrementBytes(in []byte) []byte { - rv := make([]byte, len(in)) - copy(rv, in) - for i := len(rv) - 1; i >= 0; i-- { - rv[i] = rv[i] + 1 - if rv[i] != 0 { - return rv // didn't overflow, so stop - } - } - return nil // overflowed -} diff --git a/index/scorch/segment/regexp_test.go b/index/scorch/segment/regexp_test.go deleted file mode 100644 index 887476b28..000000000 --- a/index/scorch/segment/regexp_test.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2018 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package segment - -import ( - "regexp/syntax" - "testing" -) - -func TestLiteralPrefix(t *testing.T) { - tests := []struct { - input, expected string - }{ - {"", ""}, - {"hello", "hello"}, - {"hello.?", "hello"}, - {"hello$", "hello"}, - {`[h][e][l][l][o].*world`, "hello"}, - {`[h-h][e-e][l-l][l-l][o-o].*world`, "hello"}, - {".*", ""}, - {"h.*", "h"}, - {"h.?", "h"}, - {"h[a-z]", "h"}, - {`h\s`, "h"}, - {`(hello)world`, ""}, - {`日本語`, "日本語"}, - {`日本語\w`, "日本語"}, - {`^hello`, ""}, - {`^`, ""}, - {`$`, ""}, - {`(?i)mArTy`, ""}, - } - - for i, test := range tests { - s, err := syntax.Parse(test.input, syntax.Perl) - if err != nil { - t.Fatalf("expected no syntax.Parse error, got: %v", err) - } - - got := LiteralPrefix(s) - if test.expected != got { - t.Fatalf("test: %d, %+v, got: %s", i, test, got) - } - } -} diff --git a/index/scorch/segment/segment.go b/index/scorch/segment/segment.go deleted file mode 100644 index ddd0d0910..000000000 --- a/index/scorch/segment/segment.go +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) 2017 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package segment - -import ( - "fmt" - - "github.com/RoaringBitmap/roaring" - "github.com/blevesearch/bleve/index" - "github.com/couchbase/vellum" -) - -var ErrClosed = fmt.Errorf("index closed") - -// DocumentFieldValueVisitor defines a callback to be visited for each -// stored field value. The return value determines if the visitor -// should keep going. Returning true continues visiting, false stops. -type DocumentFieldValueVisitor func(field string, typ byte, value []byte, pos []uint64) bool - -type Segment interface { - Dictionary(field string) (TermDictionary, error) - - VisitDocument(num uint64, visitor DocumentFieldValueVisitor) error - - DocID(num uint64) ([]byte, error) - - Count() uint64 - - DocNumbers([]string) (*roaring.Bitmap, error) - - Fields() []string - - Close() error - - Size() int - - AddRef() - DecRef() error -} - -type UnpersistedSegment interface { - Segment - Persist(path string) error -} - -type PersistedSegment interface { - Segment - Path() string -} - -type TermDictionary interface { - PostingsList(term []byte, except *roaring.Bitmap, prealloc PostingsList) (PostingsList, error) - - Iterator() DictionaryIterator - PrefixIterator(prefix string) DictionaryIterator - RangeIterator(start, end string) DictionaryIterator - AutomatonIterator(a vellum.Automaton, - startKeyInclusive, endKeyExclusive []byte) DictionaryIterator - OnlyIterator(onlyTerms [][]byte, includeCount bool) DictionaryIterator - - Contains(key []byte) (bool, error) -} - -type DictionaryIterator interface { - Next() (*index.DictEntry, error) -} - -type PostingsList interface { - Iterator(includeFreq, includeNorm, includeLocations bool, prealloc PostingsIterator) PostingsIterator - - Size() int - - Count() uint64 - - // NOTE deferred for future work - - // And(other PostingsList) PostingsList - // Or(other PostingsList) PostingsList -} - -type PostingsIterator interface { - // The caller is responsible for copying whatever it needs from - // the returned Posting instance before calling Next(), as some - // implementations may return a shared instance to reduce memory - // allocations. - Next() (Posting, error) - - // Advance will return the posting with the specified doc number - // or if there is no such posting, the next posting. - // Callers MUST NOT attempt to pass a docNum that is less than or - // equal to the currently visited posting doc Num. - Advance(docNum uint64) (Posting, error) - - Size() int -} - -type OptimizablePostingsIterator interface { - ActualBitmap() *roaring.Bitmap - DocNum1Hit() (uint64, bool) - ReplaceActual(*roaring.Bitmap) -} - -type Posting interface { - Number() uint64 - - Frequency() uint64 - Norm() float64 - - Locations() []Location - - Size() int -} - -type Location interface { - Field() string - Start() uint64 - End() uint64 - Pos() uint64 - ArrayPositions() []uint64 - Size() int -} - -// DocumentFieldTermVisitable is implemented by various scorch segment -// implementations with persistence for the un inverting of the -// postings or other indexed values. -type DocumentFieldTermVisitable interface { - VisitDocumentFieldTerms(localDocNum uint64, fields []string, - visitor index.DocumentFieldTermVisitor, optional DocVisitState) (DocVisitState, error) - - // VisitableDocValueFields implementation should return - // the list of fields which are document value persisted and - // therefore visitable by the above VisitDocumentFieldTerms method. - VisitableDocValueFields() ([]string, error) -} - -type DocVisitState interface { -} - -type StatsReporter interface { - ReportBytesWritten(bytesWritten uint64) -} diff --git a/index/scorch/segment/unadorned.go b/index/scorch/segment/unadorned.go deleted file mode 100644 index db06562df..000000000 --- a/index/scorch/segment/unadorned.go +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) 2020 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package segment - -import ( - "github.com/RoaringBitmap/roaring" - "math" - "reflect" -) - -var reflectStaticSizeUnadornedPostingsIteratorBitmap int -var reflectStaticSizeUnadornedPostingsIterator1Hit int -var reflectStaticSizeUnadornedPosting int - -func init() { - var pib UnadornedPostingsIteratorBitmap - reflectStaticSizeUnadornedPostingsIteratorBitmap = int(reflect.TypeOf(pib).Size()) - var pi1h UnadornedPostingsIterator1Hit - reflectStaticSizeUnadornedPostingsIterator1Hit = int(reflect.TypeOf(pi1h).Size()) - var up UnadornedPosting - reflectStaticSizeUnadornedPosting = int(reflect.TypeOf(up).Size()) -} - -type UnadornedPostingsIteratorBitmap struct { - actual roaring.IntPeekable - actualBM *roaring.Bitmap -} - -func (i *UnadornedPostingsIteratorBitmap) Next() (Posting, error) { - return i.nextAtOrAfter(0) -} - -func (i *UnadornedPostingsIteratorBitmap) Advance(docNum uint64) (Posting, error) { - return i.nextAtOrAfter(docNum) -} - -func (i *UnadornedPostingsIteratorBitmap) nextAtOrAfter(atOrAfter uint64) (Posting, error) { - docNum, exists := i.nextDocNumAtOrAfter(atOrAfter) - if !exists { - return nil, nil - } - return UnadornedPosting(docNum), nil -} - -func (i *UnadornedPostingsIteratorBitmap) nextDocNumAtOrAfter(atOrAfter uint64) (uint64, bool) { - if i.actual == nil || !i.actual.HasNext() { - return 0, false - } - i.actual.AdvanceIfNeeded(uint32(atOrAfter)) - - if !i.actual.HasNext() { - return 0, false // couldn't find anything - } - - return uint64(i.actual.Next()), true -} - -func (i *UnadornedPostingsIteratorBitmap) Size() int { - return reflectStaticSizeUnadornedPostingsIteratorBitmap -} - -func (i *UnadornedPostingsIteratorBitmap) ActualBitmap() *roaring.Bitmap { - return i.actualBM -} - -func (i *UnadornedPostingsIteratorBitmap) DocNum1Hit() (uint64, bool) { - return 0, false -} - -func (i *UnadornedPostingsIteratorBitmap) ReplaceActual(actual *roaring.Bitmap) { - i.actualBM = actual - i.actual = actual.Iterator() -} - -func NewUnadornedPostingsIteratorFromBitmap(bm *roaring.Bitmap) PostingsIterator { - return &UnadornedPostingsIteratorBitmap{ - actualBM: bm, - actual: bm.Iterator(), - } -} - -const docNum1HitFinished = math.MaxUint64 - -type UnadornedPostingsIterator1Hit struct { - docNum uint64 -} - -func (i *UnadornedPostingsIterator1Hit) Next() (Posting, error) { - return i.nextAtOrAfter(0) -} - -func (i *UnadornedPostingsIterator1Hit) Advance(docNum uint64) (Posting, error) { - return i.nextAtOrAfter(docNum) -} - -func (i *UnadornedPostingsIterator1Hit) nextAtOrAfter(atOrAfter uint64) (Posting, error) { - docNum, exists := i.nextDocNumAtOrAfter(atOrAfter) - if !exists { - return nil, nil - } - return UnadornedPosting(docNum), nil -} - -func (i *UnadornedPostingsIterator1Hit) nextDocNumAtOrAfter(atOrAfter uint64) (uint64, bool) { - if i.docNum == docNum1HitFinished { - return 0, false - } - if i.docNum < atOrAfter { - // advanced past our 1-hit - i.docNum = docNum1HitFinished // consume our 1-hit docNum - return 0, false - } - docNum := i.docNum - i.docNum = docNum1HitFinished // consume our 1-hit docNum - return docNum, true -} - -func (i *UnadornedPostingsIterator1Hit) Size() int { - return reflectStaticSizeUnadornedPostingsIterator1Hit -} - -func NewUnadornedPostingsIteratorFrom1Hit(docNum1Hit uint64) PostingsIterator { - return &UnadornedPostingsIterator1Hit{ - docNum1Hit, - } -} - -type UnadornedPosting uint64 - -func (p UnadornedPosting) Number() uint64 { - return uint64(p) -} - -func (p UnadornedPosting) Frequency() uint64 { - return 0 -} - -func (p UnadornedPosting) Norm() float64 { - return 0 -} - -func (p UnadornedPosting) Locations() []Location { - return nil -} - -func (p UnadornedPosting) Size() int { - return reflectStaticSizeUnadornedPosting -} diff --git a/index/scorch/segment_plugin.go b/index/scorch/segment_plugin.go index 2f7db48b3..c87e35a62 100644 --- a/index/scorch/segment_plugin.go +++ b/index/scorch/segment_plugin.go @@ -17,13 +17,13 @@ package scorch import ( "fmt" - "github.com/blevesearch/bleve/index/scorch/segment" + segment "github.com/blevesearch/scorch_segment_api" - zapv11 "github.com/blevesearch/zap/v11" - zapv12 "github.com/blevesearch/zap/v12" - zapv13 "github.com/blevesearch/zap/v13" - zapv14 "github.com/blevesearch/zap/v14" - zapv15 "github.com/blevesearch/zap/v15" + zapv11 "github.com/blevesearch/zapx/v11" + zapv12 "github.com/blevesearch/zapx/v12" + zapv13 "github.com/blevesearch/zapx/v13" + zapv14 "github.com/blevesearch/zapx/v14" + zapv15 "github.com/blevesearch/zapx/v15" ) var supportedSegmentPlugins map[string]map[uint32]segment.Plugin diff --git a/index/scorch/snapshot_index.go b/index/scorch/snapshot_index.go index 61204ebbc..92643d5bb 100644 --- a/index/scorch/snapshot_index.go +++ b/index/scorch/snapshot_index.go @@ -25,8 +25,8 @@ import ( "github.com/RoaringBitmap/roaring" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/scorch/segment" + index "github.com/blevesearch/bleve_index_api" + segment "github.com/blevesearch/scorch_segment_api" "github.com/couchbase/vellum" lev "github.com/couchbase/vellum/levenshtein" ) @@ -349,7 +349,7 @@ func (i *IndexSnapshot) DocCount() (uint64, error) { return rv, nil } -func (i *IndexSnapshot) Document(id string) (rv *document.Document, err error) { +func (i *IndexSnapshot) Document(id string) (rv index.Document, err error) { // FIXME could be done more efficiently directly, but reusing for simplicity tfr, err := i.TermFieldReader([]byte(id), "_id", false, false, false) if err != nil { @@ -377,7 +377,7 @@ func (i *IndexSnapshot) Document(id string) (rv *document.Document, err error) { } segmentIndex, localDocNum := i.segmentIndexAndLocalDocNumFromGlobal(docNum) - rv = document.NewDocument(id) + rvd := document.NewDocument(id) err = i.segment[segmentIndex].VisitDocument(localDocNum, func(name string, typ byte, val []byte, pos []uint64) bool { if name == "_id" { return true @@ -389,15 +389,15 @@ func (i *IndexSnapshot) Document(id string) (rv *document.Document, err error) { switch typ { case 't': - rv.AddField(document.NewTextField(name, arrayPos, value)) + rvd.AddField(document.NewTextField(name, arrayPos, value)) case 'n': - rv.AddField(document.NewNumericFieldFromBytes(name, arrayPos, value)) + rvd.AddField(document.NewNumericFieldFromBytes(name, arrayPos, value)) case 'd': - rv.AddField(document.NewDateTimeFieldFromBytes(name, arrayPos, value)) + rvd.AddField(document.NewDateTimeFieldFromBytes(name, arrayPos, value)) case 'b': - rv.AddField(document.NewBooleanFieldFromBytes(name, arrayPos, value)) + rvd.AddField(document.NewBooleanFieldFromBytes(name, arrayPos, value)) case 'g': - rv.AddField(document.NewGeoPointFieldFromBytes(name, arrayPos, value)) + rvd.AddField(document.NewGeoPointFieldFromBytes(name, arrayPos, value)) } return true @@ -406,7 +406,7 @@ func (i *IndexSnapshot) Document(id string) (rv *document.Document, err error) { return nil, err } - return rv, nil + return rvd, nil } func (i *IndexSnapshot) segmentIndexAndLocalDocNumFromGlobal(docNum uint64) (int, uint64) { diff --git a/index/scorch/snapshot_index_dict.go b/index/scorch/snapshot_index_dict.go index 47486c255..90e5a5677 100644 --- a/index/scorch/snapshot_index_dict.go +++ b/index/scorch/snapshot_index_dict.go @@ -17,8 +17,8 @@ package scorch import ( "container/heap" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/scorch/segment" + index "github.com/blevesearch/bleve_index_api" + segment "github.com/blevesearch/scorch_segment_api" ) type segmentDictCursor struct { diff --git a/index/scorch/snapshot_index_doc.go b/index/scorch/snapshot_index_doc.go index 27da20865..09d07f930 100644 --- a/index/scorch/snapshot_index_doc.go +++ b/index/scorch/snapshot_index_doc.go @@ -19,7 +19,7 @@ import ( "reflect" "github.com/RoaringBitmap/roaring" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/size" ) diff --git a/index/scorch/snapshot_index_tfr.go b/index/scorch/snapshot_index_tfr.go index 239f68fbe..05b5cba46 100644 --- a/index/scorch/snapshot_index_tfr.go +++ b/index/scorch/snapshot_index_tfr.go @@ -20,8 +20,8 @@ import ( "reflect" "sync/atomic" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/scorch/segment" + index "github.com/blevesearch/bleve_index_api" + segment "github.com/blevesearch/scorch_segment_api" "github.com/blevesearch/bleve/size" ) diff --git a/index/scorch/snapshot_segment.go b/index/scorch/snapshot_segment.go index 96742b4f9..c6e9682ad 100644 --- a/index/scorch/snapshot_segment.go +++ b/index/scorch/snapshot_segment.go @@ -20,8 +20,8 @@ import ( "sync/atomic" "github.com/RoaringBitmap/roaring" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/scorch/segment" + index "github.com/blevesearch/bleve_index_api" + segment "github.com/blevesearch/scorch_segment_api" "github.com/blevesearch/bleve/size" ) diff --git a/index/store/batch.go b/index/store/batch.go deleted file mode 100644 index 711052661..000000000 --- a/index/store/batch.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2014 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package store - -type op struct { - K []byte - V []byte -} - -type EmulatedBatch struct { - Ops []*op - Merger *EmulatedMerge -} - -func NewEmulatedBatch(mo MergeOperator) *EmulatedBatch { - return &EmulatedBatch{ - Ops: make([]*op, 0, 1000), - Merger: NewEmulatedMerge(mo), - } -} - -func (b *EmulatedBatch) Set(key, val []byte) { - ck := make([]byte, len(key)) - copy(ck, key) - cv := make([]byte, len(val)) - copy(cv, val) - b.Ops = append(b.Ops, &op{ck, cv}) -} - -func (b *EmulatedBatch) Delete(key []byte) { - ck := make([]byte, len(key)) - copy(ck, key) - b.Ops = append(b.Ops, &op{ck, nil}) -} - -func (b *EmulatedBatch) Merge(key, val []byte) { - ck := make([]byte, len(key)) - copy(ck, key) - cv := make([]byte, len(val)) - copy(cv, val) - b.Merger.Merge(key, val) -} - -func (b *EmulatedBatch) Reset() { - b.Ops = b.Ops[:0] -} - -func (b *EmulatedBatch) Close() error { - return nil -} diff --git a/index/store/boltdb/reader.go b/index/store/boltdb/reader.go index 7977ebbe5..de6b5159a 100644 --- a/index/store/boltdb/reader.go +++ b/index/store/boltdb/reader.go @@ -15,7 +15,7 @@ package boltdb import ( - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" bolt "go.etcd.io/bbolt" ) diff --git a/index/store/boltdb/store.go b/index/store/boltdb/store.go index 3c749693c..b93fc3382 100644 --- a/index/store/boltdb/store.go +++ b/index/store/boltdb/store.go @@ -28,7 +28,7 @@ import ( "fmt" "os" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/registry" bolt "go.etcd.io/bbolt" ) diff --git a/index/store/boltdb/store_test.go b/index/store/boltdb/store_test.go index ae4cca3e0..b83bd8b41 100644 --- a/index/store/boltdb/store_test.go +++ b/index/store/boltdb/store_test.go @@ -18,7 +18,7 @@ import ( "os" "testing" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/index/store/test" bolt "go.etcd.io/bbolt" ) diff --git a/index/store/boltdb/writer.go b/index/store/boltdb/writer.go index f09357457..6044ca06b 100644 --- a/index/store/boltdb/writer.go +++ b/index/store/boltdb/writer.go @@ -17,7 +17,7 @@ package boltdb import ( "fmt" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" ) type Writer struct { diff --git a/index/store/goleveldb/batch.go b/index/store/goleveldb/batch.go index f14c18a60..a74c70a2f 100644 --- a/index/store/goleveldb/batch.go +++ b/index/store/goleveldb/batch.go @@ -15,7 +15,7 @@ package goleveldb import ( - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" "github.com/syndtr/goleveldb/leveldb" ) diff --git a/index/store/goleveldb/reader.go b/index/store/goleveldb/reader.go index bb2ff6538..20b7ec8ca 100644 --- a/index/store/goleveldb/reader.go +++ b/index/store/goleveldb/reader.go @@ -15,7 +15,7 @@ package goleveldb import ( - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/util" ) diff --git a/index/store/goleveldb/store.go b/index/store/goleveldb/store.go index d53cdb5b6..aad05a51b 100644 --- a/index/store/goleveldb/store.go +++ b/index/store/goleveldb/store.go @@ -19,7 +19,7 @@ import ( "fmt" "os" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/registry" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/opt" diff --git a/index/store/goleveldb/store_test.go b/index/store/goleveldb/store_test.go index 48b921a3d..8bb0eb3a1 100644 --- a/index/store/goleveldb/store_test.go +++ b/index/store/goleveldb/store_test.go @@ -18,7 +18,7 @@ import ( "os" "testing" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/index/store/test" ) diff --git a/index/store/goleveldb/writer.go b/index/store/goleveldb/writer.go index 6712c95fd..8efaeaf15 100644 --- a/index/store/goleveldb/writer.go +++ b/index/store/goleveldb/writer.go @@ -17,7 +17,7 @@ package goleveldb import ( "fmt" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" "github.com/syndtr/goleveldb/leveldb" ) diff --git a/index/store/gtreap/reader.go b/index/store/gtreap/reader.go index 98254d347..6ab5be4c5 100644 --- a/index/store/gtreap/reader.go +++ b/index/store/gtreap/reader.go @@ -18,7 +18,7 @@ package gtreap import ( - "github.com/blevesearch/bleve/index/store" + "github.com/blevesearch/bleve_index_api/store" "github.com/steveyen/gtreap" ) diff --git a/index/store/gtreap/store.go b/index/store/gtreap/store.go index 3e6c5fec1..8d3c695b7 100644 --- a/index/store/gtreap/store.go +++ b/index/store/gtreap/store.go @@ -24,7 +24,7 @@ import ( "os" "sync" - "github.com/blevesearch/bleve/index/store" + "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/registry" "github.com/steveyen/gtreap" ) diff --git a/index/store/gtreap/store_test.go b/index/store/gtreap/store_test.go index 86bc5a101..b758972a8 100644 --- a/index/store/gtreap/store_test.go +++ b/index/store/gtreap/store_test.go @@ -17,7 +17,7 @@ package gtreap import ( "testing" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/index/store/test" ) diff --git a/index/store/gtreap/writer.go b/index/store/gtreap/writer.go index 777aab406..23c182d9e 100644 --- a/index/store/gtreap/writer.go +++ b/index/store/gtreap/writer.go @@ -21,7 +21,7 @@ import ( "fmt" "math/rand" - "github.com/blevesearch/bleve/index/store" + "github.com/blevesearch/bleve_index_api/store" ) type Writer struct { diff --git a/index/store/kvstore.go b/index/store/kvstore.go deleted file mode 100644 index 34698c7bd..000000000 --- a/index/store/kvstore.go +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) 2014 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package store - -import "encoding/json" - -// KVStore is an abstraction for working with KV stores. Note that -// in order to be used with the bleve.registry, it must also implement -// a constructor function of the registry.KVStoreConstructor type. -type KVStore interface { - - // Writer returns a KVWriter which can be used to - // make changes to the KVStore. If a writer cannot - // be obtained a non-nil error is returned. - Writer() (KVWriter, error) - - // Reader returns a KVReader which can be used to - // read data from the KVStore. If a reader cannot - // be obtained a non-nil error is returned. - Reader() (KVReader, error) - - // Close closes the KVStore - Close() error -} - -// KVReader is an abstraction of an **ISOLATED** reader -// In this context isolated is defined to mean that -// writes/deletes made after the KVReader is opened -// are not observed. -// Because there is usually a cost associated with -// keeping isolated readers active, users should -// close them as soon as they are no longer needed. -type KVReader interface { - - // Get returns the value associated with the key - // If the key does not exist, nil is returned. - // The caller owns the bytes returned. - Get(key []byte) ([]byte, error) - - // MultiGet retrieves multiple values in one call. - MultiGet(keys [][]byte) ([][]byte, error) - - // PrefixIterator returns a KVIterator that will - // visit all K/V pairs with the provided prefix - PrefixIterator(prefix []byte) KVIterator - - // RangeIterator returns a KVIterator that will - // visit all K/V pairs >= start AND < end - RangeIterator(start, end []byte) KVIterator - - // Close closes the iterator - Close() error -} - -// KVIterator is an abstraction around key iteration -type KVIterator interface { - - // Seek will advance the iterator to the specified key - Seek(key []byte) - - // Next will advance the iterator to the next key - Next() - - // Key returns the key pointed to by the iterator - // The bytes returned are **ONLY** valid until the next call to Seek/Next/Close - // Continued use after that requires that they be copied. - Key() []byte - - // Value returns the value pointed to by the iterator - // The bytes returned are **ONLY** valid until the next call to Seek/Next/Close - // Continued use after that requires that they be copied. - Value() []byte - - // Valid returns whether or not the iterator is in a valid state - Valid() bool - - // Current returns Key(),Value(),Valid() in a single operation - Current() ([]byte, []byte, bool) - - // Close closes the iterator - Close() error -} - -// KVWriter is an abstraction for mutating the KVStore -// KVWriter does **NOT** enforce restrictions of a single writer -// if the underlying KVStore allows concurrent writes, the -// KVWriter interface should also do so, it is up to the caller -// to do this in a way that is safe and makes sense -type KVWriter interface { - - // NewBatch returns a KVBatch for performing batch operations on this kvstore - NewBatch() KVBatch - - // NewBatchEx returns a KVBatch and an associated byte array - // that's pre-sized based on the KVBatchOptions. The caller can - // use the returned byte array for keys and values associated with - // the batch. Once the batch is either executed or closed, the - // associated byte array should no longer be accessed by the - // caller. - NewBatchEx(KVBatchOptions) ([]byte, KVBatch, error) - - // ExecuteBatch will execute the KVBatch, the provided KVBatch **MUST** have - // been created by the same KVStore (though not necessarily the same KVWriter) - // Batch execution is atomic, either all the operations or none will be performed - ExecuteBatch(batch KVBatch) error - - // Close closes the writer - Close() error -} - -// KVBatchOptions provides the KVWriter.NewBatchEx() method with batch -// preparation and preallocation information. -type KVBatchOptions struct { - // TotalBytes is the sum of key and value bytes needed by the - // caller for the entire batch. It affects the size of the - // returned byte array of KVWrite.NewBatchEx(). - TotalBytes int - - // NumSets is the number of Set() calls the caller will invoke on - // the KVBatch. - NumSets int - - // NumDeletes is the number of Delete() calls the caller will invoke - // on the KVBatch. - NumDeletes int - - // NumMerges is the number of Merge() calls the caller will invoke - // on the KVBatch. - NumMerges int -} - -// KVBatch is an abstraction for making multiple KV mutations at once -type KVBatch interface { - - // Set updates the key with the specified value - // both key and value []byte may be reused as soon as this call returns - Set(key, val []byte) - - // Delete removes the specified key - // the key []byte may be reused as soon as this call returns - Delete(key []byte) - - // Merge merges old value with the new value at the specified key - // as prescribed by the KVStores merge operator - // both key and value []byte may be reused as soon as this call returns - Merge(key, val []byte) - - // Reset frees resources for this batch and allows reuse - Reset() - - // Close frees resources - Close() error -} - -// KVStoreStats is an optional interface that KVStores can implement -// if they're able to report any useful stats -type KVStoreStats interface { - // Stats returns a JSON serializable object representing stats for this KVStore - Stats() json.Marshaler - - StatsMap() map[string]interface{} -} diff --git a/index/store/merge.go b/index/store/merge.go deleted file mode 100644 index ca2561b0a..000000000 --- a/index/store/merge.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2014 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package store - -// At the moment this happens to be the same interface as described by -// RocksDB, but this may not always be the case. - -type MergeOperator interface { - - // FullMerge the full sequence of operands on top of the existingValue - // if no value currently exists, existingValue is nil - // return the merged value, and success/failure - FullMerge(key, existingValue []byte, operands [][]byte) ([]byte, bool) - - // Partially merge these two operands. - // If partial merge cannot be done, return nil,false, which will defer - // all processing until the FullMerge is done. - PartialMerge(key, leftOperand, rightOperand []byte) ([]byte, bool) - - // Name returns an identifier for the operator - Name() string -} - -type EmulatedMerge struct { - Merges map[string][][]byte - mo MergeOperator -} - -func NewEmulatedMerge(mo MergeOperator) *EmulatedMerge { - return &EmulatedMerge{ - Merges: make(map[string][][]byte), - mo: mo, - } -} - -func (m *EmulatedMerge) Merge(key, val []byte) { - ops, ok := m.Merges[string(key)] - if ok && len(ops) > 0 { - last := ops[len(ops)-1] - mergedVal, partialMergeOk := m.mo.PartialMerge(key, last, val) - if partialMergeOk { - // replace last entry with the result of the merge - ops[len(ops)-1] = mergedVal - } else { - // could not partial merge, append this to the end - ops = append(ops, val) - } - } else { - ops = [][]byte{val} - } - m.Merges[string(key)] = ops -} diff --git a/index/store/metrics/batch.go b/index/store/metrics/batch.go index a044b592e..4f0c308de 100644 --- a/index/store/metrics/batch.go +++ b/index/store/metrics/batch.go @@ -14,7 +14,7 @@ package metrics -import "github.com/blevesearch/bleve/index/store" +import store "github.com/blevesearch/bleve_index_api/store" type Batch struct { s *Store diff --git a/index/store/metrics/iterator.go b/index/store/metrics/iterator.go index 0cbe1ae75..d7d637ff4 100644 --- a/index/store/metrics/iterator.go +++ b/index/store/metrics/iterator.go @@ -14,7 +14,7 @@ package metrics -import "github.com/blevesearch/bleve/index/store" +import store "github.com/blevesearch/bleve_index_api/store" type Iterator struct { s *Store diff --git a/index/store/metrics/reader.go b/index/store/metrics/reader.go index ca6ae194c..fa4613e93 100644 --- a/index/store/metrics/reader.go +++ b/index/store/metrics/reader.go @@ -14,7 +14,7 @@ package metrics -import "github.com/blevesearch/bleve/index/store" +import store "github.com/blevesearch/bleve_index_api/store" type Reader struct { s *Store diff --git a/index/store/metrics/stats.go b/index/store/metrics/stats.go index e27e152c7..f89def1fd 100644 --- a/index/store/metrics/stats.go +++ b/index/store/metrics/stats.go @@ -17,7 +17,7 @@ package metrics import ( "encoding/json" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" ) type stats struct { diff --git a/index/store/metrics/store.go b/index/store/metrics/store.go index dea193454..a7f63f78a 100644 --- a/index/store/metrics/store.go +++ b/index/store/metrics/store.go @@ -25,7 +25,7 @@ import ( "sync" "time" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/registry" "github.com/rcrowley/go-metrics" ) diff --git a/index/store/metrics/store_test.go b/index/store/metrics/store_test.go index c20633af3..473a27746 100644 --- a/index/store/metrics/store_test.go +++ b/index/store/metrics/store_test.go @@ -17,7 +17,7 @@ package metrics import ( "testing" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/index/store/gtreap" "github.com/blevesearch/bleve/index/store/test" ) diff --git a/index/store/metrics/writer.go b/index/store/metrics/writer.go index 8a6b024f6..b61c024bf 100644 --- a/index/store/metrics/writer.go +++ b/index/store/metrics/writer.go @@ -17,7 +17,7 @@ package metrics import ( "fmt" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" ) type Writer struct { diff --git a/index/store/moss/batch.go b/index/store/moss/batch.go index 13eac14db..4506a176a 100644 --- a/index/store/moss/batch.go +++ b/index/store/moss/batch.go @@ -17,7 +17,7 @@ package moss import ( "github.com/couchbase/moss" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" ) type Batch struct { diff --git a/index/store/moss/lower.go b/index/store/moss/lower.go index 1133f95f6..b27adb5d4 100644 --- a/index/store/moss/lower.go +++ b/index/store/moss/lower.go @@ -25,7 +25,7 @@ import ( "github.com/couchbase/moss" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/registry" ) diff --git a/index/store/moss/lower_test.go b/index/store/moss/lower_test.go index afc0a0959..4c3f45a4d 100644 --- a/index/store/moss/lower_test.go +++ b/index/store/moss/lower_test.go @@ -19,7 +19,7 @@ import ( "os" "testing" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/index/store/test" ) diff --git a/index/store/moss/reader.go b/index/store/moss/reader.go index 6aca999e3..8f110e5f8 100644 --- a/index/store/moss/reader.go +++ b/index/store/moss/reader.go @@ -17,7 +17,7 @@ package moss import ( "github.com/couchbase/moss" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" ) type Reader struct { diff --git a/index/store/moss/stats.go b/index/store/moss/stats.go index 4a6493616..b5be0dc1f 100644 --- a/index/store/moss/stats.go +++ b/index/store/moss/stats.go @@ -17,7 +17,7 @@ package moss import ( "encoding/json" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" ) type stats struct { diff --git a/index/store/moss/store.go b/index/store/moss/store.go index 47aab076f..8a7c03fea 100644 --- a/index/store/moss/store.go +++ b/index/store/moss/store.go @@ -24,7 +24,7 @@ import ( "github.com/couchbase/moss" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/registry" ) diff --git a/index/store/moss/store_test.go b/index/store/moss/store_test.go index e9c24784e..3dd571a2f 100644 --- a/index/store/moss/store_test.go +++ b/index/store/moss/store_test.go @@ -17,7 +17,7 @@ package moss import ( "testing" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/index/store/test" ) diff --git a/index/store/moss/writer.go b/index/store/moss/writer.go index a8f888d58..5209c8fc1 100644 --- a/index/store/moss/writer.go +++ b/index/store/moss/writer.go @@ -17,7 +17,7 @@ package moss import ( "fmt" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" "github.com/couchbase/moss" ) diff --git a/index/store/multiget.go b/index/store/multiget.go deleted file mode 100644 index 635bcd411..000000000 --- a/index/store/multiget.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2016 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package store - -// MultiGet is a helper function to retrieve mutiple keys from a -// KVReader, and might be used by KVStore implementations that don't -// have a native multi-get facility. -func MultiGet(kvreader KVReader, keys [][]byte) ([][]byte, error) { - vals := make([][]byte, 0, len(keys)) - - for i, key := range keys { - val, err := kvreader.Get(key) - if err != nil { - return nil, err - } - - vals[i] = val - } - - return vals, nil -} diff --git a/index/store/null/null.go b/index/store/null/null.go index 5201b8ba6..d4a295a88 100644 --- a/index/store/null/null.go +++ b/index/store/null/null.go @@ -15,7 +15,7 @@ package null import ( - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/registry" ) diff --git a/index/store/null/null_test.go b/index/store/null/null_test.go index 7589da678..f4f2c0e28 100644 --- a/index/store/null/null_test.go +++ b/index/store/null/null_test.go @@ -17,7 +17,7 @@ package null import ( "testing" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" ) func TestStore(t *testing.T) { diff --git a/index/store/test/bytes.go b/index/store/test/bytes.go index faef1f952..704ba2d54 100644 --- a/index/store/test/bytes.go +++ b/index/store/test/bytes.go @@ -19,7 +19,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" ) // tests which focus on the byte ownership diff --git a/index/store/test/crud.go b/index/store/test/crud.go index 00236a8a2..72024c6ee 100644 --- a/index/store/test/crud.go +++ b/index/store/test/crud.go @@ -17,7 +17,7 @@ package test import ( "testing" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" ) // basic crud tests diff --git a/index/store/test/isolation.go b/index/store/test/isolation.go index bf40a9fe1..7f1e983ad 100644 --- a/index/store/test/isolation.go +++ b/index/store/test/isolation.go @@ -19,7 +19,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" ) // tests focused on verifying that readers are isolated from writers diff --git a/index/store/test/iterator.go b/index/store/test/iterator.go index b48d99748..7457c1756 100644 --- a/index/store/test/iterator.go +++ b/index/store/test/iterator.go @@ -20,7 +20,7 @@ import ( "strings" "testing" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" ) // tests around the correct behavior of iterators diff --git a/index/store/test/merge.go b/index/store/test/merge.go index f27843178..cdf0dcd35 100644 --- a/index/store/test/merge.go +++ b/index/store/test/merge.go @@ -18,7 +18,7 @@ import ( "encoding/binary" "testing" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/bleve_index_api/store" ) // test merge behavior diff --git a/index/upsidedown/analysis.go b/index/upsidedown/analysis.go index d1b1fd596..bec5dd930 100644 --- a/index/upsidedown/analysis.go +++ b/index/upsidedown/analysis.go @@ -15,37 +15,37 @@ package upsidedown import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" ) -func (udc *UpsideDownCouch) Analyze(d *document.Document) *index.AnalysisResult { +func (udc *UpsideDownCouch) Analyze(d index.Document) *index.AnalysisResult { rv := &index.AnalysisResult{ - DocID: d.ID, + DocID: d.ID(), Rows: make([]index.IndexRow, 0, 100), } - docIDBytes := []byte(d.ID) + docIDBytes := []byte(d.ID()) // track our back index entries backIndexStoredEntries := make([]*BackIndexStoreEntry, 0) // information we collate as we merge fields with same name - fieldTermFreqs := make(map[uint16]analysis.TokenFrequencies) + fieldTermFreqs := make(map[uint16]index.TokenFrequencies) fieldLengths := make(map[uint16]int) fieldIncludeTermVectors := make(map[uint16]bool) fieldNames := make(map[uint16]string) - analyzeField := func(field document.Field, storable bool) { + analyzeField := func(field index.Field, storable bool) { fieldIndex, newFieldRow := udc.fieldIndexOrNewRow(field.Name()) if newFieldRow != nil { rv.Rows = append(rv.Rows, newFieldRow) } fieldNames[fieldIndex] = field.Name() - if field.Options().IsIndexed() { - fieldLength, tokenFreqs := field.Analyze() + if field.IsIndexed() { + field.Analyze() + fieldLength := field.AnalyzedLength() + tokenFreqs := field.AnalyzedTokenFrequencies() existingFreqs := fieldTermFreqs[fieldIndex] if existingFreqs == nil { fieldTermFreqs[fieldIndex] = tokenFreqs @@ -54,10 +54,10 @@ func (udc *UpsideDownCouch) Analyze(d *document.Document) *index.AnalysisResult fieldTermFreqs[fieldIndex] = existingFreqs } fieldLengths[fieldIndex] += fieldLength - fieldIncludeTermVectors[fieldIndex] = field.Options().IncludeTermVectors() + fieldIncludeTermVectors[fieldIndex] = field.IncludeTermVectors() } - if storable && field.Options().IsStored() { + if storable && field.IsStored() { rv.Rows, backIndexStoredEntries = udc.storeField(docIDBytes, field, fieldIndex, rv.Rows, backIndexStoredEntries) } } @@ -66,21 +66,21 @@ func (udc *UpsideDownCouch) Analyze(d *document.Document) *index.AnalysisResult // place information about indexed fields into map // this collates information across fields with // same names (arrays) - for _, field := range d.Fields { + d.VisitFields(func(field index.Field) { analyzeField(field, true) - } + }) - if len(d.CompositeFields) > 0 { + if d.HasComposite() { for fieldIndex, tokenFreqs := range fieldTermFreqs { // see if any of the composite fields need this - for _, compositeField := range d.CompositeFields { - compositeField.Compose(fieldNames[fieldIndex], fieldLengths[fieldIndex], tokenFreqs) - } + d.VisitComposite(func(field index.CompositeField) { + field.Compose(fieldNames[fieldIndex], fieldLengths[fieldIndex], tokenFreqs) + }) } - for _, compositeField := range d.CompositeFields { - analyzeField(compositeField, false) - } + d.VisitComposite(func(field index.CompositeField) { + analyzeField(field, false) + }) } rowsCapNeeded := len(rv.Rows) + 1 diff --git a/index/upsidedown/analysis_test.go b/index/upsidedown/analysis_test.go index 5889b930a..26b96a9c8 100644 --- a/index/upsidedown/analysis_test.go +++ b/index/upsidedown/analysis_test.go @@ -19,7 +19,7 @@ import ( "github.com/blevesearch/bleve/analysis/analyzer/standard" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/index/store/null" "github.com/blevesearch/bleve/registry" ) diff --git a/index/upsidedown/benchmark_common_test.go b/index/upsidedown/benchmark_common_test.go index bb14bf9cb..4ae33f2ce 100644 --- a/index/upsidedown/benchmark_common_test.go +++ b/index/upsidedown/benchmark_common_test.go @@ -21,7 +21,7 @@ import ( _ "github.com/blevesearch/bleve/analysis/analyzer/standard" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/registry" ) @@ -68,7 +68,7 @@ func CommonBenchmarkIndex(b *testing.B, storeName string, storeConfig map[string if err != nil { b.Fatal(err) } - indexDocument.ID = strconv.Itoa(i) + indexDocument.SetID(strconv.Itoa(i)) // just time the indexing portion b.StartTimer() err = idx.Update(indexDocument) @@ -125,7 +125,7 @@ func CommonBenchmarkIndexBatch(b *testing.B, storeName string, storeConfig map[s } indexDocument := document.NewDocument(""). AddField(document.NewTextFieldWithAnalyzer("body", []uint64{}, []byte(benchmarkDocBodies[j%10]), analyzer)) - indexDocument.ID = strconv.Itoa(i) + "-" + strconv.Itoa(j) + indexDocument.SetID(strconv.Itoa(i) + "-" + strconv.Itoa(j)) batch.Update(indexDocument) } // close last batch diff --git a/index/upsidedown/dump.go b/index/upsidedown/dump.go index cb045d249..66505ff56 100644 --- a/index/upsidedown/dump.go +++ b/index/upsidedown/dump.go @@ -18,7 +18,7 @@ import ( "bytes" "sort" - "github.com/blevesearch/bleve/index/store" + "github.com/blevesearch/bleve_index_api/store" ) // the functions in this file are only intended to be used by diff --git a/index/upsidedown/dump_test.go b/index/upsidedown/dump_test.go index 0d816960f..e18fe3944 100644 --- a/index/upsidedown/dump_test.go +++ b/index/upsidedown/dump_test.go @@ -18,7 +18,7 @@ import ( "testing" "time" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/index/store/boltdb" "github.com/blevesearch/bleve/document" diff --git a/index/upsidedown/field_dict.go b/index/upsidedown/field_dict.go index 20d4eb34f..dc848afde 100644 --- a/index/upsidedown/field_dict.go +++ b/index/upsidedown/field_dict.go @@ -17,8 +17,8 @@ package upsidedown import ( "fmt" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/store" + index "github.com/blevesearch/bleve_index_api" + store "github.com/blevesearch/bleve_index_api/store" ) type UpsideDownCouchFieldDict struct { diff --git a/index/upsidedown/field_dict_test.go b/index/upsidedown/field_dict_test.go index 3c59bb212..cd858f2f1 100644 --- a/index/upsidedown/field_dict_test.go +++ b/index/upsidedown/field_dict_test.go @@ -19,7 +19,7 @@ import ( "testing" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/index/store/boltdb" ) diff --git a/index/upsidedown/index_reader.go b/index/upsidedown/index_reader.go index ea7243eaa..6ac7fc932 100644 --- a/index/upsidedown/index_reader.go +++ b/index/upsidedown/index_reader.go @@ -18,8 +18,8 @@ import ( "reflect" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/store" + index "github.com/blevesearch/bleve_index_api" + "github.com/blevesearch/bleve_index_api/store" ) var reflectStaticSizeIndexReader int @@ -67,7 +67,7 @@ func (i *IndexReader) DocIDReaderOnly(ids []string) (index.DocIDReader, error) { return newUpsideDownCouchDocIDReaderOnly(i, ids) } -func (i *IndexReader) Document(id string) (doc *document.Document, err error) { +func (i *IndexReader) Document(id string) (doc index.Document, err error) { // first hit the back index to confirm doc exists var backIndexRow *BackIndexRow backIndexRow, err = backIndexRowForDoc(i.kvreader, []byte(id)) @@ -77,7 +77,7 @@ func (i *IndexReader) Document(id string) (doc *document.Document, err error) { if backIndexRow == nil { return } - doc = document.NewDocument(id) + rvd := document.NewDocument(id) storedRow := NewStoredRow([]byte(id), 0, []uint64{}, 'x', nil) storedRowScanPrefix := storedRow.ScanPrefixForDoc() it := i.kvreader.PrefixIterator(storedRowScanPrefix) @@ -93,21 +93,20 @@ func (i *IndexReader) Document(id string) (doc *document.Document, err error) { var row *StoredRow row, err = NewStoredRowKV(key, safeVal) if err != nil { - doc = nil - return + return nil, err } if row != nil { fieldName := i.index.fieldCache.FieldIndexed(row.field) field := decodeFieldType(row.typ, fieldName, row.arrayPositions, row.value) if field != nil { - doc.AddField(field) + rvd.AddField(field) } } it.Next() key, val, valid = it.Current() } - return + return rvd, nil } func (i *IndexReader) DocumentVisitFieldTerms(id index.IndexInternalID, fields []string, visitor index.DocumentFieldTermVisitor) error { diff --git a/index/upsidedown/reader.go b/index/upsidedown/reader.go index bc0fef119..05bc769f5 100644 --- a/index/upsidedown/reader.go +++ b/index/upsidedown/reader.go @@ -20,8 +20,8 @@ import ( "sort" "sync/atomic" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/store" + index "github.com/blevesearch/bleve_index_api" + "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/size" ) diff --git a/index/upsidedown/reader_test.go b/index/upsidedown/reader_test.go index 22317a3ba..0e1c3c6f2 100644 --- a/index/upsidedown/reader_test.go +++ b/index/upsidedown/reader_test.go @@ -19,7 +19,7 @@ import ( "testing" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/index/store/boltdb" ) diff --git a/index/upsidedown/stats.go b/index/upsidedown/stats.go index a148ab704..db9cd1cab 100644 --- a/index/upsidedown/stats.go +++ b/index/upsidedown/stats.go @@ -18,7 +18,7 @@ import ( "encoding/json" "sync/atomic" - "github.com/blevesearch/bleve/index/store" + "github.com/blevesearch/bleve_index_api/store" ) type indexStat struct { diff --git a/index/upsidedown/upsidedown.go b/index/upsidedown/upsidedown.go index 8e915c6ad..7e5301cea 100644 --- a/index/upsidedown/upsidedown.go +++ b/index/upsidedown/upsidedown.go @@ -25,11 +25,10 @@ import ( "sync/atomic" "time" - "github.com/blevesearch/bleve/analysis" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/store" "github.com/blevesearch/bleve/registry" + index "github.com/blevesearch/bleve_index_api" + store "github.com/blevesearch/bleve_index_api/store" "github.com/golang/protobuf/proto" ) @@ -68,7 +67,7 @@ type UpsideDownCouch struct { type docBackIndexRow struct { docID string - doc *document.Document // If deletion, doc will be nil. + doc index.Document // If deletion, doc will be nil. backIndexRow *BackIndexRow } @@ -412,7 +411,7 @@ func (udc *UpsideDownCouch) Close() error { return udc.store.Close() } -func (udc *UpsideDownCouch) Update(doc *document.Document) (err error) { +func (udc *UpsideDownCouch) Update(doc index.Document) (err error) { // do analysis before acquiring write lock analysisStart := time.Now() resultChan := make(chan *index.AnalysisResult) @@ -439,7 +438,7 @@ func (udc *UpsideDownCouch) Update(doc *document.Document) (err error) { // first we lookup the backindex row for the doc id if it exists // lookup the back index row var backIndexRow *BackIndexRow - backIndexRow, err = backIndexRowForDoc(kvreader, index.IndexInternalID(doc.ID)) + backIndexRow, err = backIndexRowForDoc(kvreader, index.IndexInternalID(doc.ID())) if err != nil { _ = kvreader.Close() atomic.AddUint64(&udc.stats.errors, 1) @@ -454,7 +453,7 @@ func (udc *UpsideDownCouch) Update(doc *document.Document) (err error) { return udc.UpdateWithAnalysis(doc, result, backIndexRow) } -func (udc *UpsideDownCouch) UpdateWithAnalysis(doc *document.Document, +func (udc *UpsideDownCouch) UpdateWithAnalysis(doc index.Document, result *index.AnalysisResult, backIndexRow *BackIndexRow) (err error) { // start a writer for this update indexStart := time.Now() @@ -587,8 +586,8 @@ func (udc *UpsideDownCouch) mergeOldAndNew(backIndexRow *BackIndexRow, rows []in return addRows, updateRows, deleteRows } -func (udc *UpsideDownCouch) storeField(docID []byte, field document.Field, fieldIndex uint16, rows []index.IndexRow, backIndexStoredEntries []*BackIndexStoreEntry) ([]index.IndexRow, []*BackIndexStoreEntry) { - fieldType := encodeFieldType(field) +func (udc *UpsideDownCouch) storeField(docID []byte, field index.Field, fieldIndex uint16, rows []index.IndexRow, backIndexStoredEntries []*BackIndexStoreEntry) ([]index.IndexRow, []*BackIndexStoreEntry) { + fieldType := field.EncodedFieldType() storedRow := NewStoredRow(docID, fieldIndex, field.ArrayPositions(), fieldType, field.Value()) // record the back index entry @@ -616,7 +615,7 @@ func encodeFieldType(f document.Field) byte { return fieldType } -func (udc *UpsideDownCouch) indexField(docID []byte, includeTermVectors bool, fieldIndex uint16, fieldLength int, tokenFreqs analysis.TokenFrequencies, rows []index.IndexRow, backIndexTermsEntries []*BackIndexTermsEntry) ([]index.IndexRow, []*BackIndexTermsEntry) { +func (udc *UpsideDownCouch) indexField(docID []byte, includeTermVectors bool, fieldIndex uint16, fieldLength int, tokenFreqs index.TokenFrequencies, rows []index.IndexRow, backIndexTermsEntries []*BackIndexTermsEntry) ([]index.IndexRow, []*BackIndexTermsEntry) { fieldNorm := float32(1.0 / math.Sqrt(float64(fieldLength))) termFreqRows := make([]TermFrequencyRow, len(tokenFreqs)) @@ -747,11 +746,11 @@ func decodeFieldType(typ byte, name string, pos []uint64, value []byte) document return nil } -func frequencyFromTokenFreq(tf *analysis.TokenFreq) int { +func frequencyFromTokenFreq(tf *index.TokenFreq) int { return tf.Frequency() } -func (udc *UpsideDownCouch) termVectorsFromTokenFreq(field uint16, tf *analysis.TokenFreq, rows []index.IndexRow) ([]*TermVector, []index.IndexRow) { +func (udc *UpsideDownCouch) termVectorsFromTokenFreq(field uint16, tf *index.TokenFreq, rows []index.IndexRow) ([]*TermVector, []index.IndexRow) { a := make([]TermVector, len(tf.Locations)) rv := make([]*TermVector, len(tf.Locations)) diff --git a/index/upsidedown/upsidedown_test.go b/index/upsidedown/upsidedown_test.go index cc7cccfcb..fa39d34fd 100644 --- a/index/upsidedown/upsidedown_test.go +++ b/index/upsidedown/upsidedown_test.go @@ -28,7 +28,7 @@ import ( "github.com/blevesearch/bleve/analysis/analyzer/standard" regexpTokenizer "github.com/blevesearch/bleve/analysis/tokenizer/regexp" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/index/store/boltdb" "github.com/blevesearch/bleve/index/store/null" "github.com/blevesearch/bleve/registry" @@ -555,10 +555,11 @@ func TestIndexInsertWithStore(t *testing.T) { } }() - storedDoc, err := indexReader.Document("1") + storedDocInt, err := indexReader.Document("1") if err != nil { t.Error(err) } + storedDoc := storedDocInt.(*document.Document) if len(storedDoc.Fields) != 1 { t.Errorf("expected 1 stored field, got %d", len(storedDoc.Fields)) @@ -863,10 +864,11 @@ func TestIndexInsertUpdateDeleteWithMultipleTypesStored(t *testing.T) { t.Error(err) } - storedDoc, err := indexReader.Document("1") + storedDocInt, err := indexReader.Document("1") if err != nil { t.Error(err) } + storedDoc := storedDocInt.(*document.Document) err = indexReader.Close() if err != nil { @@ -932,10 +934,11 @@ func TestIndexInsertUpdateDeleteWithMultipleTypesStored(t *testing.T) { } // should only get 2 fields back now though - storedDoc, err = indexReader2.Document("1") + storedDocInt, err = indexReader2.Document("1") if err != nil { t.Error(err) } + storedDoc = storedDocInt.(*document.Document) err = indexReader2.Close() if err != nil { @@ -1118,10 +1121,11 @@ func TestIndexUpdateComposites(t *testing.T) { }() // make sure new values are in index - storedDoc, err := indexReader.Document("1") + storedDocInt, err := indexReader.Document("1") if err != nil { t.Error(err) } + storedDoc := storedDocInt.(*document.Document) if len(storedDoc.Fields) != 2 { t.Errorf("expected 2 stored field, got %d", len(storedDoc.Fields)) } @@ -1394,10 +1398,11 @@ func TestConcurrentUpdate(t *testing.T) { log.Fatal(err) } - doc, err := r.Document("1") + docInt, err := r.Document("1") if err != nil { log.Fatal(err) } + doc := docInt.(*document.Document) if len(doc.Fields) > 1 { t.Errorf("expected single field, found %d", len(doc.Fields)) diff --git a/index_alias_impl.go b/index_alias_impl.go index 5aa57d8ac..c178bb683 100644 --- a/index_alias_impl.go +++ b/index_alias_impl.go @@ -19,9 +19,8 @@ import ( "sync" "time" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/store" + index "github.com/blevesearch/bleve_index_api" + store "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" ) @@ -110,7 +109,7 @@ func (i *indexAliasImpl) Batch(b *Batch) error { return i.indexes[0].Batch(b) } -func (i *indexAliasImpl) Document(id string) (*document.Document, error) { +func (i *indexAliasImpl) Document(id string) (index.Document, error) { i.mutex.RLock() defer i.mutex.RUnlock() diff --git a/index_alias_impl_test.go b/index_alias_impl_test.go index 0c07390a3..1c6c3b3a7 100644 --- a/index_alias_impl_test.go +++ b/index_alias_impl_test.go @@ -22,8 +22,8 @@ import ( "time" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/store" + index "github.com/blevesearch/bleve_index_api" + store "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/numeric" "github.com/blevesearch/bleve/search" @@ -1259,7 +1259,7 @@ func (i *stubIndex) Batch(b *Batch) error { return i.err } -func (i *stubIndex) Document(id string) (*document.Document, error) { +func (i *stubIndex) Document(id string) (index.Document, error) { if i.documentResult != nil { return i.documentResult, nil } diff --git a/index_impl.go b/index_impl.go index 0520fe43b..ac375b873 100644 --- a/index_impl.go +++ b/index_impl.go @@ -24,8 +24,6 @@ import ( "time" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/store" "github.com/blevesearch/bleve/index/upsidedown" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/registry" @@ -33,6 +31,8 @@ import ( "github.com/blevesearch/bleve/search/collector" "github.com/blevesearch/bleve/search/facet" "github.com/blevesearch/bleve/search/highlight" + index "github.com/blevesearch/bleve_index_api" + store "github.com/blevesearch/bleve_index_api/store" ) type indexImpl struct { @@ -271,7 +271,7 @@ func (i *indexImpl) Index(id string, data interface{}) (err error) { // IndexAdvanced takes a document.Document object // skips the mapping and indexes it. func (i *indexImpl) IndexAdvanced(doc *document.Document) (err error) { - if doc.ID == "" { + if doc.ID() == "" { return ErrorEmptyID } @@ -323,7 +323,7 @@ func (i *indexImpl) Batch(b *Batch) error { // stored fields for a document in the index. These // stored fields are put back into a Document object // and returned. -func (i *indexImpl) Document(id string) (doc *document.Document, err error) { +func (i *indexImpl) Document(id string) (doc index.Document, err error) { i.mutex.RLock() defer i.mutex.RUnlock() @@ -617,7 +617,7 @@ func LoadAndHighlightFields(hit *search.DocumentMatch, req *SearchRequest, if len(req.Fields) > 0 { fieldsToLoad := deDuplicate(req.Fields) for _, f := range fieldsToLoad { - for _, docF := range doc.Fields { + doc.VisitFields(func(docF index.Field) { if f == "*" || docF.Name() == f { var value interface{} switch docF := docF.(type) { @@ -651,7 +651,7 @@ func LoadAndHighlightFields(hit *search.DocumentMatch, req *SearchRequest, hit.AddFieldValue(docF.Name(), value) } } - } + }) } } if highlighter != nil { diff --git a/index_test.go b/index_test.go index 394e73083..2ee1df961 100644 --- a/index_test.go +++ b/index_test.go @@ -33,7 +33,7 @@ import ( "github.com/blevesearch/bleve/analysis/analyzer/keyword" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/index/store/boltdb" "github.com/blevesearch/bleve/index/store/null" "github.com/blevesearch/bleve/mapping" @@ -193,10 +193,11 @@ func TestCrud(t *testing.T) { t.Errorf("expected doc count 2, got %d", count) } - doc, err := index.Document("a") + docInt, err := index.Document("a") if err != nil { t.Fatal(err) } + doc := docInt.(*document.Document) if doc == nil { t.Errorf("expected doc not nil, got nil") } @@ -877,10 +878,11 @@ func TestDocumentFieldArrayPositions(t *testing.T) { } // load the document - doc, err := index.Document("k") + docInt, err := index.Document("k") if err != nil { t.Fatal(err) } + doc := docInt.(*document.Document) for _, f := range doc.Fields { if reflect.DeepEqual(f.Value(), []byte("first")) { @@ -936,10 +938,11 @@ func TestDocumentFieldArrayPositions(t *testing.T) { } // load the document - doc, err = index.Document("k2") + docInt, err = index.Document("k2") if err != nil { t.Fatal(err) } + doc = docInt.(*document.Document) for _, f := range doc.Fields { if reflect.DeepEqual(f.Value(), []byte("only")) { @@ -1700,15 +1703,9 @@ func TestIndexAdvancedCountMatchSearch(t *testing.T) { for j := 0; j < 200; j++ { id := fmt.Sprintf("%d", (i*200)+j) - doc := &document.Document{ - ID: id, - Fields: []document.Field{ - document.NewTextField("body", []uint64{}, []byte("match")), - }, - CompositeFields: []*document.CompositeField{ - document.NewCompositeField("_all", true, []string{}, []string{}), - }, - } + doc := document.NewDocument(id) + doc.AddField(document.NewTextField("body", []uint64{}, []byte("match"))) + doc.AddField(document.NewCompositeField("_all", true, []string{}, []string{})) err := b.IndexAdvanced(doc) if err != nil { @@ -1925,10 +1922,11 @@ func TestBatchMerge(t *testing.T) { t.Errorf("expected doc count 2, got %d", count) } - doc, err := index.Document("c") + docInt, err := index.Document("c") if err != nil { t.Fatal(err) } + doc := docInt.(*document.Document) if doc == nil { t.Errorf("expected doc not nil, got nil") } diff --git a/registry/index_type.go b/registry/index_type.go index 4da07c82e..67938c4af 100644 --- a/registry/index_type.go +++ b/registry/index_type.go @@ -17,7 +17,7 @@ package registry import ( "fmt" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" ) func RegisterIndexType(name string, constructor IndexTypeConstructor) { diff --git a/registry/store.go b/registry/store.go index 83187763d..e74871bcf 100644 --- a/registry/store.go +++ b/registry/store.go @@ -17,7 +17,7 @@ package registry import ( "fmt" - "github.com/blevesearch/bleve/index/store" + "github.com/blevesearch/bleve_index_api/store" ) func RegisterKVStore(name string, constructor KVStoreConstructor) { diff --git a/search/collector.go b/search/collector.go index df3ff9c5a..38e34fe7c 100644 --- a/search/collector.go +++ b/search/collector.go @@ -18,7 +18,7 @@ import ( "context" "time" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" ) type Collector interface { diff --git a/search/collector/bench_test.go b/search/collector/bench_test.go index e6a786f41..c0c8f421b 100644 --- a/search/collector/bench_test.go +++ b/search/collector/bench_test.go @@ -20,7 +20,7 @@ import ( "strconv" "testing" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" ) diff --git a/search/collector/search_test.go b/search/collector/search_test.go index 233bc9711..4b9bd9ca3 100644 --- a/search/collector/search_test.go +++ b/search/collector/search_test.go @@ -17,9 +17,8 @@ package collector import ( "reflect" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" "github.com/blevesearch/bleve/search" + index "github.com/blevesearch/bleve_index_api" ) type stubSearcher struct { @@ -118,7 +117,7 @@ func (sr *stubReader) FieldDictPrefix(field string, termPrefix []byte) (index.Fi return nil, nil } -func (sr *stubReader) Document(id string) (*document.Document, error) { +func (sr *stubReader) Document(id string) (index.Document, error) { return nil, nil } diff --git a/search/collector/topn.go b/search/collector/topn.go index 8d4afb63a..57fca0c29 100644 --- a/search/collector/topn.go +++ b/search/collector/topn.go @@ -20,7 +20,7 @@ import ( "strconv" "time" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/size" ) diff --git a/search/collector/topn_test.go b/search/collector/topn_test.go index 2e668bd9e..907a92fa9 100644 --- a/search/collector/topn_test.go +++ b/search/collector/topn_test.go @@ -19,7 +19,7 @@ import ( "context" "testing" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" ) diff --git a/search/facets_builder.go b/search/facets_builder.go index 7fc0bedf3..dc629f6ed 100644 --- a/search/facets_builder.go +++ b/search/facets_builder.go @@ -18,7 +18,7 @@ import ( "reflect" "sort" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/size" ) diff --git a/search/highlight/highlighter.go b/search/highlight/highlighter.go index 8077985d4..33ff285e9 100644 --- a/search/highlight/highlighter.go +++ b/search/highlight/highlighter.go @@ -15,8 +15,8 @@ package highlight import ( - "github.com/blevesearch/bleve/document" "github.com/blevesearch/bleve/search" + index "github.com/blevesearch/bleve_index_api" ) type Fragment struct { @@ -59,6 +59,6 @@ type Highlighter interface { Separator() string SetSeparator(string) - BestFragmentInField(*search.DocumentMatch, *document.Document, string) string - BestFragmentsInField(*search.DocumentMatch, *document.Document, string, int) []string + BestFragmentInField(*search.DocumentMatch, index.Document, string) string + BestFragmentsInField(*search.DocumentMatch, index.Document, string, int) []string } diff --git a/search/highlight/highlighter/simple/highlighter_simple.go b/search/highlight/highlighter/simple/highlighter_simple.go index 4849516ba..14cc235fd 100644 --- a/search/highlight/highlighter/simple/highlighter_simple.go +++ b/search/highlight/highlighter/simple/highlighter_simple.go @@ -17,6 +17,7 @@ package simple import ( "container/heap" "fmt" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/document" "github.com/blevesearch/bleve/registry" @@ -65,7 +66,7 @@ func (s *Highlighter) SetSeparator(sep string) { s.sep = sep } -func (s *Highlighter) BestFragmentInField(dm *search.DocumentMatch, doc *document.Document, field string) string { +func (s *Highlighter) BestFragmentInField(dm *search.DocumentMatch, doc index.Document, field string) string { fragments := s.BestFragmentsInField(dm, doc, field, 1) if len(fragments) > 0 { return fragments[0] @@ -73,7 +74,7 @@ func (s *Highlighter) BestFragmentInField(dm *search.DocumentMatch, doc *documen return "" } -func (s *Highlighter) BestFragmentsInField(dm *search.DocumentMatch, doc *document.Document, field string, num int) []string { +func (s *Highlighter) BestFragmentsInField(dm *search.DocumentMatch, doc index.Document, field string, num int) []string { tlm := dm.Locations[field] orderedTermLocations := highlight.OrderTermLocations(tlm) scorer := NewFragmentScorer(tlm) @@ -81,7 +82,7 @@ func (s *Highlighter) BestFragmentsInField(dm *search.DocumentMatch, doc *docume // score the fragments and put them into a priority queue ordered by score fq := make(FragmentQueue, 0) heap.Init(&fq) - for _, f := range doc.Fields { + doc.VisitFields(func(f index.Field) { if f.Name() == field { _, ok := f.(*document.TextField) if ok { @@ -101,7 +102,7 @@ func (s *Highlighter) BestFragmentsInField(dm *search.DocumentMatch, doc *docume } } } - } + }) // now find the N best non-overlapping fragments var bestFragments []*highlight.Fragment diff --git a/search/query/bool_field.go b/search/query/bool_field.go index b7b5a3d36..356d55fec 100644 --- a/search/query/bool_field.go +++ b/search/query/bool_field.go @@ -15,7 +15,7 @@ package query import ( - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/boolean.go b/search/query/boolean.go index 3cfa1d99f..66bd89586 100644 --- a/search/query/boolean.go +++ b/search/query/boolean.go @@ -18,7 +18,7 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/conjunction.go b/search/query/conjunction.go index 1a7ed1bc0..16e4c9f72 100644 --- a/search/query/conjunction.go +++ b/search/query/conjunction.go @@ -17,7 +17,7 @@ package query import ( "encoding/json" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/date_range.go b/search/query/date_range.go index 3ac0322f5..9eb4338d6 100644 --- a/search/query/date_range.go +++ b/search/query/date_range.go @@ -21,7 +21,7 @@ import ( "time" "github.com/blevesearch/bleve/analysis/datetime/optional" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/numeric" "github.com/blevesearch/bleve/registry" diff --git a/search/query/disjunction.go b/search/query/disjunction.go index a1fc1439a..a926413b9 100644 --- a/search/query/disjunction.go +++ b/search/query/disjunction.go @@ -18,7 +18,7 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/docid.go b/search/query/docid.go index 3b865f93a..711eee483 100644 --- a/search/query/docid.go +++ b/search/query/docid.go @@ -15,7 +15,7 @@ package query import ( - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/fuzzy.go b/search/query/fuzzy.go index f18982d40..b1fbd5ca6 100644 --- a/search/query/fuzzy.go +++ b/search/query/fuzzy.go @@ -15,7 +15,7 @@ package query import ( - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/geo_boundingbox.go b/search/query/geo_boundingbox.go index de6be4a58..b93e81236 100644 --- a/search/query/geo_boundingbox.go +++ b/search/query/geo_boundingbox.go @@ -19,7 +19,7 @@ import ( "fmt" "github.com/blevesearch/bleve/geo" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/geo_boundingpolygon.go b/search/query/geo_boundingpolygon.go index 41c7f7f3a..37ceb3cfe 100644 --- a/search/query/geo_boundingpolygon.go +++ b/search/query/geo_boundingpolygon.go @@ -19,7 +19,7 @@ import ( "fmt" "github.com/blevesearch/bleve/geo" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/geo_distance.go b/search/query/geo_distance.go index ef3aa88c9..b3e5993d3 100644 --- a/search/query/geo_distance.go +++ b/search/query/geo_distance.go @@ -19,7 +19,7 @@ import ( "fmt" "github.com/blevesearch/bleve/geo" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/match.go b/search/query/match.go index 36c9ee4a4..270709a65 100644 --- a/search/query/match.go +++ b/search/query/match.go @@ -18,7 +18,7 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" ) diff --git a/search/query/match_all.go b/search/query/match_all.go index 7fbe1f99d..ffbe96f60 100644 --- a/search/query/match_all.go +++ b/search/query/match_all.go @@ -17,7 +17,7 @@ package query import ( "encoding/json" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/match_none.go b/search/query/match_none.go index dc2ea780c..d1a8c8bfa 100644 --- a/search/query/match_none.go +++ b/search/query/match_none.go @@ -17,7 +17,7 @@ package query import ( "encoding/json" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/match_phrase.go b/search/query/match_phrase.go index 51be35526..e1301de65 100644 --- a/search/query/match_phrase.go +++ b/search/query/match_phrase.go @@ -18,7 +18,7 @@ import ( "fmt" "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" ) diff --git a/search/query/multi_phrase.go b/search/query/multi_phrase.go index 8a7c9b6ad..020a62f3a 100644 --- a/search/query/multi_phrase.go +++ b/search/query/multi_phrase.go @@ -18,7 +18,7 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/numeric_range.go b/search/query/numeric_range.go index ea3f06886..ec6e1cca1 100644 --- a/search/query/numeric_range.go +++ b/search/query/numeric_range.go @@ -17,7 +17,7 @@ package query import ( "fmt" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/phrase.go b/search/query/phrase.go index dff1a02d4..9d2da386f 100644 --- a/search/query/phrase.go +++ b/search/query/phrase.go @@ -18,7 +18,7 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/prefix.go b/search/query/prefix.go index 4f5be2b26..bf2474ec6 100644 --- a/search/query/prefix.go +++ b/search/query/prefix.go @@ -15,7 +15,7 @@ package query import ( - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/query.go b/search/query/query.go index 18aca228d..1b8a3604e 100644 --- a/search/query/query.go +++ b/search/query/query.go @@ -20,7 +20,7 @@ import ( "io/ioutil" "log" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" ) diff --git a/search/query/query_string.go b/search/query/query_string.go index ecafe6bc0..35fea9ebd 100644 --- a/search/query/query_string.go +++ b/search/query/query_string.go @@ -15,7 +15,7 @@ package query import ( - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" ) diff --git a/search/query/regexp.go b/search/query/regexp.go index 0c87a6f92..3e7f24353 100644 --- a/search/query/regexp.go +++ b/search/query/regexp.go @@ -17,7 +17,7 @@ package query import ( "strings" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/term.go b/search/query/term.go index 2eeb5a37a..96821d7dd 100644 --- a/search/query/term.go +++ b/search/query/term.go @@ -15,7 +15,7 @@ package query import ( - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/term_range.go b/search/query/term_range.go index 8f8ca8444..b194fe6bf 100644 --- a/search/query/term_range.go +++ b/search/query/term_range.go @@ -17,7 +17,7 @@ package query import ( "fmt" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/query/wildcard.go b/search/query/wildcard.go index 747dfe76f..88445e5be 100644 --- a/search/query/wildcard.go +++ b/search/query/wildcard.go @@ -17,7 +17,7 @@ package query import ( "strings" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/searcher" diff --git a/search/scorer/scorer_constant.go b/search/scorer/scorer_constant.go index dc10fdaa4..02c651ced 100644 --- a/search/scorer/scorer_constant.go +++ b/search/scorer/scorer_constant.go @@ -18,7 +18,7 @@ import ( "fmt" "reflect" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/size" ) diff --git a/search/scorer/scorer_constant_test.go b/search/scorer/scorer_constant_test.go index 37574a329..d6cbeb898 100644 --- a/search/scorer/scorer_constant_test.go +++ b/search/scorer/scorer_constant_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" ) diff --git a/search/scorer/scorer_term.go b/search/scorer/scorer_term.go index 718de2ea5..b5cd9e2ff 100644 --- a/search/scorer/scorer_term.go +++ b/search/scorer/scorer_term.go @@ -19,7 +19,7 @@ import ( "math" "reflect" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/size" ) diff --git a/search/scorer/scorer_term_test.go b/search/scorer/scorer_term_test.go index b491ee00c..f138373ed 100644 --- a/search/scorer/scorer_term_test.go +++ b/search/scorer/scorer_term_test.go @@ -19,7 +19,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" ) diff --git a/search/search.go b/search/search.go index 8ed23de45..5247fab90 100644 --- a/search/search.go +++ b/search/search.go @@ -19,7 +19,7 @@ import ( "reflect" "sort" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/size" ) diff --git a/search/searcher/base_test.go b/search/searcher/base_test.go index a4644b6b3..450071c08 100644 --- a/search/searcher/base_test.go +++ b/search/searcher/base_test.go @@ -21,7 +21,7 @@ import ( "github.com/blevesearch/bleve/analysis" regexpTokenizer "github.com/blevesearch/bleve/analysis/tokenizer/regexp" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/index/scorch" "github.com/blevesearch/bleve/index/store/gtreap" "github.com/blevesearch/bleve/index/upsidedown" diff --git a/search/searcher/search_boolean.go b/search/searcher/search_boolean.go index 7f0bfa424..69b796518 100644 --- a/search/searcher/search_boolean.go +++ b/search/searcher/search_boolean.go @@ -18,7 +18,7 @@ import ( "math" "reflect" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/scorer" "github.com/blevesearch/bleve/size" diff --git a/search/searcher/search_boolean_test.go b/search/searcher/search_boolean_test.go index 1e2c769e7..226de7621 100644 --- a/search/searcher/search_boolean_test.go +++ b/search/searcher/search_boolean_test.go @@ -17,7 +17,7 @@ package searcher import ( "testing" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_conjunction.go b/search/searcher/search_conjunction.go index ac737bccd..783248ef6 100644 --- a/search/searcher/search_conjunction.go +++ b/search/searcher/search_conjunction.go @@ -19,7 +19,7 @@ import ( "reflect" "sort" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/scorer" "github.com/blevesearch/bleve/size" diff --git a/search/searcher/search_conjunction_test.go b/search/searcher/search_conjunction_test.go index 4a71381be..8b41efba4 100644 --- a/search/searcher/search_conjunction_test.go +++ b/search/searcher/search_conjunction_test.go @@ -20,7 +20,7 @@ import ( "strings" "testing" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/index/scorch" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_disjunction.go b/search/searcher/search_disjunction.go index f47da27c4..5dcbe3af7 100644 --- a/search/searcher/search_disjunction.go +++ b/search/searcher/search_disjunction.go @@ -16,7 +16,7 @@ package searcher import ( "fmt" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_disjunction_heap.go b/search/searcher/search_disjunction_heap.go index 7f0a5a00e..57179df1d 100644 --- a/search/searcher/search_disjunction_heap.go +++ b/search/searcher/search_disjunction_heap.go @@ -20,7 +20,7 @@ import ( "math" "reflect" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/scorer" "github.com/blevesearch/bleve/size" diff --git a/search/searcher/search_disjunction_slice.go b/search/searcher/search_disjunction_slice.go index dc566ade5..de5cd5f4f 100644 --- a/search/searcher/search_disjunction_slice.go +++ b/search/searcher/search_disjunction_slice.go @@ -19,7 +19,7 @@ import ( "reflect" "sort" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/scorer" "github.com/blevesearch/bleve/size" diff --git a/search/searcher/search_disjunction_test.go b/search/searcher/search_disjunction_test.go index effe13847..ba5a72e0a 100644 --- a/search/searcher/search_disjunction_test.go +++ b/search/searcher/search_disjunction_test.go @@ -17,7 +17,7 @@ package searcher import ( "testing" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_docid.go b/search/searcher/search_docid.go index 3b258a580..3de787544 100644 --- a/search/searcher/search_docid.go +++ b/search/searcher/search_docid.go @@ -17,7 +17,7 @@ package searcher import ( "reflect" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/scorer" "github.com/blevesearch/bleve/size" diff --git a/search/searcher/search_docid_test.go b/search/searcher/search_docid_test.go index ff68d6d46..e27b6e8cf 100644 --- a/search/searcher/search_docid_test.go +++ b/search/searcher/search_docid_test.go @@ -18,7 +18,7 @@ import ( "testing" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/index/store/gtreap" "github.com/blevesearch/bleve/index/upsidedown" "github.com/blevesearch/bleve/search" @@ -40,12 +40,9 @@ func testDocIDSearcher(t *testing.T, indexed, searched, wanted []string) { t.Fatal(err) } for _, id := range indexed { - err = i.Update(&document.Document{ - ID: id, - Fields: []document.Field{ - document.NewTextField("desc", []uint64{}, []byte("beer")), - }, - }) + doc := document.NewDocument(id) + doc.AddField(document.NewTextField("desc", []uint64{}, []byte("beer"))) + err = i.Update(doc) if err != nil { t.Fatal(err) } diff --git a/search/searcher/search_filter.go b/search/searcher/search_filter.go index 7c95fb41c..d5a439ba5 100644 --- a/search/searcher/search_filter.go +++ b/search/searcher/search_filter.go @@ -17,7 +17,7 @@ package searcher import ( "reflect" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/size" ) diff --git a/search/searcher/search_fuzzy.go b/search/searcher/search_fuzzy.go index aca8a7d9f..d50f45f82 100644 --- a/search/searcher/search_fuzzy.go +++ b/search/searcher/search_fuzzy.go @@ -17,7 +17,7 @@ package searcher import ( "fmt" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_fuzzy_test.go b/search/searcher/search_fuzzy_test.go index 4a87f139a..5e53121a7 100644 --- a/search/searcher/search_fuzzy_test.go +++ b/search/searcher/search_fuzzy_test.go @@ -17,7 +17,7 @@ package searcher import ( "testing" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_geoboundingbox.go b/search/searcher/search_geoboundingbox.go index 76157f01a..a4ba08709 100644 --- a/search/searcher/search_geoboundingbox.go +++ b/search/searcher/search_geoboundingbox.go @@ -17,7 +17,7 @@ package searcher import ( "github.com/blevesearch/bleve/document" "github.com/blevesearch/bleve/geo" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/numeric" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_geoboundingbox_test.go b/search/searcher/search_geoboundingbox_test.go index 6b3072868..11a355a39 100644 --- a/search/searcher/search_geoboundingbox_test.go +++ b/search/searcher/search_geoboundingbox_test.go @@ -20,7 +20,7 @@ import ( "github.com/blevesearch/bleve/document" "github.com/blevesearch/bleve/geo" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/index/store/gtreap" "github.com/blevesearch/bleve/index/upsidedown" "github.com/blevesearch/bleve/numeric" @@ -107,93 +107,63 @@ func setupGeo(t *testing.T) index.Index { if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "a", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, 0.0015, 0.0015), - }, - }) + doc := document.NewDocument("a") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, 0.0015, 0.0015)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "b", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, 1.0015, 1.0015), - }, - }) + doc = document.NewDocument("b") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, 1.0015, 1.0015)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "c", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, 2.0015, 2.0015), - }, - }) + doc = document.NewDocument("c") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, 2.0015, 2.0015)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "d", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, 3.0015, 3.0015), - }, - }) + doc = document.NewDocument("d") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, 3.0015, 3.0015)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "e", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, 4.0015, 4.0015), - }, - }) + doc = document.NewDocument("e") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, 4.0015, 4.0015)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "f", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, 5.0015, 5.0015), - }, - }) + doc = document.NewDocument("f") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, 5.0015, 5.0015)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "g", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, 6.0015, 6.0015), - }, - }) + doc = document.NewDocument("g") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, 6.0015, 6.0015)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "h", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, 7.0015, 7.0015), - }, - }) + doc = document.NewDocument("h") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, 7.0015, 7.0015)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "i", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, 8.0015, 8.0015), - }, - }) + doc = document.NewDocument("i") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, 8.0015, 8.0015)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "j", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, 9.0015, 9.0015), - }, - }) + doc = document.NewDocument("j") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, 9.0015, 9.0015)) + err = i.Update(doc) if err != nil { t.Fatal(err) } diff --git a/search/searcher/search_geopointdistance.go b/search/searcher/search_geopointdistance.go index b6f293244..826c41de0 100644 --- a/search/searcher/search_geopointdistance.go +++ b/search/searcher/search_geopointdistance.go @@ -16,7 +16,7 @@ package searcher import ( "github.com/blevesearch/bleve/geo" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/numeric" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_geopointdistance_test.go b/search/searcher/search_geopointdistance_test.go index 8b7f1c968..ef6795d4b 100644 --- a/search/searcher/search_geopointdistance_test.go +++ b/search/searcher/search_geopointdistance_test.go @@ -19,7 +19,7 @@ import ( "testing" "github.com/blevesearch/bleve/geo" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_geopolygon.go b/search/searcher/search_geopolygon.go index 5f16aa8d2..75c63a6f1 100644 --- a/search/searcher/search_geopolygon.go +++ b/search/searcher/search_geopolygon.go @@ -17,7 +17,7 @@ package searcher import ( "fmt" "github.com/blevesearch/bleve/geo" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/numeric" "github.com/blevesearch/bleve/search" "math" diff --git a/search/searcher/search_geopolygon_test.go b/search/searcher/search_geopolygon_test.go index 901ef62fe..0272b823d 100644 --- a/search/searcher/search_geopolygon_test.go +++ b/search/searcher/search_geopolygon_test.go @@ -20,7 +20,7 @@ import ( "github.com/blevesearch/bleve/document" "github.com/blevesearch/bleve/geo" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/index/store/gtreap" "github.com/blevesearch/bleve/index/upsidedown" "github.com/blevesearch/bleve/search" @@ -183,132 +183,93 @@ func setupGeoPolygonPoints(t *testing.T) index.Index { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "k", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, -80.86469327, 35.2782), - }, - }) + doc := document.NewDocument("k") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, -80.86469327, 35.2782)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "l", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, -80.8713, 35.28138), - }, - }) + doc = document.NewDocument("l") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, -80.8713, 35.28138)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "m", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, -84.25, 33.153), - }, - }) + doc = document.NewDocument("m") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, -84.25, 33.153)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "n", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, -89.992, 35.063), - }, - }) + doc = document.NewDocument("n") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, -89.992, 35.063)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "o", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, -71.648, 42.437), - }, - }) + doc = document.NewDocument("o") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, -71.648, 42.437)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "p", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, -80.016, 40.314), - }, - }) + doc = document.NewDocument("p") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, -80.016, 40.314)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "q", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, -111.919, 33.494), - }, - }) + doc = document.NewDocument("q") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, -111.919, 33.494)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "r", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, 1.5, 1.1), - }, - }) + doc = document.NewDocument("r") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, 1.5, 1.1)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "s", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, 2, 1.5), - }, - }) + doc = document.NewDocument("s") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, 2, 1.5)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "t", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, 2.0, 1.9), - }, - }) + doc = document.NewDocument("t") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, 2.0, 1.9)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "u", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, 2.0, 1.0), - }, - }) + doc = document.NewDocument("u") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, 2.0, 1.0)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "amoeba", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, 77.60490, 12.97467), - }, - }) + doc = document.NewDocument("amoeba") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, 77.60490, 12.97467)) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "communiti", - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, 77.608237, 12.97237), - }, - }) + doc = document.NewDocument("communiti") + doc.AddField(document.NewGeoPointField("loc", []uint64{}, 77.608237, 12.97237)) + err = i.Update(doc) if err != nil { t.Fatal(err) } @@ -393,12 +354,9 @@ func setupComplexGeoPolygonPoints(t *testing.T, points []geoPoint) index.Index { t.Fatal(err) } for _, point := range points { - err = i.Update(&document.Document{ - ID: point.title, - Fields: []document.Field{ - document.NewGeoPointField("loc", []uint64{}, point.lon, point.lat), - }, - }) + doc := document.NewDocument(point.title) + doc.AddField(document.NewGeoPointField("loc", []uint64{}, point.lon, point.lat)) + err = i.Update(doc) if err != nil { t.Fatal(err) } diff --git a/search/searcher/search_match_all.go b/search/searcher/search_match_all.go index bb6640122..43619ce59 100644 --- a/search/searcher/search_match_all.go +++ b/search/searcher/search_match_all.go @@ -17,7 +17,7 @@ package searcher import ( "reflect" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/scorer" "github.com/blevesearch/bleve/size" diff --git a/search/searcher/search_match_all_test.go b/search/searcher/search_match_all_test.go index 0a3e7e3fe..e91dd0761 100644 --- a/search/searcher/search_match_all_test.go +++ b/search/searcher/search_match_all_test.go @@ -17,7 +17,7 @@ package searcher import ( "testing" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_match_none.go b/search/searcher/search_match_none.go index a345e17f7..9c19b5a8a 100644 --- a/search/searcher/search_match_none.go +++ b/search/searcher/search_match_none.go @@ -17,7 +17,7 @@ package searcher import ( "reflect" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/size" ) diff --git a/search/searcher/search_multi_term.go b/search/searcher/search_multi_term.go index 70a2fa38c..5f919f53c 100644 --- a/search/searcher/search_multi_term.go +++ b/search/searcher/search_multi_term.go @@ -16,7 +16,7 @@ package searcher import ( "fmt" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_numeric_range.go b/search/searcher/search_numeric_range.go index 48d6226e1..a8ccdf281 100644 --- a/search/searcher/search_numeric_range.go +++ b/search/searcher/search_numeric_range.go @@ -19,7 +19,7 @@ import ( "math" "sort" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/numeric" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_phrase.go b/search/searcher/search_phrase.go index 51b7e5bd8..a41af3d8d 100644 --- a/search/searcher/search_phrase.go +++ b/search/searcher/search_phrase.go @@ -19,7 +19,7 @@ import ( "math" "reflect" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/size" ) diff --git a/search/searcher/search_phrase_test.go b/search/searcher/search_phrase_test.go index 04af20f08..b1982ba9e 100644 --- a/search/searcher/search_phrase_test.go +++ b/search/searcher/search_phrase_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_regexp.go b/search/searcher/search_regexp.go index 11a44f159..fb7e141c2 100644 --- a/search/searcher/search_regexp.go +++ b/search/searcher/search_regexp.go @@ -17,7 +17,7 @@ package searcher import ( "regexp" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_regexp_test.go b/search/searcher/search_regexp_test.go index feb23579c..c78d7a986 100644 --- a/search/searcher/search_regexp_test.go +++ b/search/searcher/search_regexp_test.go @@ -22,7 +22,7 @@ import ( "regexp" "testing" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_term.go b/search/searcher/search_term.go index e07d25333..3eb456c36 100644 --- a/search/searcher/search_term.go +++ b/search/searcher/search_term.go @@ -17,7 +17,7 @@ package searcher import ( "reflect" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/scorer" "github.com/blevesearch/bleve/size" diff --git a/search/searcher/search_term_prefix.go b/search/searcher/search_term_prefix.go index 2a8f22cff..3609938d8 100644 --- a/search/searcher/search_term_prefix.go +++ b/search/searcher/search_term_prefix.go @@ -15,7 +15,7 @@ package searcher import ( - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_term_range.go b/search/searcher/search_term_range.go index 90be1e11a..4f10e6c7b 100644 --- a/search/searcher/search_term_range.go +++ b/search/searcher/search_term_range.go @@ -15,7 +15,7 @@ package searcher import ( - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_term_test.go b/search/searcher/search_term_test.go index ad562b090..cb6040a30 100644 --- a/search/searcher/search_term_test.go +++ b/search/searcher/search_term_test.go @@ -19,7 +19,7 @@ import ( "testing" "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/index/store/gtreap" "github.com/blevesearch/bleve/index/upsidedown" "github.com/blevesearch/bleve/search" @@ -46,93 +46,63 @@ func TestTermSearcher(t *testing.T) { if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "a", - Fields: []document.Field{ - document.NewTextField("desc", []uint64{}, []byte("beer")), - }, - }) + doc := document.NewDocument("a") + doc.AddField(document.NewTextField("desc", []uint64{}, []byte("beer"))) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "b", - Fields: []document.Field{ - document.NewTextField("desc", []uint64{}, []byte("beer")), - }, - }) + doc = document.NewDocument("b") + doc.AddField(document.NewTextField("desc", []uint64{}, []byte("beer"))) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "c", - Fields: []document.Field{ - document.NewTextField("desc", []uint64{}, []byte("beer")), - }, - }) + doc = document.NewDocument("c") + doc.AddField(document.NewTextField("desc", []uint64{}, []byte("beer"))) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "d", - Fields: []document.Field{ - document.NewTextField("desc", []uint64{}, []byte("beer")), - }, - }) + doc = document.NewDocument("d") + doc.AddField(document.NewTextField("desc", []uint64{}, []byte("beer"))) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "e", - Fields: []document.Field{ - document.NewTextField("desc", []uint64{}, []byte("beer")), - }, - }) + doc = document.NewDocument("e") + doc.AddField(document.NewTextField("desc", []uint64{}, []byte("beer"))) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "f", - Fields: []document.Field{ - document.NewTextField("desc", []uint64{}, []byte("beer")), - }, - }) + doc = document.NewDocument("f") + doc.AddField(document.NewTextField("desc", []uint64{}, []byte("beer"))) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "g", - Fields: []document.Field{ - document.NewTextField("desc", []uint64{}, []byte("beer")), - }, - }) + doc = document.NewDocument("g") + doc.AddField(document.NewTextField("desc", []uint64{}, []byte("beer"))) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "h", - Fields: []document.Field{ - document.NewTextField("desc", []uint64{}, []byte("beer")), - }, - }) + doc = document.NewDocument("h") + doc.AddField(document.NewTextField("desc", []uint64{}, []byte("beer"))) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "i", - Fields: []document.Field{ - document.NewTextField("desc", []uint64{}, []byte("beer")), - }, - }) + doc = document.NewDocument("i") + doc.AddField(document.NewTextField("desc", []uint64{}, []byte("beer"))) + err = i.Update(doc) if err != nil { t.Fatal(err) } - err = i.Update(&document.Document{ - ID: "j", - Fields: []document.Field{ - document.NewTextField("title", []uint64{}, []byte("cat")), - }, - }) + doc = document.NewDocument("j") + doc.AddField(document.NewTextField("title", []uint64{}, []byte("cat"))) + err = i.Update(doc) if err != nil { t.Fatal(err) } From 81209a82d697ecea69a2526111e3d8d995dc25c2 Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Wed, 11 Nov 2020 09:59:29 -0500 Subject: [PATCH 02/28] reduce map access review comments from Sreekanth --- analysis/freq.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/analysis/freq.go b/analysis/freq.go index e44c90eb9..9f44a6a86 100644 --- a/analysis/freq.go +++ b/analysis/freq.go @@ -38,11 +38,12 @@ func TokenFrequency(tokens TokenStream, arrayPositions []uint64, includeTermVect curr.Locations = append(curr.Locations, &tls[tlNext]) curr.SetFrequency(curr.Frequency() + 1) } else { - rv[string(token.Term)] = &index.TokenFreq{ + tf := &index.TokenFreq{ Term: token.Term, Locations: []*index.TokenLocation{&tls[tlNext]}, } - rv[string(token.Term)].SetFrequency(1) + tf.SetFrequency(1) + rv[string(token.Term)] = tf } tlNext++ @@ -53,10 +54,11 @@ func TokenFrequency(tokens TokenStream, arrayPositions []uint64, includeTermVect if exists { curr.SetFrequency(curr.Frequency() + 1) } else { - rv[string(token.Term)] = &index.TokenFreq{ + tf := &index.TokenFreq{ Term: token.Term, } - rv[string(token.Term)].SetFrequency(1) + tf.SetFrequency(1) + rv[string(token.Term)] = tf } } } From f25d5223f57c668246afb78344dbdc7485f3b2f4 Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Mon, 16 Nov 2020 15:32:53 -0500 Subject: [PATCH 03/28] remove encodeFieldType from upsidedown review comments --- index/upsidedown/upsidedown.go | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/index/upsidedown/upsidedown.go b/index/upsidedown/upsidedown.go index 7e5301cea..6d107b263 100644 --- a/index/upsidedown/upsidedown.go +++ b/index/upsidedown/upsidedown.go @@ -596,25 +596,6 @@ func (udc *UpsideDownCouch) storeField(docID []byte, field index.Field, fieldInd return append(rows, storedRow), append(backIndexStoredEntries, &backIndexStoredEntry) } -func encodeFieldType(f document.Field) byte { - fieldType := byte('x') - switch f.(type) { - case *document.TextField: - fieldType = 't' - case *document.NumericField: - fieldType = 'n' - case *document.DateTimeField: - fieldType = 'd' - case *document.BooleanField: - fieldType = 'b' - case *document.GeoPointField: - fieldType = 'g' - case *document.CompositeField: - fieldType = 'c' - } - return fieldType -} - func (udc *UpsideDownCouch) indexField(docID []byte, includeTermVectors bool, fieldIndex uint16, fieldLength int, tokenFreqs index.TokenFrequencies, rows []index.IndexRow, backIndexTermsEntries []*BackIndexTermsEntry) ([]index.IndexRow, []*BackIndexTermsEntry) { fieldNorm := float32(1.0 / math.Sqrt(float64(fieldLength))) From c32ba08e235eacbb6b670ce9c8d47b0501109adf Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Mon, 23 Nov 2020 13:33:32 -0500 Subject: [PATCH 04/28] reduce index and segment API surface area (#1498) Logic inside segment implementations has been moved up the stack into scorch, so that fewer methods are required in the API. - Iterator() becomes AutomatonIterator(nil, nil, nil) - RangeIterator(start, end) now computes an end key compatible with traditional inclusive start, exclusive end keys. Then becomes: AutomatonIterator(nil, start, endExclusive) - PrefixIterator(prefix) now computes an end key and becomes: AutomatonIterator(nil, prefix, prefixEnd) NumericRangeSearcher updated to no longer require the IndexReaderOnly interface. This interface was only used for non-scorch indexes, but only scorch actually implemented it. Removing this also meant we can remove the OnlyIterator method from the segment dictionary API. --- index/scorch/snapshot_index.go | 54 ++++++++++++++++++++----- index/scorch/snapshot_segment.go | 2 +- search/searcher/search_numeric_range.go | 18 --------- 3 files changed, 45 insertions(+), 29 deletions(-) diff --git a/index/scorch/snapshot_index.go b/index/scorch/snapshot_index.go index 92643d5bb..46e069a83 100644 --- a/index/scorch/snapshot_index.go +++ b/index/scorch/snapshot_index.go @@ -190,21 +190,62 @@ func (i *IndexSnapshot) newIndexSnapshotFieldDict(field string, func (i *IndexSnapshot) FieldDict(field string) (index.FieldDict, error) { return i.newIndexSnapshotFieldDict(field, func(i segment.TermDictionary) segment.DictionaryIterator { - return i.Iterator() + return i.AutomatonIterator(nil, nil, nil) }, false) } +// calculateExclusiveEndFromInclusiveEnd produces the next key +// when sorting using memcmp style comparisons, suitable to +// use as the end key in a traditional (inclusive, exclusive] +// start/end range +func calculateExclusiveEndFromInclusiveEnd(inclusiveEnd []byte) []byte { + rv := inclusiveEnd + if len(inclusiveEnd) > 0 { + rv = make([]byte, len(inclusiveEnd)) + copy(rv, inclusiveEnd) + if rv[len(rv)-1] < 0xff { + // last byte can be incremented by one + rv[len(rv)-1]++ + } else { + // last byte is already 0xff, so append 0 + // next key is simply one byte longer + rv = append(rv, 0x0) + } + } + return rv +} + func (i *IndexSnapshot) FieldDictRange(field string, startTerm []byte, endTerm []byte) (index.FieldDict, error) { return i.newIndexSnapshotFieldDict(field, func(i segment.TermDictionary) segment.DictionaryIterator { - return i.RangeIterator(string(startTerm), string(endTerm)) + endTermExclusive := calculateExclusiveEndFromInclusiveEnd(endTerm) + return i.AutomatonIterator(nil, startTerm, endTermExclusive) }, false) } +// calculateExclusiveEndFromPrefix produces the first key that +// does not have the same prefix as the input bytes, suitable +// to use as the end key in a traditional (inclusive, exclusive] +// start/end range +func calculateExclusiveEndFromPrefix(in []byte) []byte { + rv := make([]byte, len(in)) + copy(rv, in) + for i := len(rv) - 1; i >= 0; i-- { + rv[i] = rv[i] + 1 + if rv[i] != 0 { + return rv // didn't overflow, so stop + } + } + // all bytes were 0xff, so return nil + // as there is no end key for this prefix + return nil +} + func (i *IndexSnapshot) FieldDictPrefix(field string, termPrefix []byte) (index.FieldDict, error) { + termPrefixEnd := calculateExclusiveEndFromPrefix(termPrefix) return i.newIndexSnapshotFieldDict(field, func(i segment.TermDictionary) segment.DictionaryIterator { - return i.PrefixIterator(string(termPrefix)) + return i.AutomatonIterator(nil, termPrefix, termPrefixEnd) }, false) } @@ -251,13 +292,6 @@ func (i *IndexSnapshot) FieldDictFuzzy(field string, }, false) } -func (i *IndexSnapshot) FieldDictOnly(field string, - onlyTerms [][]byte, includeCount bool) (index.FieldDict, error) { - return i.newIndexSnapshotFieldDict(field, func(i segment.TermDictionary) segment.DictionaryIterator { - return i.OnlyIterator(onlyTerms, includeCount) - }, false) -} - func (i *IndexSnapshot) FieldDictContains(field string) (index.FieldDictContains, error) { return i.newIndexSnapshotFieldDict(field, nil, true) } diff --git a/index/scorch/snapshot_segment.go b/index/scorch/snapshot_segment.go index c6e9682ad..749580e63 100644 --- a/index/scorch/snapshot_segment.go +++ b/index/scorch/snapshot_segment.go @@ -147,7 +147,7 @@ func (cfd *cachedFieldDocs) prepareField(field string, ss *SegmentSnapshot) { var postings segment.PostingsList var postingsItr segment.PostingsIterator - dictItr := dict.Iterator() + dictItr := dict.AutomatonIterator(nil, nil, nil) next, err := dictItr.Next() for err == nil && next != nil { var err1 error diff --git a/search/searcher/search_numeric_range.go b/search/searcher/search_numeric_range.go index a8ccdf281..f9787c95c 100644 --- a/search/searcher/search_numeric_range.go +++ b/search/searcher/search_numeric_range.go @@ -106,24 +106,6 @@ func NewNumericRangeSearcher(indexReader index.IndexReader, func filterCandidateTerms(indexReader index.IndexReader, terms [][]byte, field string) (rv [][]byte, err error) { - if ir, ok := indexReader.(index.IndexReaderOnly); ok { - fieldDict, err := ir.FieldDictOnly(field, terms, false) - if err != nil { - return nil, err - } - // enumerate the terms (no need to check them again) - tfd, err := fieldDict.Next() - for err == nil && tfd != nil { - rv = append(rv, []byte(tfd.Term)) - tfd, err = fieldDict.Next() - } - if cerr := fieldDict.Close(); cerr != nil && err == nil { - err = cerr - } - - return rv, err - } - fieldDict, err := indexReader.FieldDictRange(field, terms[0], terms[len(terms)-1]) if err != nil { return nil, err From b85c082d4c8f44c1372b183cc5169d3a44538591 Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Tue, 24 Nov 2020 09:20:12 -0500 Subject: [PATCH 05/28] move regexp compilation into scorch (#1500) this code was originally placed in the segment package, however it is only used by scorch, and makes more sense to be placed at this level --- index/scorch/regexp.go | 63 ++++++++++++++++++++++++++++++++++ index/scorch/regexp_test.go | 57 ++++++++++++++++++++++++++++++ index/scorch/snapshot_index.go | 2 +- 3 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 index/scorch/regexp.go create mode 100644 index/scorch/regexp_test.go diff --git a/index/scorch/regexp.go b/index/scorch/regexp.go new file mode 100644 index 000000000..6c43d99e2 --- /dev/null +++ b/index/scorch/regexp.go @@ -0,0 +1,63 @@ +// Copyright (c) 2020 Couchbase, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scorch + +import ( + "regexp/syntax" + + "github.com/couchbase/vellum/regexp" +) + +func parseRegexp(pattern string) (a *regexp.Regexp, prefixBeg, prefixEnd []byte, err error) { + // TODO: potential optimization where syntax.Regexp supports a Simplify() API? + + parsed, err := syntax.Parse(pattern, syntax.Perl) + if err != nil { + return nil, nil, nil, err + } + + re, err := regexp.NewParsedWithLimit(pattern, parsed, regexp.DefaultLimit) + if err != nil { + return nil, nil, nil, err + } + + prefix := literalPrefix(parsed) + if prefix != "" { + prefixBeg := []byte(prefix) + prefixEnd := calculateExclusiveEndFromPrefix(prefixBeg) + return re, prefixBeg, prefixEnd, nil + } + + return re, nil, nil, nil +} + +// Returns the literal prefix given the parse tree for a regexp +func literalPrefix(s *syntax.Regexp) string { + // traverse the left-most branch in the parse tree as long as the + // node represents a concatenation + for s != nil && s.Op == syntax.OpConcat { + if len(s.Sub) < 1 { + return "" + } + + s = s.Sub[0] + } + + if s.Op == syntax.OpLiteral && (s.Flags&syntax.FoldCase == 0) { + return string(s.Rune) + } + + return "" // no literal prefix +} diff --git a/index/scorch/regexp_test.go b/index/scorch/regexp_test.go new file mode 100644 index 000000000..305b20ce4 --- /dev/null +++ b/index/scorch/regexp_test.go @@ -0,0 +1,57 @@ +// Copyright (c) 2020 Couchbase, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scorch + +import ( + "regexp/syntax" + "testing" +) + +func TestLiteralPrefix(t *testing.T) { + tests := []struct { + input, expected string + }{ + {"", ""}, + {"hello", "hello"}, + {"hello.?", "hello"}, + {"hello$", "hello"}, + {`[h][e][l][l][o].*world`, "hello"}, + {`[h-h][e-e][l-l][l-l][o-o].*world`, "hello"}, + {".*", ""}, + {"h.*", "h"}, + {"h.?", "h"}, + {"h[a-z]", "h"}, + {`h\s`, "h"}, + {`(hello)world`, ""}, + {`日本語`, "日本語"}, + {`日本語\w`, "日本語"}, + {`^hello`, ""}, + {`^`, ""}, + {`$`, ""}, + {`(?i)mArTy`, ""}, + } + + for i, test := range tests { + s, err := syntax.Parse(test.input, syntax.Perl) + if err != nil { + t.Fatalf("expected no syntax.Parse error, got: %v", err) + } + + got := literalPrefix(s) + if test.expected != got { + t.Fatalf("test: %d, %+v, got: %s", i, test, got) + } + } +} diff --git a/index/scorch/snapshot_index.go b/index/scorch/snapshot_index.go index 46e069a83..2d295732e 100644 --- a/index/scorch/snapshot_index.go +++ b/index/scorch/snapshot_index.go @@ -254,7 +254,7 @@ func (i *IndexSnapshot) FieldDictRegexp(field string, // TODO: potential optimization where the literal prefix represents the, // entire regexp, allowing us to use PrefixIterator(prefixTerm)? - a, prefixBeg, prefixEnd, err := segment.ParseRegexp(termRegex) + a, prefixBeg, prefixEnd, err := parseRegexp(termRegex) if err != nil { return nil, err } From 01f884d16a1e5e02cbbdcd9421607dbf5e706189 Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Tue, 24 Nov 2020 09:21:53 -0500 Subject: [PATCH 06/28] move in more things from the segment package (#1501) the empty postings iterator is now only used by scorch's optimize.go, so it is relocated here the uvarint ascending encode/decode is only used by scorch, so it too is moved inside this package --- index/scorch/empty.go | 33 ++++++++++++++ index/scorch/int.go | 87 +++++++++++++++++++++++++++++++++++++ index/scorch/int_test.go | 91 +++++++++++++++++++++++++++++++++++++++ index/scorch/optimize.go | 10 ++--- index/scorch/persister.go | 14 +++--- index/scorch/rollback.go | 7 ++- 6 files changed, 226 insertions(+), 16 deletions(-) create mode 100644 index/scorch/empty.go create mode 100644 index/scorch/int.go create mode 100644 index/scorch/int_test.go diff --git a/index/scorch/empty.go b/index/scorch/empty.go new file mode 100644 index 000000000..7bda01aa4 --- /dev/null +++ b/index/scorch/empty.go @@ -0,0 +1,33 @@ +// Copyright (c) 2020 Couchbase, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scorch + +import segment "github.com/blevesearch/scorch_segment_api" + +type emptyPostingsIterator struct{} + +func (e *emptyPostingsIterator) Next() (segment.Posting, error) { + return nil, nil +} + +func (e *emptyPostingsIterator) Advance(uint64) (segment.Posting, error) { + return nil, nil +} + +func (e *emptyPostingsIterator) Size() int { + return 0 +} + +var anEmptyPostingsIterator = &emptyPostingsIterator{} diff --git a/index/scorch/int.go b/index/scorch/int.go new file mode 100644 index 000000000..fc5cedfc8 --- /dev/null +++ b/index/scorch/int.go @@ -0,0 +1,87 @@ +// Copyright (c) 2020 Couchbase, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scorch + +import "fmt" + +const ( + // intMin is chosen such that the range of int tags does not overlap the + // ascii character set that is frequently used in testing. + intMin = 0x80 // 128 + intMaxWidth = 8 + intZero = intMin + intMaxWidth // 136 + intSmall = intMax - intZero - intMaxWidth // 109 + // intMax is the maximum int tag value. + intMax = 0xfd // 253 +) + +// encodeUvarintAscending encodes the uint64 value using a variable length +// (length-prefixed) representation. The length is encoded as a single +// byte indicating the number of encoded bytes (-8) to follow. See +// EncodeVarintAscending for rationale. The encoded bytes are appended to the +// supplied buffer and the final buffer is returned. +func encodeUvarintAscending(b []byte, v uint64) []byte { + switch { + case v <= intSmall: + return append(b, intZero+byte(v)) + case v <= 0xff: + return append(b, intMax-7, byte(v)) + case v <= 0xffff: + return append(b, intMax-6, byte(v>>8), byte(v)) + case v <= 0xffffff: + return append(b, intMax-5, byte(v>>16), byte(v>>8), byte(v)) + case v <= 0xffffffff: + return append(b, intMax-4, byte(v>>24), byte(v>>16), byte(v>>8), byte(v)) + case v <= 0xffffffffff: + return append(b, intMax-3, byte(v>>32), byte(v>>24), byte(v>>16), byte(v>>8), + byte(v)) + case v <= 0xffffffffffff: + return append(b, intMax-2, byte(v>>40), byte(v>>32), byte(v>>24), byte(v>>16), + byte(v>>8), byte(v)) + case v <= 0xffffffffffffff: + return append(b, intMax-1, byte(v>>48), byte(v>>40), byte(v>>32), byte(v>>24), + byte(v>>16), byte(v>>8), byte(v)) + default: + return append(b, intMax, byte(v>>56), byte(v>>48), byte(v>>40), byte(v>>32), + byte(v>>24), byte(v>>16), byte(v>>8), byte(v)) + } +} + +// decodeUvarintAscending decodes a varint encoded uint64 from the input +// buffer. The remainder of the input buffer and the decoded uint64 +// are returned. +func decodeUvarintAscending(b []byte) ([]byte, uint64, error) { + if len(b) == 0 { + return nil, 0, fmt.Errorf("insufficient bytes to decode uvarint value") + } + length := int(b[0]) - intZero + b = b[1:] // skip length byte + if length <= intSmall { + return b, uint64(length), nil + } + length -= intSmall + if length < 0 || length > 8 { + return nil, 0, fmt.Errorf("invalid uvarint length of %d", length) + } else if len(b) < length { + return nil, 0, fmt.Errorf("insufficient bytes to decode uvarint value: %q", b) + } + var v uint64 + // It is faster to range over the elements in a slice than to index + // into the slice on each loop iteration. + for _, t := range b[:length] { + v = (v << 8) | uint64(t) + } + return b[length:], v, nil +} diff --git a/index/scorch/int_test.go b/index/scorch/int_test.go new file mode 100644 index 000000000..85dfcb370 --- /dev/null +++ b/index/scorch/int_test.go @@ -0,0 +1,91 @@ +// Copyright (c) 2020 Couchbase, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scorch + +import ( + "bytes" + "math" + "testing" +) + +type testCaseUint64 struct { + value uint64 + expEnc []byte +} + +func TestEncodeDecodeUvarint(t *testing.T) { + testBasicEncodeDecodeUint64(encodeUvarintAscending, decodeUvarintAscending, false, t) + testCases := []testCaseUint64{ + {0, []byte{0x88}}, + {1, []byte{0x89}}, + {109, []byte{0xf5}}, + {110, []byte{0xf6, 0x6e}}, + {1 << 8, []byte{0xf7, 0x01, 0x00}}, + {math.MaxUint64, []byte{0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}, + } + testCustomEncodeUint64(testCases, encodeUvarintAscending, t) +} + +func testBasicEncodeDecodeUint64( + encFunc func([]byte, uint64) []byte, + decFunc func([]byte) ([]byte, uint64, error), + descending bool, t *testing.T, +) { + testCases := []uint64{ + 0, 1, + 1<<8 - 1, 1 << 8, + 1<<16 - 1, 1 << 16, + 1<<24 - 1, 1 << 24, + 1<<32 - 1, 1 << 32, + 1<<40 - 1, 1 << 40, + 1<<48 - 1, 1 << 48, + 1<<56 - 1, 1 << 56, + math.MaxUint64 - 1, math.MaxUint64, + } + + var lastEnc []byte + for i, v := range testCases { + enc := encFunc(nil, v) + if i > 0 { + if (descending && bytes.Compare(enc, lastEnc) >= 0) || + (!descending && bytes.Compare(enc, lastEnc) < 0) { + t.Errorf("ordered constraint violated for %d: [% x] vs. [% x]", v, enc, lastEnc) + } + } + b, decode, err := decFunc(enc) + if err != nil { + t.Error(err) + continue + } + if len(b) != 0 { + t.Errorf("leftover bytes: [% x]", b) + } + if decode != v { + t.Errorf("decode yielded different value than input: %d vs. %d", decode, v) + } + lastEnc = enc + } +} + +func testCustomEncodeUint64( + testCases []testCaseUint64, encFunc func([]byte, uint64) []byte, t *testing.T, +) { + for _, test := range testCases { + enc := encFunc(nil, test.value) + if !bytes.Equal(enc, test.expEnc) { + t.Errorf("expected [% x]; got [% x] (value: %d)", test.expEnc, enc, test.value) + } + } +} \ No newline at end of file diff --git a/index/scorch/optimize.go b/index/scorch/optimize.go index b62869b52..28b19b625 100644 --- a/index/scorch/optimize.go +++ b/index/scorch/optimize.go @@ -176,7 +176,7 @@ OUTER: for _, tfr := range o.tfrs { if _, ok := tfr.iterators[i].(*segment.EmptyPostingsIterator); ok { // An empty postings iterator means the entire AND is empty. - oTFR.iterators[i] = segment.AnEmptyPostingsIterator + oTFR.iterators[i] = anEmptyPostingsIterator continue OUTER } @@ -193,7 +193,7 @@ OUTER: if docNum1HitLastOk && docNum1HitLast != docNum1Hit { // The docNum1Hit doesn't match the previous // docNum1HitLast, so the entire AND is empty. - oTFR.iterators[i] = segment.AnEmptyPostingsIterator + oTFR.iterators[i] = anEmptyPostingsIterator continue OUTER } @@ -205,7 +205,7 @@ OUTER: if itr.ActualBitmap() == nil { // An empty actual bitmap means the entire AND is empty. - oTFR.iterators[i] = segment.AnEmptyPostingsIterator + oTFR.iterators[i] = anEmptyPostingsIterator continue OUTER } @@ -221,7 +221,7 @@ OUTER: if !bm.Contains(uint32(docNum1HitLast)) { // The docNum1Hit isn't in one of our actual // bitmaps, so the entire AND is empty. - oTFR.iterators[i] = segment.AnEmptyPostingsIterator + oTFR.iterators[i] = anEmptyPostingsIterator continue OUTER } } @@ -236,7 +236,7 @@ OUTER: if len(actualBMs) == 0 { // If we've collected no actual bitmaps at this point, // then the entire AND is empty. - oTFR.iterators[i] = segment.AnEmptyPostingsIterator + oTFR.iterators[i] = anEmptyPostingsIterator continue OUTER } diff --git a/index/scorch/persister.go b/index/scorch/persister.go index 2d0df8a96..d50f46e8d 100644 --- a/index/scorch/persister.go +++ b/index/scorch/persister.go @@ -434,7 +434,7 @@ func prepareBoltSnapshot(snapshot *IndexSnapshot, tx *bolt.Tx, path string, if err != nil { return nil, nil, err } - newSnapshotKey := segment.EncodeUvarintAscending(nil, snapshot.epoch) + newSnapshotKey := encodeUvarintAscending(nil, snapshot.epoch) snapshotBucket, err := snapshotsBucket.CreateBucketIfNotExists(newSnapshotKey) if err != nil { return nil, nil, err @@ -474,7 +474,7 @@ func prepareBoltSnapshot(snapshot *IndexSnapshot, tx *bolt.Tx, path string, // first ensure that each segment in this snapshot has been persisted for _, segmentSnapshot := range snapshot.segment { - snapshotSegmentKey := segment.EncodeUvarintAscending(nil, segmentSnapshot.id) + snapshotSegmentKey := encodeUvarintAscending(nil, segmentSnapshot.id) snapshotSegmentBucket, err := snapshotBucket.CreateBucketIfNotExists(snapshotSegmentKey) if err != nil { return nil, nil, err @@ -628,7 +628,7 @@ func (s *Scorch) loadFromBolt() error { foundRoot := false c := snapshots.Cursor() for k, _ := c.Last(); k != nil; k, _ = c.Prev() { - _, snapshotEpoch, err := segment.DecodeUvarintAscending(k) + _, snapshotEpoch, err := decodeUvarintAscending(k) if err != nil { log.Printf("unable to parse segment epoch %x, continuing", k) continue @@ -680,7 +680,7 @@ func (s *Scorch) LoadSnapshot(epoch uint64) (rv *IndexSnapshot, err error) { if snapshots == nil { return nil } - snapshotKey := segment.EncodeUvarintAscending(nil, epoch) + snapshotKey := encodeUvarintAscending(nil, epoch) snapshot := snapshots.Bucket(snapshotKey) if snapshot == nil { return fmt.Errorf("snapshot with epoch: %v - doesn't exist", epoch) @@ -744,7 +744,7 @@ func (s *Scorch) loadSnapshot(snapshot *bolt.Bucket) (*IndexSnapshot, error) { _ = rv.DecRef() return nil, fmt.Errorf("failed to load segment: %v", err) } - _, segmentSnapshot.id, err = segment.DecodeUvarintAscending(k) + _, segmentSnapshot.id, err = decodeUvarintAscending(k) if err != nil { _ = rv.DecRef() return nil, fmt.Errorf("failed to decode segment id: %v", err) @@ -865,7 +865,7 @@ func (s *Scorch) removeOldBoltSnapshots() (numRemoved int, err error) { } for _, epochToRemove := range epochsToRemove { - k := segment.EncodeUvarintAscending(nil, epochToRemove) + k := encodeUvarintAscending(nil, epochToRemove) err = snapshots.DeleteBucket(k) if err == bolt.ErrBucketNotFound { err = nil @@ -941,7 +941,7 @@ func (s *Scorch) RootBoltSnapshotEpochs() ([]uint64, error) { } sc := snapshots.Cursor() for sk, _ := sc.Last(); sk != nil; sk, _ = sc.Prev() { - _, snapshotEpoch, err := segment.DecodeUvarintAscending(sk) + _, snapshotEpoch, err := decodeUvarintAscending(sk) if err != nil { continue } diff --git a/index/scorch/rollback.go b/index/scorch/rollback.go index 353b1f531..067220e6f 100644 --- a/index/scorch/rollback.go +++ b/index/scorch/rollback.go @@ -19,7 +19,6 @@ import ( "log" "os" - segment "github.com/blevesearch/scorch_segment_api" bolt "go.etcd.io/bbolt" ) @@ -71,7 +70,7 @@ func RollbackPoints(path string) ([]*RollbackPoint, error) { c1 := snapshots.Cursor() for k, _ := c1.Last(); k != nil; k, _ = c1.Prev() { - _, snapshotEpoch, err := segment.DecodeUvarintAscending(k) + _, snapshotEpoch, err := decodeUvarintAscending(k) if err != nil { log.Printf("RollbackPoints:"+ " unable to parse segment epoch %x, continuing", k) @@ -154,7 +153,7 @@ func Rollback(path string, to *RollbackPoint) error { } sc := snapshots.Cursor() for sk, _ := sc.Last(); sk != nil && !found; sk, _ = sc.Prev() { - _, snapshotEpoch, err := segment.DecodeUvarintAscending(sk) + _, snapshotEpoch, err := decodeUvarintAscending(sk) if err != nil { continue } @@ -195,7 +194,7 @@ func Rollback(path string, to *RollbackPoint) error { return nil } for _, epoch := range eligibleEpochs { - k := segment.EncodeUvarintAscending(nil, epoch) + k := encodeUvarintAscending(nil, epoch) if err != nil { continue } From 8cd7ab116beded0e7ce44263e189f928bd494bb9 Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Tue, 24 Nov 2020 09:22:29 -0500 Subject: [PATCH 07/28] move unadorned into scorch (#1502) the unadorned postings lists are only used by scorch so they are relocated to this package --- index/scorch/optimize.go | 8 +- index/scorch/unadorned.go | 161 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 165 insertions(+), 4 deletions(-) create mode 100644 index/scorch/unadorned.go diff --git a/index/scorch/optimize.go b/index/scorch/optimize.go index 28b19b625..fa828969f 100644 --- a/index/scorch/optimize.go +++ b/index/scorch/optimize.go @@ -228,7 +228,7 @@ OUTER: // The actual bitmaps and docNum1Hits all contain or have // the same 1-hit docNum, so that's our AND'ed result. - oTFR.iterators[i] = segment.NewUnadornedPostingsIteratorFrom1Hit(docNum1HitLast) + oTFR.iterators[i] = newUnadornedPostingsIteratorFrom1Hit(docNum1HitLast) continue OUTER } @@ -242,7 +242,7 @@ OUTER: if len(actualBMs) == 1 { // If we've only 1 actual bitmap, then that's our result. - oTFR.iterators[i] = segment.NewUnadornedPostingsIteratorFromBitmap(actualBMs[0]) + oTFR.iterators[i] = newUnadornedPostingsIteratorFromBitmap(actualBMs[0]) continue OUTER } @@ -254,7 +254,7 @@ OUTER: bm.And(actualBM) } - oTFR.iterators[i] = segment.NewUnadornedPostingsIteratorFromBitmap(bm) + oTFR.iterators[i] = newUnadornedPostingsIteratorFromBitmap(bm) } atomic.AddUint64(&o.snapshot.parent.stats.TotTermSearchersStarted, uint64(1)) @@ -369,7 +369,7 @@ func (o *OptimizeTFRDisjunctionUnadorned) Finish() (rv index.Optimized, err erro bm.AddMany(docNums) - oTFR.iterators[i] = segment.NewUnadornedPostingsIteratorFromBitmap(bm) + oTFR.iterators[i] = newUnadornedPostingsIteratorFromBitmap(bm) } atomic.AddUint64(&o.snapshot.parent.stats.TotTermSearchersStarted, uint64(1)) diff --git a/index/scorch/unadorned.go b/index/scorch/unadorned.go new file mode 100644 index 000000000..bc7ca4e31 --- /dev/null +++ b/index/scorch/unadorned.go @@ -0,0 +1,161 @@ +// Copyright (c) 2020 Couchbase, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scorch + +import ( + "github.com/RoaringBitmap/roaring" + segment "github.com/blevesearch/scorch_segment_api" + "math" + "reflect" +) + +var reflectStaticSizeUnadornedPostingsIteratorBitmap int +var reflectStaticSizeUnadornedPostingsIterator1Hit int +var reflectStaticSizeUnadornedPosting int + +func init() { + var pib unadornedPostingsIteratorBitmap + reflectStaticSizeUnadornedPostingsIteratorBitmap = int(reflect.TypeOf(pib).Size()) + var pi1h unadornedPostingsIterator1Hit + reflectStaticSizeUnadornedPostingsIterator1Hit = int(reflect.TypeOf(pi1h).Size()) + var up UnadornedPosting + reflectStaticSizeUnadornedPosting = int(reflect.TypeOf(up).Size()) +} + +type unadornedPostingsIteratorBitmap struct { + actual roaring.IntPeekable + actualBM *roaring.Bitmap +} + +func (i *unadornedPostingsIteratorBitmap) Next() (segment.Posting, error) { + return i.nextAtOrAfter(0) +} + +func (i *unadornedPostingsIteratorBitmap) Advance(docNum uint64) (segment.Posting, error) { + return i.nextAtOrAfter(docNum) +} + +func (i *unadornedPostingsIteratorBitmap) nextAtOrAfter(atOrAfter uint64) (segment.Posting, error) { + docNum, exists := i.nextDocNumAtOrAfter(atOrAfter) + if !exists { + return nil, nil + } + return UnadornedPosting(docNum), nil +} + +func (i *unadornedPostingsIteratorBitmap) nextDocNumAtOrAfter(atOrAfter uint64) (uint64, bool) { + if i.actual == nil || !i.actual.HasNext() { + return 0, false + } + i.actual.AdvanceIfNeeded(uint32(atOrAfter)) + + if !i.actual.HasNext() { + return 0, false // couldn't find anything + } + + return uint64(i.actual.Next()), true +} + +func (i *unadornedPostingsIteratorBitmap) Size() int { + return reflectStaticSizeUnadornedPostingsIteratorBitmap +} + +func (i *unadornedPostingsIteratorBitmap) ActualBitmap() *roaring.Bitmap { + return i.actualBM +} + +func (i *unadornedPostingsIteratorBitmap) DocNum1Hit() (uint64, bool) { + return 0, false +} + +func (i *unadornedPostingsIteratorBitmap) ReplaceActual(actual *roaring.Bitmap) { + i.actualBM = actual + i.actual = actual.Iterator() +} + +func newUnadornedPostingsIteratorFromBitmap(bm *roaring.Bitmap) segment.PostingsIterator { + return &unadornedPostingsIteratorBitmap{ + actualBM: bm, + actual: bm.Iterator(), + } +} + +const docNum1HitFinished = math.MaxUint64 + +type unadornedPostingsIterator1Hit struct { + docNum uint64 +} + +func (i *unadornedPostingsIterator1Hit) Next() (segment.Posting, error) { + return i.nextAtOrAfter(0) +} + +func (i *unadornedPostingsIterator1Hit) Advance(docNum uint64) (segment.Posting, error) { + return i.nextAtOrAfter(docNum) +} + +func (i *unadornedPostingsIterator1Hit) nextAtOrAfter(atOrAfter uint64) (segment.Posting, error) { + docNum, exists := i.nextDocNumAtOrAfter(atOrAfter) + if !exists { + return nil, nil + } + return UnadornedPosting(docNum), nil +} + +func (i *unadornedPostingsIterator1Hit) nextDocNumAtOrAfter(atOrAfter uint64) (uint64, bool) { + if i.docNum == docNum1HitFinished { + return 0, false + } + if i.docNum < atOrAfter { + // advanced past our 1-hit + i.docNum = docNum1HitFinished // consume our 1-hit docNum + return 0, false + } + docNum := i.docNum + i.docNum = docNum1HitFinished // consume our 1-hit docNum + return docNum, true +} + +func (i *unadornedPostingsIterator1Hit) Size() int { + return reflectStaticSizeUnadornedPostingsIterator1Hit +} + +func newUnadornedPostingsIteratorFrom1Hit(docNum1Hit uint64) segment.PostingsIterator { + return &unadornedPostingsIterator1Hit{ + docNum1Hit, + } +} + +type UnadornedPosting uint64 + +func (p UnadornedPosting) Number() uint64 { + return uint64(p) +} + +func (p UnadornedPosting) Frequency() uint64 { + return 0 +} + +func (p UnadornedPosting) Norm() float64 { + return 0 +} + +func (p UnadornedPosting) Locations() []segment.Location { + return nil +} + +func (p UnadornedPosting) Size() int { + return reflectStaticSizeUnadornedPosting +} From 9d868004f2e5503ff3e024fc85511b5a18c3a8a5 Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Fri, 27 Nov 2020 14:51:31 -0500 Subject: [PATCH 08/28] switch to tagged api versions (#1503) note: while doing this it was observed that 'go mod tidy' was failing with an error. this relates to the kvstores in the blevex package which will needed to be updated separately. this change addresses this by removing the config_* and upsidedown/benchmark_* files which caused the problem. this does not remove support for these kvstores, just the build tag support. --- config/config_cznicb.go | 21 ----- config/config_leveldb.go | 21 ----- config/config_rocksdb.go | 21 ----- go.mod | 17 ++-- go.sum | 97 ++++++++++---------- index/upsidedown/benchmark_cznicb_test.go | 82 ----------------- index/upsidedown/benchmark_goleveldb_test.go | 76 --------------- index/upsidedown/benchmark_gorocksdb_test.go | 78 ---------------- index/upsidedown/benchmark_leveldb_test.go | 78 ---------------- 9 files changed, 60 insertions(+), 431 deletions(-) delete mode 100644 config/config_cznicb.go delete mode 100644 config/config_leveldb.go delete mode 100644 config/config_rocksdb.go delete mode 100644 index/upsidedown/benchmark_cznicb_test.go delete mode 100644 index/upsidedown/benchmark_goleveldb_test.go delete mode 100644 index/upsidedown/benchmark_gorocksdb_test.go delete mode 100644 index/upsidedown/benchmark_leveldb_test.go diff --git a/config/config_cznicb.go b/config/config_cznicb.go deleted file mode 100644 index 7fe0a770f..000000000 --- a/config/config_cznicb.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2015 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build cznicb full - -package config - -import ( - _ "github.com/blevesearch/blevex/cznicb" -) diff --git a/config/config_leveldb.go b/config/config_leveldb.go deleted file mode 100644 index 16ac8f413..000000000 --- a/config/config_leveldb.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2015 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build leveldb full - -package config - -import ( - _ "github.com/blevesearch/blevex/leveldb" -) diff --git a/config/config_rocksdb.go b/config/config_rocksdb.go deleted file mode 100644 index e9b2d0827..000000000 --- a/config/config_rocksdb.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2015 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build rocksdb full - -package config - -import ( - _ "github.com/blevesearch/blevex/rocksdb" -) diff --git a/go.mod b/go.mod index 8cee3123a..5733552b5 100644 --- a/go.mod +++ b/go.mod @@ -4,25 +4,28 @@ go 1.13 require ( github.com/RoaringBitmap/roaring v0.4.23 - github.com/blevesearch/bleve_index_api v0.0.0-20201109204916-3d41c3915248 + github.com/blevesearch/bleve_index_api v0.0.1 github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040 + github.com/blevesearch/cld2 v0.0.0-20200327141045-8b5f551d37f5 // indirect github.com/blevesearch/go-porterstemmer v1.0.3 - github.com/blevesearch/scorch_segment_api v0.0.0-20201109215555-85deb08a9c2d + github.com/blevesearch/scorch_segment_api v0.0.2 github.com/blevesearch/segment v0.9.0 github.com/blevesearch/snowballstem v0.9.0 - github.com/blevesearch/zapx/v11 v11.1.0 - github.com/blevesearch/zapx/v12 v12.1.0 - github.com/blevesearch/zapx/v13 v13.1.0 - github.com/blevesearch/zapx/v14 v14.1.0 - github.com/blevesearch/zapx/v15 v15.1.0 + github.com/blevesearch/zapx/v11 v11.1.2 + github.com/blevesearch/zapx/v12 v12.1.2 + github.com/blevesearch/zapx/v13 v13.1.2 + github.com/blevesearch/zapx/v14 v14.1.2 + github.com/blevesearch/zapx/v15 v15.1.2 github.com/couchbase/moss v0.1.0 github.com/couchbase/vellum v1.0.2 github.com/golang/protobuf v1.3.2 + github.com/ikawaha/kagome.ipadic v1.1.2 // indirect github.com/kljensen/snowball v0.6.0 github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563 github.com/spf13/cobra v0.0.5 github.com/steveyen/gtreap v0.1.0 github.com/syndtr/goleveldb v1.0.0 + github.com/tebeka/snowball v0.4.2 // indirect github.com/willf/bitset v1.1.10 go.etcd.io/bbolt v1.3.5 golang.org/x/text v0.3.0 diff --git a/go.sum b/go.sum index ce5eea393..c560aa56d 100644 --- a/go.sum +++ b/go.sum @@ -1,43 +1,47 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/RoaringBitmap/roaring v0.4.23 h1:gpyfd12QohbqhFO4NVDUdoPOCXsyahYRQhINmlHxKeo= github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= -github.com/RoaringBitmap/roaring v0.5.5 h1:naNqvO1mNnghk2UvcsqnzHDBn9DRbCIRy94GmDTRVTQ= -github.com/RoaringBitmap/roaring v0.5.5/go.mod h1:puNo5VdzwbaIQxSiDIwfXl4Hnc+fbovcX4IW/dSTtUk= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/blevesearch/bleve v1.0.12/go.mod h1:G0ErXWdIrUSYZLPoMpS9Z3saTnTsk4ebhPsVv/+0nxk= github.com/blevesearch/bleve_index_api v0.0.0-20201109204916-3d41c3915248 h1:3KzsHcOHdbPPc3MSxtqfpXxgchiAqiU0ov2VnHqm+Nc= github.com/blevesearch/bleve_index_api v0.0.0-20201109204916-3d41c3915248/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= +github.com/blevesearch/bleve_index_api v0.0.1 h1:T7r67wTig9XZ1AjyU7mKMyE8aGH/Gnoborq+MigtC24= +github.com/blevesearch/bleve_index_api v0.0.1/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= +github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040 h1:SjYVcfJVZoCfBlg+fkaq2eoZHTf5HaJfaTeTkOtyfHQ= github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040/go.mod h1:WH+MU2F4T0VmSdaPX+Wu5GYoZBrYWdOZWSjzvYcDmqQ= +github.com/blevesearch/cld2 v0.0.0-20200327141045-8b5f551d37f5 h1:/4ikScMMYMqsRFWJjCyzd3CNWB0lxvqDkqa5nEv6NMc= +github.com/blevesearch/cld2 v0.0.0-20200327141045-8b5f551d37f5/go.mod h1:PN0QNTLs9+j1bKy3d/GB/59wsNBFC4sWLWG3k69lWbc= github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo= github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M= github.com/blevesearch/mmap-go v1.0.2 h1:JtMHb+FgQCTTYIhtMvimw15dJwu1Y5lrZDMOFXVWPk0= github.com/blevesearch/mmap-go v1.0.2/go.mod h1:ol2qBqYaOUsGdm7aRMRrYGgPvnwLe6Y+7LMvAB5IbSA= -github.com/blevesearch/scorch_segment_api v0.0.0-20201109215555-85deb08a9c2d h1:24HCXKs9lFipAFIp1mA72sMqjw1lG0rR4o23ADkUPQk= -github.com/blevesearch/scorch_segment_api v0.0.0-20201109215555-85deb08a9c2d/go.mod h1:VF37IOJNFEiW0R5t2sJbGGylO1J2hkLOlbhY27n6T7Y= +github.com/blevesearch/scorch_segment_api v0.0.1 h1:VAlJoItfOd4dlBwxPeBRt6sd3F94j4o7pf/1MiUd5ek= +github.com/blevesearch/scorch_segment_api v0.0.1/go.mod h1:VF37IOJNFEiW0R5t2sJbGGylO1J2hkLOlbhY27n6T7Y= +github.com/blevesearch/scorch_segment_api v0.0.2 h1:IZuLbEWlETvUEC/jCHyRfa/tDP1gvZdwmYR492krw+s= +github.com/blevesearch/scorch_segment_api v0.0.2/go.mod h1:gEsepm5rSi7C/eHTNbV7UsjxH8OEODVWG8rBco5A4uo= github.com/blevesearch/segment v0.9.0 h1:5lG7yBCx98or7gK2cHMKPukPZ/31Kag7nONpoBt22Ac= github.com/blevesearch/segment v0.9.0/go.mod h1:9PfHYUdQCgHktBgvtUOF4x+pc4/l8rdH0u5spnW85UQ= github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s= github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs= -github.com/blevesearch/zap/v11 v11.0.12 h1:ZA+80yajko2tXr1kmbSoVRMCo0mFZAVJmoijjYsZuwc= -github.com/blevesearch/zap/v11 v11.0.12/go.mod h1:JLfFhc8DWP01zMG/6VwEY2eAnlJsTN1vDE4S0rC5Y78= -github.com/blevesearch/zap/v12 v12.0.12 h1:9eWaL9/2hcjy1VR3lrl/b+kWh5G7w/BkNYI07mWActw= -github.com/blevesearch/zap/v12 v12.0.12/go.mod h1:1HrB4hhPfI8u8x4SPYbluhb8xhflpPvvj8EcWImNnJY= -github.com/blevesearch/zap/v13 v13.0.4 h1:eoRvJmLeIQUs1mAF+fAFALg1dPHOI1e1KFuXL0I7us4= -github.com/blevesearch/zap/v13 v13.0.4/go.mod h1:YdB7UuG7TBWu/1dz9e2SaLp1RKfFfdJx+ulIK5HR1bA= -github.com/blevesearch/zap/v14 v14.0.3 h1:ccEv296u6DEUHFF9U4W2E/6/WkbuDrS9/1VJM34SCzA= -github.com/blevesearch/zap/v14 v14.0.3/go.mod h1:oObAhcDHw7p1ahiTCqhRkdxdl7UA8qpvX10pSgrTMHc= -github.com/blevesearch/zap/v15 v15.0.1 h1:jEism63eY+qdcvwXH0K8MiKhv5tb10T1k7SNx6fauCM= -github.com/blevesearch/zap/v15 v15.0.1/go.mod h1:ho0frqAex2ktT9cYFAxQpoQXsxb/KEfdjpx4s49rf/M= -github.com/blevesearch/zapx/v11 v11.1.0 h1:nawLAzWX6NNlW4tofiseMEYODurqmOIuRRxZ9LYs4q4= -github.com/blevesearch/zapx/v11 v11.1.0/go.mod h1:7mOK0QCn13lexQdbNi168i6zMPGsitUg1j/UUaIvHO0= -github.com/blevesearch/zapx/v12 v12.1.0 h1:GETlxxKR/VGu90ayfYdLGqCnZ9Rw991l4dCQu62pXZc= -github.com/blevesearch/zapx/v12 v12.1.0/go.mod h1:j2e+SnS//OuIFivU+GG7RltQ/OsOrCtuEuGc+r4GPvE= -github.com/blevesearch/zapx/v13 v13.1.0 h1:s0KmvcC9nWSZY5ix/f/5B0YLDgfPH+mM4q6myXtRWvs= -github.com/blevesearch/zapx/v13 v13.1.0/go.mod h1:lmWI+m3uCO9NEX4FkJEDyaRskFcHTaG778NfkcI3O/E= -github.com/blevesearch/zapx/v14 v14.1.0 h1:Fzp2MRhA33UulavOamWCcvrHaNB33Q0HofJJjxkeUw0= -github.com/blevesearch/zapx/v14 v14.1.0/go.mod h1:xxv3ClQ8oc4bPknqQf9Vg3H3bQkN3Oq6OqKYPqmh5K0= -github.com/blevesearch/zapx/v15 v15.1.0 h1:Lu0/N1JLm2dR3GSKzM2BNsnAqw+0zmY3X9SWOZgVjMw= -github.com/blevesearch/zapx/v15 v15.1.0/go.mod h1:aq1biCn7cpLDcuO8e6j3QY9vYohEMUiH8T7kaA7lV0g= +github.com/blevesearch/zapx/v11 v11.1.1 h1:9WF3jjBCZBu1nOE1P+HLtuqlCJmsThw9m00MenAwftU= +github.com/blevesearch/zapx/v11 v11.1.1/go.mod h1:wsCB97TPCmMWgu6yQJkTyvhJA1JH4ggeIBr74NyiVYY= +github.com/blevesearch/zapx/v11 v11.1.2 h1:1JIKsB+gTSk5yaCYTwWDO5VdFAJLo87b+J89BdsKQgo= +github.com/blevesearch/zapx/v11 v11.1.2/go.mod h1:lPgJGr4+3oOlIKfNJCtR9zGHlGHiyL7tZavrZ/EZ854= +github.com/blevesearch/zapx/v12 v12.1.1 h1:LVcN13qBklzMiixTQ5ikhCqDbT4ZrvdFewyMeKJzYuI= +github.com/blevesearch/zapx/v12 v12.1.1/go.mod h1:e0ManEuQFvgfVf9jTIjrJTenfdZ0rF+CB6ed7W1V/eA= +github.com/blevesearch/zapx/v12 v12.1.2 h1:WOv3dRaf7TVkhz2NdHHqh5Qz3VEINh3rtHiBuS0SQQY= +github.com/blevesearch/zapx/v12 v12.1.2/go.mod h1:Y/NrOTuEPyw94WN6xzT1UTRw5CIigkmh8XfuIRZPQFA= +github.com/blevesearch/zapx/v13 v13.1.1 h1:NABJRAWYYXqqkYdI6qJGVkMx+/QiE+DG/gO5tV7+zE4= +github.com/blevesearch/zapx/v13 v13.1.1/go.mod h1:fgYIS43zePtNO/tHQOGHLDShNjpWykafDzMXGDa9dlE= +github.com/blevesearch/zapx/v13 v13.1.2 h1:XK+qonJ4BFb0m1tF+o+GRWMKeIIvSSZx3Xek2qw4l2o= +github.com/blevesearch/zapx/v13 v13.1.2/go.mod h1:1iYam/9a+y9uxI1tAKoXam2GQ77s9F8suJ7JxUWJUZc= +github.com/blevesearch/zapx/v14 v14.1.1 h1:Zhn2o+beCpK8PSD6YAA3kGT4ISRjR/6CWhlwds2Wyak= +github.com/blevesearch/zapx/v14 v14.1.1/go.mod h1:GfeKEtJLK3lhmBVd7D/vsnFDb3vFzn7OGxbmT6V8l4U= +github.com/blevesearch/zapx/v14 v14.1.2 h1:CewEkmC9YuOnNvkWjlJLYRDZqW26NFsyWOeI9kK7aXo= +github.com/blevesearch/zapx/v14 v14.1.2/go.mod h1:LRCSghZsh6xYf2Esb1GfZOAalHYPCo+OM2jOSd1X0wc= +github.com/blevesearch/zapx/v15 v15.1.1 h1:nFqF46t5gYTQpL0CtuYQzGdDZ9LR0vR+6bETjGbnB6Y= +github.com/blevesearch/zapx/v15 v15.1.1/go.mod h1:e+i5129iSh04rZ9+r6AIuYLaqd7G+vXVD4ju2nZsV38= +github.com/blevesearch/zapx/v15 v15.1.2 h1:dzfmDjVNc9F/FqZoAwV+2BZfDjcsgN3LCM2iYpflmak= +github.com/blevesearch/zapx/v15 v15.1.2/go.mod h1:vKtW0oJfTlk7TrANO/AaVakgdPrdDj4lcCbJHT16s/4= 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= @@ -49,10 +53,13 @@ github.com/couchbase/vellum v1.0.2 h1:BrbP0NKiyDdndMPec8Jjhy0U47CZ0Lgx3xUC2r9rZq github.com/couchbase/vellum v1.0.2/go.mod h1:FcwrEivFpNi24R3jLOs3n+fs5RnuQnQqCLBJ1uAg1W4= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2 h1:Ujru1hufTHVb++eG6OuNDKMxZnGIvF6o/u8q/8h2+I4= github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= +github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31 h1:gclg6gY70GLy3PbkQ1AERPfmLMMagS60DKF78eWwLn8= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= @@ -60,10 +67,16 @@ github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99 h1:twflg0XRTjwKpxb/jFExr4HGq6on2dEOmnL6FV+fgPw= github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ikawaha/kagome.ipadic v1.1.2 h1:pFxZ1PpMpc6ZoBK712YN5cVK0u/ju2DZ+gRIOriJFFs= +github.com/ikawaha/kagome.ipadic v1.1.2/go.mod h1:DPSBbU0czaJhAb/5uKQZHMc9MTVRpDugJfX+HddPHHg= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/kljensen/snowball v0.6.0 h1:6DZLCcZeL0cLfodx+Md4/OLC6b/bfurWUOUGs1ydfOU= github.com/kljensen/snowball v0.6.0/go.mod h1:27N7E8fVU5H68RlUmnWwZCfxgt4POBJfENGMvNRhldw= @@ -71,13 +84,17 @@ github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czP 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/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= +github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM= github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/philhofer/fwd v1.0.0 h1:UbZqGr5Y38ApvM/V/jEljVxwocdweyH+vmYvRPBnbqQ= github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563 h1:dY6ETXrvDG7Sa4vE8ZQG4yqWg6UnOcbqTAahkV813vQ= github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= @@ -94,52 +111,38 @@ github.com/steveyen/gtreap v0.1.0 h1:CjhzTa274PyJLJuMZwIzCO1PfC00oRa8d1Kc78bFXJM github.com/steveyen/gtreap v0.1.0/go.mod h1:kl/5J7XbrOmlIbYIXdRHDDE5QxHqpk0cmkT7Z4dM9/Y= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= +github.com/tebeka/snowball v0.4.2 h1:ujvgLOr6IHbsvB2Vgz27IcxWqDrNu9/oPhhe74lN/Kc= +github.com/tebeka/snowball v0.4.2/go.mod h1:4IfL14h1lvwZcp1sfXuuc7/7yCsvVffTWxWxCLfFpYg= github.com/tinylib/msgp v1.1.0 h1:9fQd+ICuRIu/ue4vxJZu6/LzxN0HwMds2nq/0cFvxHU= github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/willf/bitset v1.1.10 h1:NotGKqX0KwQ72NUzqrjZq5ipPNDQex9lo3WpaS8L2sc= github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 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/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200928182047-19e03678916f/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/index/upsidedown/benchmark_cznicb_test.go b/index/upsidedown/benchmark_cznicb_test.go deleted file mode 100644 index 964f8ecdf..000000000 --- a/index/upsidedown/benchmark_cznicb_test.go +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2014 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build cznicb - -package upsidedown - -import ( - "testing" - - "github.com/blevesearch/bleve/index/store" - "github.com/blevesearch/blevex/cznicb" -) - -func CreateCznicB() (store.KVStore, error) { - return cznicb.StoreConstructor(nil) -} - -func DestroyCznicB() error { - return nil -} - -func BenchmarkCznicBIndexing1Workers(b *testing.B) { - CommonBenchmarkIndex(b, CreateCznicB, DestroyCznicB, 1) -} - -func BenchmarkCznicBIndexing2Workers(b *testing.B) { - CommonBenchmarkIndex(b, CreateCznicB, DestroyCznicB, 2) -} - -func BenchmarkCznicBIndexing4Workers(b *testing.B) { - CommonBenchmarkIndex(b, CreateCznicB, DestroyCznicB, 4) -} - -// batches - -func BenchmarkCznicBIndexing1Workers10Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, CreateCznicB, DestroyCznicB, 1, 10) -} - -func BenchmarkCznicBIndexing2Workers10Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, CreateCznicB, DestroyCznicB, 2, 10) -} - -func BenchmarkCznicBIndexing4Workers10Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, CreateCznicB, DestroyCznicB, 4, 10) -} - -func BenchmarkCznicBIndexing1Workers100Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, CreateCznicB, DestroyCznicB, 1, 100) -} - -func BenchmarkCznicBIndexing2Workers100Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, CreateCznicB, DestroyCznicB, 2, 100) -} - -func BenchmarkCznicBIndexing4Workers100Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, CreateCznicB, DestroyCznicB, 4, 100) -} - -func BenchmarkCznicBIndexing1Workers1000Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, CreateCznicB, DestroyCznicB, 1, 1000) -} - -func BenchmarkCznicBIndexing2Workers1000Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, CreateCznicB, DestroyCznicB, 2, 1000) -} - -func BenchmarkCznicBIndexing4Workers1000Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, CreateCznicB, DestroyCznicB, 4, 1000) -} diff --git a/index/upsidedown/benchmark_goleveldb_test.go b/index/upsidedown/benchmark_goleveldb_test.go deleted file mode 100644 index 485ba344d..000000000 --- a/index/upsidedown/benchmark_goleveldb_test.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2014 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package upsidedown - -import ( - "testing" - - "github.com/blevesearch/bleve/index/store/goleveldb" -) - -var goLevelDBTestOptions = map[string]interface{}{ - "create_if_missing": true, - "path": "test", -} - -func BenchmarkGoLevelDBIndexing1Workers(b *testing.B) { - CommonBenchmarkIndex(b, goleveldb.Name, goLevelDBTestOptions, DestroyTest, 1) -} - -func BenchmarkGoLevelDBIndexing2Workers(b *testing.B) { - CommonBenchmarkIndex(b, goleveldb.Name, goLevelDBTestOptions, DestroyTest, 2) -} - -func BenchmarkGoLevelDBIndexing4Workers(b *testing.B) { - CommonBenchmarkIndex(b, goleveldb.Name, goLevelDBTestOptions, DestroyTest, 4) -} - -// batches - -func BenchmarkGoLevelDBIndexing1Workers10Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, goleveldb.Name, goLevelDBTestOptions, DestroyTest, 1, 10) -} - -func BenchmarkGoLevelDBIndexing2Workers10Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, goleveldb.Name, goLevelDBTestOptions, DestroyTest, 2, 10) -} - -func BenchmarkGoLevelDBIndexing4Workers10Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, goleveldb.Name, goLevelDBTestOptions, DestroyTest, 4, 10) -} - -func BenchmarkGoLevelDBIndexing1Workers100Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, goleveldb.Name, goLevelDBTestOptions, DestroyTest, 1, 100) -} - -func BenchmarkGoLevelDBIndexing2Workers100Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, goleveldb.Name, goLevelDBTestOptions, DestroyTest, 2, 100) -} - -func BenchmarkGoLevelDBIndexing4Workers100Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, goleveldb.Name, goLevelDBTestOptions, DestroyTest, 4, 100) -} - -func BenchmarkGoLevelDBIndexing1Workers1000Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, goleveldb.Name, goLevelDBTestOptions, DestroyTest, 1, 1000) -} - -func BenchmarkGoLevelDBIndexing2Workers1000Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, goleveldb.Name, goLevelDBTestOptions, DestroyTest, 2, 1000) -} - -func BenchmarkGoLevelDBIndexing4Workers1000Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, goleveldb.Name, goLevelDBTestOptions, DestroyTest, 4, 1000) -} diff --git a/index/upsidedown/benchmark_gorocksdb_test.go b/index/upsidedown/benchmark_gorocksdb_test.go deleted file mode 100644 index a65e3cc26..000000000 --- a/index/upsidedown/benchmark_gorocksdb_test.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2014 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build rocksdb - -package upsidedown - -import ( - "testing" - - "github.com/blevesearch/blevex/rocksdb" -) - -var rocksdbTestOptions = map[string]interface{}{ - "path": "test", - "create_if_missing": true, -} - -func BenchmarkRocksDBIndexing1Workers(b *testing.B) { - CommonBenchmarkIndex(b, rocksdb.Name, rocksdbTestOptions, DestroyTest, 1) -} - -func BenchmarkRocksDBIndexing2Workers(b *testing.B) { - CommonBenchmarkIndex(b, rocksdb.Name, rocksdbTestOptions, DestroyTest, 2) -} - -func BenchmarkRocksDBIndexing4Workers(b *testing.B) { - CommonBenchmarkIndex(b, rocksdb.Name, rocksdbTestOptions, DestroyTest, 4) -} - -// batches - -func BenchmarkRocksDBIndexing1Workers10Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, rocksdb.Name, rocksdbTestOptions, DestroyTest, 1, 10) -} - -func BenchmarkRocksDBIndexing2Workers10Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, rocksdb.Name, rocksdbTestOptions, DestroyTest, 2, 10) -} - -func BenchmarkRocksDBIndexing4Workers10Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, rocksdb.Name, rocksdbTestOptions, DestroyTest, 4, 10) -} - -func BenchmarkRocksDBIndexing1Workers100Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, rocksdb.Name, rocksdbTestOptions, DestroyTest, 1, 100) -} - -func BenchmarkRocksDBIndexing2Workers100Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, rocksdb.Name, rocksdbTestOptions, DestroyTest, 2, 100) -} - -func BenchmarkRocksDBIndexing4Workers100Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, rocksdb.Name, rocksdbTestOptions, DestroyTest, 4, 100) -} - -func BenchmarkRocksDBIndexing1Workers1000Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, rocksdb.Name, rocksdbTestOptions, DestroyTest, 1, 1000) -} - -func BenchmarkRocksDBIndexing2Workers1000Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, rocksdb.Name, rocksdbTestOptions, DestroyTest, 2, 1000) -} - -func BenchmarkRocksDBIndexing4Workers1000Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, rocksdb.Name, rocksdbTestOptions, DestroyTest, 4, 1000) -} diff --git a/index/upsidedown/benchmark_leveldb_test.go b/index/upsidedown/benchmark_leveldb_test.go deleted file mode 100644 index 8854d6224..000000000 --- a/index/upsidedown/benchmark_leveldb_test.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2014 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build leveldb - -package upsidedown - -import ( - "testing" - - "github.com/blevesearch/blevex/leveldb" -) - -var leveldbTestOptions = map[string]interface{}{ - "path": "test", - "create_if_missing": true, -} - -func BenchmarkLevelDBIndexing1Workers(b *testing.B) { - CommonBenchmarkIndex(b, leveldb.Name, leveldbTestOptions, DestroyTest, 1) -} - -func BenchmarkLevelDBIndexing2Workers(b *testing.B) { - CommonBenchmarkIndex(b, leveldb.Name, leveldbTestOptions, DestroyTest, 2) -} - -func BenchmarkLevelDBIndexing4Workers(b *testing.B) { - CommonBenchmarkIndex(b, leveldb.Name, leveldbTestOptions, DestroyTest, 4) -} - -// batches - -func BenchmarkLevelDBIndexing1Workers10Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, leveldb.Name, leveldbTestOptions, DestroyTest, 1, 10) -} - -func BenchmarkLevelDBIndexing2Workers10Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, leveldb.Name, leveldbTestOptions, DestroyTest, 2, 10) -} - -func BenchmarkLevelDBIndexing4Workers10Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, leveldb.Name, leveldbTestOptions, DestroyTest, 4, 10) -} - -func BenchmarkLevelDBIndexing1Workers100Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, leveldb.Name, leveldbTestOptions, DestroyTest, 1, 100) -} - -func BenchmarkLevelDBIndexing2Workers100Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, leveldb.Name, leveldbTestOptions, DestroyTest, 2, 100) -} - -func BenchmarkLevelDBIndexing4Workers100Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, leveldb.Name, leveldbTestOptions, DestroyTest, 4, 100) -} - -func BenchmarkLevelDBIndexing1Workers1000Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, leveldb.Name, leveldbTestOptions, DestroyTest, 1, 1000) -} - -func BenchmarkLevelDBIndexing2Workers1000Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, leveldb.Name, leveldbTestOptions, DestroyTest, 2, 1000) -} - -func BenchmarkLevelDBIndexing4Workers1000Batch(b *testing.B) { - CommonBenchmarkIndexBatch(b, leveldb.Name, leveldbTestOptions, DestroyTest, 4, 1000) -} From 1460d320f0a9f20b8ad8397a0a541de816fe083d Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Mon, 30 Nov 2020 08:24:32 -0500 Subject: [PATCH 09/28] update to latest versions (#1506) also fixup some places we missed during refactor --- go.mod | 14 ++++++------ go.sum | 42 ++++++++++++---------------------- index/scorch/optimize.go | 2 +- index/scorch/snapshot_index.go | 2 +- 4 files changed, 23 insertions(+), 37 deletions(-) diff --git a/go.mod b/go.mod index 5733552b5..1fc0c73ab 100644 --- a/go.mod +++ b/go.mod @@ -4,18 +4,18 @@ go 1.13 require ( github.com/RoaringBitmap/roaring v0.4.23 - github.com/blevesearch/bleve_index_api v0.0.1 + github.com/blevesearch/bleve_index_api v0.0.2 github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040 github.com/blevesearch/cld2 v0.0.0-20200327141045-8b5f551d37f5 // indirect github.com/blevesearch/go-porterstemmer v1.0.3 - github.com/blevesearch/scorch_segment_api v0.0.2 + github.com/blevesearch/scorch_segment_api v0.0.3 github.com/blevesearch/segment v0.9.0 github.com/blevesearch/snowballstem v0.9.0 - github.com/blevesearch/zapx/v11 v11.1.2 - github.com/blevesearch/zapx/v12 v12.1.2 - github.com/blevesearch/zapx/v13 v13.1.2 - github.com/blevesearch/zapx/v14 v14.1.2 - github.com/blevesearch/zapx/v15 v15.1.2 + github.com/blevesearch/zapx/v11 v11.1.3 + github.com/blevesearch/zapx/v12 v12.1.3 + github.com/blevesearch/zapx/v13 v13.1.3 + github.com/blevesearch/zapx/v14 v14.1.3 + github.com/blevesearch/zapx/v15 v15.1.3 github.com/couchbase/moss v0.1.0 github.com/couchbase/vellum v1.0.2 github.com/golang/protobuf v1.3.2 diff --git a/go.sum b/go.sum index c560aa56d..c0d45e668 100644 --- a/go.sum +++ b/go.sum @@ -2,10 +2,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/RoaringBitmap/roaring v0.4.23 h1:gpyfd12QohbqhFO4NVDUdoPOCXsyahYRQhINmlHxKeo= github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/blevesearch/bleve_index_api v0.0.0-20201109204916-3d41c3915248 h1:3KzsHcOHdbPPc3MSxtqfpXxgchiAqiU0ov2VnHqm+Nc= -github.com/blevesearch/bleve_index_api v0.0.0-20201109204916-3d41c3915248/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= -github.com/blevesearch/bleve_index_api v0.0.1 h1:T7r67wTig9XZ1AjyU7mKMyE8aGH/Gnoborq+MigtC24= -github.com/blevesearch/bleve_index_api v0.0.1/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= +github.com/blevesearch/bleve_index_api v0.0.2 h1:M6EPUf354pMQw0J9NOyJaeIKNAlwpbSU+ofP6wHVC0w= +github.com/blevesearch/bleve_index_api v0.0.2/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040 h1:SjYVcfJVZoCfBlg+fkaq2eoZHTf5HaJfaTeTkOtyfHQ= github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040/go.mod h1:WH+MU2F4T0VmSdaPX+Wu5GYoZBrYWdOZWSjzvYcDmqQ= github.com/blevesearch/cld2 v0.0.0-20200327141045-8b5f551d37f5 h1:/4ikScMMYMqsRFWJjCyzd3CNWB0lxvqDkqa5nEv6NMc= @@ -14,34 +12,22 @@ github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+ github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M= github.com/blevesearch/mmap-go v1.0.2 h1:JtMHb+FgQCTTYIhtMvimw15dJwu1Y5lrZDMOFXVWPk0= github.com/blevesearch/mmap-go v1.0.2/go.mod h1:ol2qBqYaOUsGdm7aRMRrYGgPvnwLe6Y+7LMvAB5IbSA= -github.com/blevesearch/scorch_segment_api v0.0.1 h1:VAlJoItfOd4dlBwxPeBRt6sd3F94j4o7pf/1MiUd5ek= -github.com/blevesearch/scorch_segment_api v0.0.1/go.mod h1:VF37IOJNFEiW0R5t2sJbGGylO1J2hkLOlbhY27n6T7Y= -github.com/blevesearch/scorch_segment_api v0.0.2 h1:IZuLbEWlETvUEC/jCHyRfa/tDP1gvZdwmYR492krw+s= -github.com/blevesearch/scorch_segment_api v0.0.2/go.mod h1:gEsepm5rSi7C/eHTNbV7UsjxH8OEODVWG8rBco5A4uo= +github.com/blevesearch/scorch_segment_api v0.0.3 h1:DJ7aqcIr1JUT77B42uTGtCRw0vz1HxlvUfyv7CefR9I= +github.com/blevesearch/scorch_segment_api v0.0.3/go.mod h1:WpV76h6YHekU8CzseKfzJRoZfcVu+yWlwcEq+7N+Kp0= github.com/blevesearch/segment v0.9.0 h1:5lG7yBCx98or7gK2cHMKPukPZ/31Kag7nONpoBt22Ac= github.com/blevesearch/segment v0.9.0/go.mod h1:9PfHYUdQCgHktBgvtUOF4x+pc4/l8rdH0u5spnW85UQ= github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s= github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs= -github.com/blevesearch/zapx/v11 v11.1.1 h1:9WF3jjBCZBu1nOE1P+HLtuqlCJmsThw9m00MenAwftU= -github.com/blevesearch/zapx/v11 v11.1.1/go.mod h1:wsCB97TPCmMWgu6yQJkTyvhJA1JH4ggeIBr74NyiVYY= -github.com/blevesearch/zapx/v11 v11.1.2 h1:1JIKsB+gTSk5yaCYTwWDO5VdFAJLo87b+J89BdsKQgo= -github.com/blevesearch/zapx/v11 v11.1.2/go.mod h1:lPgJGr4+3oOlIKfNJCtR9zGHlGHiyL7tZavrZ/EZ854= -github.com/blevesearch/zapx/v12 v12.1.1 h1:LVcN13qBklzMiixTQ5ikhCqDbT4ZrvdFewyMeKJzYuI= -github.com/blevesearch/zapx/v12 v12.1.1/go.mod h1:e0ManEuQFvgfVf9jTIjrJTenfdZ0rF+CB6ed7W1V/eA= -github.com/blevesearch/zapx/v12 v12.1.2 h1:WOv3dRaf7TVkhz2NdHHqh5Qz3VEINh3rtHiBuS0SQQY= -github.com/blevesearch/zapx/v12 v12.1.2/go.mod h1:Y/NrOTuEPyw94WN6xzT1UTRw5CIigkmh8XfuIRZPQFA= -github.com/blevesearch/zapx/v13 v13.1.1 h1:NABJRAWYYXqqkYdI6qJGVkMx+/QiE+DG/gO5tV7+zE4= -github.com/blevesearch/zapx/v13 v13.1.1/go.mod h1:fgYIS43zePtNO/tHQOGHLDShNjpWykafDzMXGDa9dlE= -github.com/blevesearch/zapx/v13 v13.1.2 h1:XK+qonJ4BFb0m1tF+o+GRWMKeIIvSSZx3Xek2qw4l2o= -github.com/blevesearch/zapx/v13 v13.1.2/go.mod h1:1iYam/9a+y9uxI1tAKoXam2GQ77s9F8suJ7JxUWJUZc= -github.com/blevesearch/zapx/v14 v14.1.1 h1:Zhn2o+beCpK8PSD6YAA3kGT4ISRjR/6CWhlwds2Wyak= -github.com/blevesearch/zapx/v14 v14.1.1/go.mod h1:GfeKEtJLK3lhmBVd7D/vsnFDb3vFzn7OGxbmT6V8l4U= -github.com/blevesearch/zapx/v14 v14.1.2 h1:CewEkmC9YuOnNvkWjlJLYRDZqW26NFsyWOeI9kK7aXo= -github.com/blevesearch/zapx/v14 v14.1.2/go.mod h1:LRCSghZsh6xYf2Esb1GfZOAalHYPCo+OM2jOSd1X0wc= -github.com/blevesearch/zapx/v15 v15.1.1 h1:nFqF46t5gYTQpL0CtuYQzGdDZ9LR0vR+6bETjGbnB6Y= -github.com/blevesearch/zapx/v15 v15.1.1/go.mod h1:e+i5129iSh04rZ9+r6AIuYLaqd7G+vXVD4ju2nZsV38= -github.com/blevesearch/zapx/v15 v15.1.2 h1:dzfmDjVNc9F/FqZoAwV+2BZfDjcsgN3LCM2iYpflmak= -github.com/blevesearch/zapx/v15 v15.1.2/go.mod h1:vKtW0oJfTlk7TrANO/AaVakgdPrdDj4lcCbJHT16s/4= +github.com/blevesearch/zapx/v11 v11.1.3 h1:3pQN/ghHIZvF2sTZuAixWGfS2s/xFUh2HHg7XuGoAcA= +github.com/blevesearch/zapx/v11 v11.1.3/go.mod h1:F7a5ANvbZHt0D28ZCjo6ZT5E2HZdLXGnKd77TO6PfOs= +github.com/blevesearch/zapx/v12 v12.1.3 h1:9KYAqQURIIMVJ1+vHnq1snYvPPukX/LLJ+xpYj3bRG8= +github.com/blevesearch/zapx/v12 v12.1.3/go.mod h1:ykFX5dk1FfDh9qWRxtoRoFgh1VoT4syFSqKa31t3rGg= +github.com/blevesearch/zapx/v13 v13.1.3 h1:34nYfEz0v9BfDIoZPERX781fCEvQWR15agUdZRLpu3Y= +github.com/blevesearch/zapx/v13 v13.1.3/go.mod h1:coKC574yL3KQ0ciIBdVYtxufN+Ikh7z5HbPMO9yH18M= +github.com/blevesearch/zapx/v14 v14.1.3 h1:Rx4Bjni8JW1wfTw9VGw1NUbFyA5wl+x7OJBaaqp2ypE= +github.com/blevesearch/zapx/v14 v14.1.3/go.mod h1:4MIfa+zZsiL57ve1aYZZ6S+hihYjtApo6DCizjM/eoE= +github.com/blevesearch/zapx/v15 v15.1.3 h1:gUvMSGfnAlhdjtNszD8kaA7SNLoIB7Hb55uAuQJZEVQ= +github.com/blevesearch/zapx/v15 v15.1.3/go.mod h1:TRWvTUYjESzoCzjfDckPmjXHuTyTLt5uKBJEf4C/8G4= 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= diff --git a/index/scorch/optimize.go b/index/scorch/optimize.go index fa828969f..8575613b5 100644 --- a/index/scorch/optimize.go +++ b/index/scorch/optimize.go @@ -174,7 +174,7 @@ OUTER: var docNum1HitLastOk bool for _, tfr := range o.tfrs { - if _, ok := tfr.iterators[i].(*segment.EmptyPostingsIterator); ok { + if _, ok := tfr.iterators[i].(*emptyPostingsIterator); ok { // An empty postings iterator means the entire AND is empty. oTFR.iterators[i] = anEmptyPostingsIterator continue OUTER diff --git a/index/scorch/snapshot_index.go b/index/scorch/snapshot_index.go index 2d295732e..9e10c6ef7 100644 --- a/index/scorch/snapshot_index.go +++ b/index/scorch/snapshot_index.go @@ -284,7 +284,7 @@ func (i *IndexSnapshot) FieldDictFuzzy(field string, var prefixBeg, prefixEnd []byte if prefix != "" { prefixBeg = []byte(prefix) - prefixEnd = segment.IncrementBytes(prefixBeg) + prefixEnd = calculateExclusiveEndFromPrefix(prefixBeg) } return i.newIndexSnapshotFieldDict(field, func(i segment.TermDictionary) segment.DictionaryIterator { From cf6396d3aa5c9c21ae47df60ec9706b37f067325 Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Wed, 2 Dec 2020 11:23:50 -0500 Subject: [PATCH 10/28] move the plugin interface into scorch (#1507) * move the plugin interface into scorch * rename scorch Plugin to SegmentPlugin and related functions * update to make all analysis take place in func() (#1508) * update to make all analysis take place in func() by making analysis take place inside a func() a closure can be used to encapsulate all the index specific details. this allows the index API to not know about scorch vs upsidedown analysis structures * rewrite variable declaration for clarity also update comment, per review feedback * update to latest versions selects latest versions compatible with these changes --- go.mod | 14 +++---- go.sum | 28 ++++++------- index/scorch/builder.go | 8 ++-- index/scorch/persister.go | 2 +- index/scorch/scorch.go | 27 +++++-------- index/scorch/segment_plugin.go | 66 +++++++++++++++++++++++++------ index/upsidedown/analysis.go | 23 +++++++++-- index/upsidedown/analysis_test.go | 4 +- index/upsidedown/upsidedown.go | 28 +++++++------ 9 files changed, 126 insertions(+), 74 deletions(-) diff --git a/go.mod b/go.mod index 1fc0c73ab..8572d7688 100644 --- a/go.mod +++ b/go.mod @@ -4,18 +4,18 @@ go 1.13 require ( github.com/RoaringBitmap/roaring v0.4.23 - github.com/blevesearch/bleve_index_api v0.0.2 + github.com/blevesearch/bleve_index_api v0.0.3 github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040 github.com/blevesearch/cld2 v0.0.0-20200327141045-8b5f551d37f5 // indirect github.com/blevesearch/go-porterstemmer v1.0.3 - github.com/blevesearch/scorch_segment_api v0.0.3 + github.com/blevesearch/scorch_segment_api v0.0.5 github.com/blevesearch/segment v0.9.0 github.com/blevesearch/snowballstem v0.9.0 - github.com/blevesearch/zapx/v11 v11.1.3 - github.com/blevesearch/zapx/v12 v12.1.3 - github.com/blevesearch/zapx/v13 v13.1.3 - github.com/blevesearch/zapx/v14 v14.1.3 - github.com/blevesearch/zapx/v15 v15.1.3 + github.com/blevesearch/zapx/v11 v11.1.4 + github.com/blevesearch/zapx/v12 v12.1.4 + github.com/blevesearch/zapx/v13 v13.1.4 + github.com/blevesearch/zapx/v14 v14.1.4 + github.com/blevesearch/zapx/v15 v15.1.4 github.com/couchbase/moss v0.1.0 github.com/couchbase/vellum v1.0.2 github.com/golang/protobuf v1.3.2 diff --git a/go.sum b/go.sum index c0d45e668..cef95b67e 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/RoaringBitmap/roaring v0.4.23 h1:gpyfd12QohbqhFO4NVDUdoPOCXsyahYRQhINmlHxKeo= github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/blevesearch/bleve_index_api v0.0.2 h1:M6EPUf354pMQw0J9NOyJaeIKNAlwpbSU+ofP6wHVC0w= -github.com/blevesearch/bleve_index_api v0.0.2/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= +github.com/blevesearch/bleve_index_api v0.0.3 h1:DNaKT/0F9r2WQA0EQwVTJSE12lZv11J6od0IV5Zzbvg= +github.com/blevesearch/bleve_index_api v0.0.3/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040 h1:SjYVcfJVZoCfBlg+fkaq2eoZHTf5HaJfaTeTkOtyfHQ= github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040/go.mod h1:WH+MU2F4T0VmSdaPX+Wu5GYoZBrYWdOZWSjzvYcDmqQ= github.com/blevesearch/cld2 v0.0.0-20200327141045-8b5f551d37f5 h1:/4ikScMMYMqsRFWJjCyzd3CNWB0lxvqDkqa5nEv6NMc= @@ -12,22 +12,22 @@ github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+ github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M= github.com/blevesearch/mmap-go v1.0.2 h1:JtMHb+FgQCTTYIhtMvimw15dJwu1Y5lrZDMOFXVWPk0= github.com/blevesearch/mmap-go v1.0.2/go.mod h1:ol2qBqYaOUsGdm7aRMRrYGgPvnwLe6Y+7LMvAB5IbSA= -github.com/blevesearch/scorch_segment_api v0.0.3 h1:DJ7aqcIr1JUT77B42uTGtCRw0vz1HxlvUfyv7CefR9I= -github.com/blevesearch/scorch_segment_api v0.0.3/go.mod h1:WpV76h6YHekU8CzseKfzJRoZfcVu+yWlwcEq+7N+Kp0= +github.com/blevesearch/scorch_segment_api v0.0.5 h1:LBndHXXi79/8Omh3h0tFBPs1hSf3MgjB7azkt4vAxWg= +github.com/blevesearch/scorch_segment_api v0.0.5/go.mod h1:Ilxtn7p82x+1djbDr+XLXATdYuvVYDlECSip1l/3Roo= github.com/blevesearch/segment v0.9.0 h1:5lG7yBCx98or7gK2cHMKPukPZ/31Kag7nONpoBt22Ac= github.com/blevesearch/segment v0.9.0/go.mod h1:9PfHYUdQCgHktBgvtUOF4x+pc4/l8rdH0u5spnW85UQ= github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s= github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs= -github.com/blevesearch/zapx/v11 v11.1.3 h1:3pQN/ghHIZvF2sTZuAixWGfS2s/xFUh2HHg7XuGoAcA= -github.com/blevesearch/zapx/v11 v11.1.3/go.mod h1:F7a5ANvbZHt0D28ZCjo6ZT5E2HZdLXGnKd77TO6PfOs= -github.com/blevesearch/zapx/v12 v12.1.3 h1:9KYAqQURIIMVJ1+vHnq1snYvPPukX/LLJ+xpYj3bRG8= -github.com/blevesearch/zapx/v12 v12.1.3/go.mod h1:ykFX5dk1FfDh9qWRxtoRoFgh1VoT4syFSqKa31t3rGg= -github.com/blevesearch/zapx/v13 v13.1.3 h1:34nYfEz0v9BfDIoZPERX781fCEvQWR15agUdZRLpu3Y= -github.com/blevesearch/zapx/v13 v13.1.3/go.mod h1:coKC574yL3KQ0ciIBdVYtxufN+Ikh7z5HbPMO9yH18M= -github.com/blevesearch/zapx/v14 v14.1.3 h1:Rx4Bjni8JW1wfTw9VGw1NUbFyA5wl+x7OJBaaqp2ypE= -github.com/blevesearch/zapx/v14 v14.1.3/go.mod h1:4MIfa+zZsiL57ve1aYZZ6S+hihYjtApo6DCizjM/eoE= -github.com/blevesearch/zapx/v15 v15.1.3 h1:gUvMSGfnAlhdjtNszD8kaA7SNLoIB7Hb55uAuQJZEVQ= -github.com/blevesearch/zapx/v15 v15.1.3/go.mod h1:TRWvTUYjESzoCzjfDckPmjXHuTyTLt5uKBJEf4C/8G4= +github.com/blevesearch/zapx/v11 v11.1.4 h1:p4FhcBPDB/lhBctXGAB1r7AxMbg5uta5oRKoCuMtiRA= +github.com/blevesearch/zapx/v11 v11.1.4/go.mod h1:MTlzXennnLzspvhHYEbZupmr823icJiSj41042mcV6c= +github.com/blevesearch/zapx/v12 v12.1.4 h1:5zB6BmQYtIEEAXrY8iZh09rkpuTCTVOHXqwsF0/4Yxw= +github.com/blevesearch/zapx/v12 v12.1.4/go.mod h1:wM4SGTOyF8SUkv36C3NUy82oHAEF+nKhua31Z9IT2Bk= +github.com/blevesearch/zapx/v13 v13.1.4 h1:e7caDqGHzZEQwLoUYHzY4CXJSlEy2PsabaSup4W5GNI= +github.com/blevesearch/zapx/v13 v13.1.4/go.mod h1:tpvyPg3yhbColAlAcQQSDAi/4vKzQl46jOcUSA4RUag= +github.com/blevesearch/zapx/v14 v14.1.4 h1:jWnVstovnq81b38nP3Y0T0rTa+dWXjPSWJmnrtkZBxY= +github.com/blevesearch/zapx/v14 v14.1.4/go.mod h1:VCHYImrCnhiSC/4NOlM1W3k4G+hjD2VsDD3YzZbUImY= +github.com/blevesearch/zapx/v15 v15.1.4 h1:x2vZerNVhjilFxkG89+eIPX4hywVxwPPR8WDeX3DuXA= +github.com/blevesearch/zapx/v15 v15.1.4/go.mod h1:Q0iQzBh6k4FKqj7zqlIsTIrVBUkQD7HG2p+Qp6XjmKo= 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= diff --git a/index/scorch/builder.go b/index/scorch/builder.go index fbe05d4f7..455c53578 100644 --- a/index/scorch/builder.go +++ b/index/scorch/builder.go @@ -39,7 +39,7 @@ type Builder struct { mergeMax int batch *index.Batch internal map[string][]byte - segPlugin segment.Plugin + segPlugin SegmentPlugin } func NewBuilder(config map[string]interface{}) (*Builder, error) { @@ -134,14 +134,14 @@ func (o *Builder) maybeFlushBatchLOCKED(moreThan int) error { } func (o *Builder) executeBatchLOCKED(batch *index.Batch) (err error) { - analysisResults := make([]*index.AnalysisResult, 0, len(batch.IndexOps)) + analysisResults := make([]index.Document, 0, len(batch.IndexOps)) for _, doc := range batch.IndexOps { if doc != nil { // insert _id field doc.AddIDField() // perform analysis directly - analysisResult := analyze(doc) - analysisResults = append(analysisResults, analysisResult) + analyze(doc) + analysisResults = append(analysisResults, doc) } } diff --git a/index/scorch/persister.go b/index/scorch/persister.go index d50f46e8d..d58a4b8e7 100644 --- a/index/scorch/persister.go +++ b/index/scorch/persister.go @@ -429,7 +429,7 @@ func (s *Scorch) persistSnapshotMaybeMerge(snapshot *IndexSnapshot) ( } func prepareBoltSnapshot(snapshot *IndexSnapshot, tx *bolt.Tx, path string, - segPlugin segment.Plugin) ([]string, map[uint64]string, error) { + segPlugin SegmentPlugin) ([]string, map[uint64]string, error) { snapshotsBucket, err := tx.CreateBucketIfNotExists(boltSnapshotsBucket) if err != nil { return nil, nil, err diff --git a/index/scorch/scorch.go b/index/scorch/scorch.go index 909fb43e8..68988e7d1 100644 --- a/index/scorch/scorch.go +++ b/index/scorch/scorch.go @@ -73,7 +73,7 @@ type Scorch struct { forceMergeRequestCh chan *mergerCtrl - segPlugin segment.Plugin + segPlugin SegmentPlugin } type internalStats struct { @@ -311,7 +311,7 @@ func (s *Scorch) Batch(batch *index.Batch) (err error) { s.fireEvent(EventKindBatchIntroduction, time.Since(start)) }() - resultChan := make(chan *index.AnalysisResult, len(batch.IndexOps)) + resultChan := make(chan index.Document, len(batch.IndexOps)) var numUpdates uint64 var numDeletes uint64 @@ -333,18 +333,21 @@ func (s *Scorch) Batch(batch *index.Batch) (err error) { if numUpdates > 0 { go func() { - for _, doc := range batch.IndexOps { + for k := range batch.IndexOps { + doc := batch.IndexOps[k] if doc != nil { - aw := index.NewAnalysisWork(s, doc, resultChan) // put the work on the queue - s.analysisQueue.Queue(aw) + s.analysisQueue.Queue(func() { + analyze(doc) + resultChan <- doc + }) } } }() } // wait for analysis result - analysisResults := make([]*index.AnalysisResult, int(numUpdates)) + analysisResults := make([]index.Document, int(numUpdates)) var itemsDeQueued uint64 var totalAnalysisSize int for itemsDeQueued < numUpdates { @@ -564,15 +567,7 @@ func (s *Scorch) StatsMap() map[string]interface{} { return m } -func (s *Scorch) Analyze(d index.Document) *index.AnalysisResult { - return analyze(d) -} - -func analyze(d index.Document) *index.AnalysisResult { - rv := &index.AnalysisResult{ - Document: d, - } - +func analyze(d index.Document) { d.VisitFields(func(field index.Field) { if field.IsIndexed() { field.Analyze() @@ -585,8 +580,6 @@ func analyze(d index.Document) *index.AnalysisResult { } } }) - - return rv } func (s *Scorch) Advanced() (store.KVStore, error) { diff --git a/index/scorch/segment_plugin.go b/index/scorch/segment_plugin.go index c87e35a62..94b4cee40 100644 --- a/index/scorch/segment_plugin.go +++ b/index/scorch/segment_plugin.go @@ -16,6 +16,8 @@ package scorch import ( "fmt" + "github.com/RoaringBitmap/roaring" + index "github.com/blevesearch/bleve_index_api" segment "github.com/blevesearch/scorch_segment_api" @@ -26,25 +28,63 @@ import ( zapv15 "github.com/blevesearch/zapx/v15" ) -var supportedSegmentPlugins map[string]map[uint32]segment.Plugin -var defaultSegmentPlugin segment.Plugin +// SegmentPlugin represents the essential functions required by a package to plug in +// it's segment implementation +type SegmentPlugin interface { + + // Type is the name for this segment plugin + Type() string + + // Version is a numeric value identifying a specific version of this type. + // When incompatible changes are made to a particular type of plugin, the + // version must be incremented. + Version() uint32 + + // New takes a set of Documents and turns them into a new Segment + New(results []index.Document) (segment.Segment, uint64, error) + + // Open attempts to open the file at the specified path and + // return the corresponding Segment + Open(path string) (segment.Segment, error) + + // Merge takes a set of Segments, and creates a new segment on disk at + // the specified path. + // Drops is a set of bitmaps (one for each segment) indicating which + // documents can be dropped from the segments during the merge. + // If the closeCh channel is closed, Merge will cease doing work at + // the next opportunity, and return an error (closed). + // StatsReporter can optionally be provided, in which case progress + // made during the merge is reported while operation continues. + // Returns: + // A slice of new document numbers (one for each input segment), + // this allows the caller to know a particular document's new + // document number in the newly merged segment. + // The number of bytes written to the new segment file. + // An error, if any occurred. + Merge(segments []segment.Segment, drops []*roaring.Bitmap, path string, + closeCh chan struct{}, s segment.StatsReporter) ( + [][]uint64, uint64, error) +} + +var supportedSegmentPlugins map[string]map[uint32]SegmentPlugin +var defaultSegmentPlugin SegmentPlugin func init() { - ResetPlugins() - RegisterPlugin(zapv15.Plugin(), false) - RegisterPlugin(zapv14.Plugin(), false) - RegisterPlugin(zapv13.Plugin(), false) - RegisterPlugin(zapv12.Plugin(), false) - RegisterPlugin(zapv11.Plugin(), true) + ResetSegmentPlugins() + RegisterSegmentPlugin(&zapv15.ZapPlugin{}, false) + RegisterSegmentPlugin(&zapv14.ZapPlugin{}, false) + RegisterSegmentPlugin(&zapv13.ZapPlugin{}, false) + RegisterSegmentPlugin(&zapv12.ZapPlugin{}, false) + RegisterSegmentPlugin(&zapv11.ZapPlugin{}, true) } -func ResetPlugins() { - supportedSegmentPlugins = map[string]map[uint32]segment.Plugin{} +func ResetSegmentPlugins() { + supportedSegmentPlugins = map[string]map[uint32]SegmentPlugin{} } -func RegisterPlugin(plugin segment.Plugin, makeDefault bool) { +func RegisterSegmentPlugin(plugin SegmentPlugin, makeDefault bool) { if _, ok := supportedSegmentPlugins[plugin.Type()]; !ok { - supportedSegmentPlugins[plugin.Type()] = map[uint32]segment.Plugin{} + supportedSegmentPlugins[plugin.Type()] = map[uint32]SegmentPlugin{} } supportedSegmentPlugins[plugin.Type()][plugin.Version()] = plugin if makeDefault { @@ -67,7 +107,7 @@ func SupportedSegmentTypeVersions(typ string) (rv []uint32) { } func chooseSegmentPlugin(forcedSegmentType string, - forcedSegmentVersion uint32) (segment.Plugin, error) { + forcedSegmentVersion uint32) (SegmentPlugin, error) { if versions, ok := supportedSegmentPlugins[forcedSegmentType]; ok { if segPlugin, ok := versions[uint32(forcedSegmentVersion)]; ok { return segPlugin, nil diff --git a/index/upsidedown/analysis.go b/index/upsidedown/analysis.go index bec5dd930..2b6727e62 100644 --- a/index/upsidedown/analysis.go +++ b/index/upsidedown/analysis.go @@ -18,10 +18,25 @@ import ( index "github.com/blevesearch/bleve_index_api" ) -func (udc *UpsideDownCouch) Analyze(d index.Document) *index.AnalysisResult { - rv := &index.AnalysisResult{ +type IndexRow interface { + KeySize() int + KeyTo([]byte) (int, error) + Key() []byte + + ValueSize() int + ValueTo([]byte) (int, error) + Value() []byte +} + +type AnalysisResult struct { + DocID string + Rows []IndexRow +} + +func (udc *UpsideDownCouch) analyze(d index.Document) *AnalysisResult { + rv := &AnalysisResult{ DocID: d.ID(), - Rows: make([]index.IndexRow, 0, 100), + Rows: make([]IndexRow, 0, 100), } docIDBytes := []byte(d.ID()) @@ -88,7 +103,7 @@ func (udc *UpsideDownCouch) Analyze(d index.Document) *index.AnalysisResult { rowsCapNeeded += len(tokenFreqs) } - rv.Rows = append(make([]index.IndexRow, 0, rowsCapNeeded), rv.Rows...) + rv.Rows = append(make([]IndexRow, 0, rowsCapNeeded), rv.Rows...) backIndexTermsEntries := make([]*BackIndexTermsEntry, 0, len(fieldTermFreqs)) diff --git a/index/upsidedown/analysis_test.go b/index/upsidedown/analysis_test.go index 26b96a9c8..f90ecd95d 100644 --- a/index/upsidedown/analysis_test.go +++ b/index/upsidedown/analysis_test.go @@ -45,7 +45,7 @@ func TestAnalysisBug328(t *testing.T) { cf := document.NewCompositeFieldWithIndexingOptions("_all", true, []string{}, []string{}, document.IndexField|document.IncludeTermVectors) d.AddField(cf) - rv := idx.Analyze(d) + rv := idx.(*UpsideDownCouch).analyze(d) fieldIndexes := make(map[uint16]string) for _, row := range rv.Rows { if row, ok := row.(*FieldRow); ok { @@ -84,7 +84,7 @@ func BenchmarkAnalyze(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { - rv := idx.Analyze(d) + rv := idx.(*UpsideDownCouch).analyze(d) if len(rv.Rows) < 92 || len(rv.Rows) > 93 { b.Fatalf("expected 512-13 rows, got %d", len(rv.Rows)) } diff --git a/index/upsidedown/upsidedown.go b/index/upsidedown/upsidedown.go index 6d107b263..499203bf6 100644 --- a/index/upsidedown/upsidedown.go +++ b/index/upsidedown/upsidedown.go @@ -414,11 +414,13 @@ func (udc *UpsideDownCouch) Close() error { func (udc *UpsideDownCouch) Update(doc index.Document) (err error) { // do analysis before acquiring write lock analysisStart := time.Now() - resultChan := make(chan *index.AnalysisResult) - aw := index.NewAnalysisWork(udc, doc, resultChan) + resultChan := make(chan *AnalysisResult) // put the work on the queue - udc.analysisQueue.Queue(aw) + udc.analysisQueue.Queue(func() { + ar := udc.analyze(doc) + resultChan <- ar + }) // wait for the result result := <-resultChan @@ -454,7 +456,7 @@ func (udc *UpsideDownCouch) Update(doc index.Document) (err error) { } func (udc *UpsideDownCouch) UpdateWithAnalysis(doc index.Document, - result *index.AnalysisResult, backIndexRow *BackIndexRow) (err error) { + result *AnalysisResult, backIndexRow *BackIndexRow) (err error) { // start a writer for this update indexStart := time.Now() var kvwriter store.KVWriter @@ -500,7 +502,7 @@ func (udc *UpsideDownCouch) UpdateWithAnalysis(doc index.Document, return } -func (udc *UpsideDownCouch) mergeOldAndNew(backIndexRow *BackIndexRow, rows []index.IndexRow) (addRows []UpsideDownCouchRow, updateRows []UpsideDownCouchRow, deleteRows []UpsideDownCouchRow) { +func (udc *UpsideDownCouch) mergeOldAndNew(backIndexRow *BackIndexRow, rows []IndexRow) (addRows []UpsideDownCouchRow, updateRows []UpsideDownCouchRow, deleteRows []UpsideDownCouchRow) { addRows = make([]UpsideDownCouchRow, 0, len(rows)) if backIndexRow == nil { @@ -586,7 +588,7 @@ func (udc *UpsideDownCouch) mergeOldAndNew(backIndexRow *BackIndexRow, rows []in return addRows, updateRows, deleteRows } -func (udc *UpsideDownCouch) storeField(docID []byte, field index.Field, fieldIndex uint16, rows []index.IndexRow, backIndexStoredEntries []*BackIndexStoreEntry) ([]index.IndexRow, []*BackIndexStoreEntry) { +func (udc *UpsideDownCouch) storeField(docID []byte, field index.Field, fieldIndex uint16, rows []IndexRow, backIndexStoredEntries []*BackIndexStoreEntry) ([]IndexRow, []*BackIndexStoreEntry) { fieldType := field.EncodedFieldType() storedRow := NewStoredRow(docID, fieldIndex, field.ArrayPositions(), fieldType, field.Value()) @@ -596,7 +598,7 @@ func (udc *UpsideDownCouch) storeField(docID []byte, field index.Field, fieldInd return append(rows, storedRow), append(backIndexStoredEntries, &backIndexStoredEntry) } -func (udc *UpsideDownCouch) indexField(docID []byte, includeTermVectors bool, fieldIndex uint16, fieldLength int, tokenFreqs index.TokenFrequencies, rows []index.IndexRow, backIndexTermsEntries []*BackIndexTermsEntry) ([]index.IndexRow, []*BackIndexTermsEntry) { +func (udc *UpsideDownCouch) indexField(docID []byte, includeTermVectors bool, fieldIndex uint16, fieldLength int, tokenFreqs index.TokenFrequencies, rows []IndexRow, backIndexTermsEntries []*BackIndexTermsEntry) ([]IndexRow, []*BackIndexTermsEntry) { fieldNorm := float32(1.0 / math.Sqrt(float64(fieldLength))) termFreqRows := make([]TermFrequencyRow, len(tokenFreqs)) @@ -731,7 +733,7 @@ func frequencyFromTokenFreq(tf *index.TokenFreq) int { return tf.Frequency() } -func (udc *UpsideDownCouch) termVectorsFromTokenFreq(field uint16, tf *index.TokenFreq, rows []index.IndexRow) ([]*TermVector, []index.IndexRow) { +func (udc *UpsideDownCouch) termVectorsFromTokenFreq(field uint16, tf *index.TokenFreq, rows []IndexRow) ([]*TermVector, []IndexRow) { a := make([]TermVector, len(tf.Locations)) rv := make([]*TermVector, len(tf.Locations)) @@ -787,7 +789,7 @@ func (udc *UpsideDownCouch) Batch(batch *index.Batch) (err error) { } analysisStart := time.Now() - resultChan := make(chan *index.AnalysisResult, len(batch.IndexOps)) + resultChan := make(chan *AnalysisResult, len(batch.IndexOps)) var numUpdates uint64 var numPlainTextBytes uint64 @@ -803,9 +805,11 @@ func (udc *UpsideDownCouch) Batch(batch *index.Batch) (err error) { for k := range batch.IndexOps { doc := batch.IndexOps[k] if doc != nil { - aw := index.NewAnalysisWork(udc, doc, resultChan) // put the work on the queue - udc.analysisQueue.Queue(aw) + udc.analysisQueue.Queue(func() { + ar := udc.analyze(doc) + resultChan <- ar + }) } } }() @@ -846,7 +850,7 @@ func (udc *UpsideDownCouch) Batch(batch *index.Batch) (err error) { }() // wait for analysis result - newRowsMap := make(map[string][]index.IndexRow) + newRowsMap := make(map[string][]IndexRow) var itemsDeQueued uint64 for itemsDeQueued < numUpdates { result := <-resultChan From 9548dc5eaae16aecaad33b6f0f3c8a586471f5c6 Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Thu, 3 Dec 2020 12:58:48 -0500 Subject: [PATCH 11/28] update Advanced() method (#1509) * update Advanced() method at the top-level of bleve, Advanced no longer knows about K/V stores, instead it only returns reference to the internal index implementation. this will allow us to remove the Advanced() method from the internal index implementation. NOTE: users who previously needed to access the underlying K/V store, will still be able to do so, but must first type assert that the internal index impl is *UpsideDownCouch and if it is, they can use that Advanced() method directly * relocate store pkg inside upsidedown (#1510) * relocate store pkg inside upsidedown since kvstores are a concept unique to the upsidedown index implementation, the store folder should be relocated inside of that package * remove Advanced() method from scorch (#1511) * remove Advanced() method from scorch after the API is updated, scorch no longer requires this useless method to satisfy the interface * update to latest apis --- cmd/bleve/cmd/check.go | 2 +- cmd/bleve/cmd/dictionary.go | 2 +- cmd/bleve/cmd/dump.go | 2 +- cmd/bleve/cmd/dumpDoc.go | 2 +- cmd/bleve/cmd/dumpFields.go | 2 +- cmd/bleve/cmd/fields.go | 2 +- config.go | 2 +- config/config.go | 8 +++--- config_disk.go | 2 +- go.mod | 14 +++++----- go.sum | 28 +++++++++---------- http/debug.go | 2 +- index.go | 6 ++-- index/scorch/scorch.go | 5 ---- index/upsidedown/analysis_test.go | 2 +- index/upsidedown/benchmark_boltdb_test.go | 2 +- index/upsidedown/benchmark_gtreap_test.go | 2 +- index/upsidedown/benchmark_null_test.go | 2 +- index/upsidedown/dump_test.go | 2 +- index/upsidedown/field_dict_test.go | 2 +- index/upsidedown/reader_test.go | 2 +- .../{ => upsidedown}/store/boltdb/iterator.go | 0 index/{ => upsidedown}/store/boltdb/reader.go | 0 index/{ => upsidedown}/store/boltdb/stats.go | 0 index/{ => upsidedown}/store/boltdb/store.go | 0 .../store/boltdb/store_test.go | 2 +- index/{ => upsidedown}/store/boltdb/writer.go | 0 .../{ => upsidedown}/store/goleveldb/batch.go | 0 .../store/goleveldb/config.go | 0 .../store/goleveldb/iterator.go | 0 .../store/goleveldb/reader.go | 0 .../{ => upsidedown}/store/goleveldb/store.go | 0 .../store/goleveldb/store_test.go | 2 +- .../store/goleveldb/writer.go | 0 .../{ => upsidedown}/store/gtreap/iterator.go | 0 index/{ => upsidedown}/store/gtreap/reader.go | 0 index/{ => upsidedown}/store/gtreap/store.go | 0 .../store/gtreap/store_test.go | 2 +- index/{ => upsidedown}/store/gtreap/writer.go | 0 index/{ => upsidedown}/store/metrics/batch.go | 0 .../store/metrics/iterator.go | 0 .../store/metrics/metrics_test.go | 2 +- .../{ => upsidedown}/store/metrics/reader.go | 0 index/{ => upsidedown}/store/metrics/stats.go | 0 index/{ => upsidedown}/store/metrics/store.go | 0 .../store/metrics/store_test.go | 4 +-- index/{ => upsidedown}/store/metrics/util.go | 0 .../{ => upsidedown}/store/metrics/writer.go | 0 index/{ => upsidedown}/store/moss/batch.go | 0 index/{ => upsidedown}/store/moss/iterator.go | 0 index/{ => upsidedown}/store/moss/lower.go | 0 .../{ => upsidedown}/store/moss/lower_test.go | 2 +- index/{ => upsidedown}/store/moss/reader.go | 0 index/{ => upsidedown}/store/moss/stats.go | 0 index/{ => upsidedown}/store/moss/store.go | 0 .../{ => upsidedown}/store/moss/store_test.go | 2 +- index/{ => upsidedown}/store/moss/writer.go | 0 index/{ => upsidedown}/store/null/null.go | 0 .../{ => upsidedown}/store/null/null_test.go | 0 index/{ => upsidedown}/store/test/README.md | 0 index/{ => upsidedown}/store/test/bytes.go | 0 index/{ => upsidedown}/store/test/crud.go | 0 .../{ => upsidedown}/store/test/isolation.go | 0 index/{ => upsidedown}/store/test/iterator.go | 0 index/{ => upsidedown}/store/test/merge.go | 0 index/upsidedown/upsidedown_test.go | 4 +-- index_alias_impl.go | 9 +++--- index_alias_impl_test.go | 7 ++--- index_impl.go | 12 ++------ index_test.go | 4 +-- search/searcher/base_test.go | 2 +- search/searcher/search_docid_test.go | 2 +- search/searcher/search_geoboundingbox_test.go | 2 +- search/searcher/search_geopolygon_test.go | 2 +- search/searcher/search_term_test.go | 2 +- test/versus_test.go | 2 +- 76 files changed, 71 insertions(+), 86 deletions(-) rename index/{ => upsidedown}/store/boltdb/iterator.go (100%) rename index/{ => upsidedown}/store/boltdb/reader.go (100%) rename index/{ => upsidedown}/store/boltdb/stats.go (100%) rename index/{ => upsidedown}/store/boltdb/store.go (100%) rename index/{ => upsidedown}/store/boltdb/store_test.go (98%) rename index/{ => upsidedown}/store/boltdb/writer.go (100%) rename index/{ => upsidedown}/store/goleveldb/batch.go (100%) rename index/{ => upsidedown}/store/goleveldb/config.go (100%) rename index/{ => upsidedown}/store/goleveldb/iterator.go (100%) rename index/{ => upsidedown}/store/goleveldb/reader.go (100%) rename index/{ => upsidedown}/store/goleveldb/store.go (100%) rename index/{ => upsidedown}/store/goleveldb/store_test.go (97%) rename index/{ => upsidedown}/store/goleveldb/writer.go (100%) rename index/{ => upsidedown}/store/gtreap/iterator.go (100%) rename index/{ => upsidedown}/store/gtreap/reader.go (100%) rename index/{ => upsidedown}/store/gtreap/store.go (100%) rename index/{ => upsidedown}/store/gtreap/store_test.go (97%) rename index/{ => upsidedown}/store/gtreap/writer.go (100%) rename index/{ => upsidedown}/store/metrics/batch.go (100%) rename index/{ => upsidedown}/store/metrics/iterator.go (100%) rename index/{ => upsidedown}/store/metrics/metrics_test.go (98%) rename index/{ => upsidedown}/store/metrics/reader.go (100%) rename index/{ => upsidedown}/store/metrics/stats.go (100%) rename index/{ => upsidedown}/store/metrics/store.go (100%) rename index/{ => upsidedown}/store/metrics/store_test.go (94%) rename index/{ => upsidedown}/store/metrics/util.go (100%) rename index/{ => upsidedown}/store/metrics/writer.go (100%) rename index/{ => upsidedown}/store/moss/batch.go (100%) rename index/{ => upsidedown}/store/moss/iterator.go (100%) rename index/{ => upsidedown}/store/moss/lower.go (100%) rename index/{ => upsidedown}/store/moss/lower_test.go (97%) rename index/{ => upsidedown}/store/moss/reader.go (100%) rename index/{ => upsidedown}/store/moss/stats.go (100%) rename index/{ => upsidedown}/store/moss/store.go (100%) rename index/{ => upsidedown}/store/moss/store_test.go (97%) rename index/{ => upsidedown}/store/moss/writer.go (100%) rename index/{ => upsidedown}/store/null/null.go (100%) rename index/{ => upsidedown}/store/null/null_test.go (100%) rename index/{ => upsidedown}/store/test/README.md (100%) rename index/{ => upsidedown}/store/test/bytes.go (100%) rename index/{ => upsidedown}/store/test/crud.go (100%) rename index/{ => upsidedown}/store/test/isolation.go (100%) rename index/{ => upsidedown}/store/test/iterator.go (100%) rename index/{ => upsidedown}/store/test/merge.go (100%) diff --git a/cmd/bleve/cmd/check.go b/cmd/bleve/cmd/check.go index 370ece983..b1b799c2d 100644 --- a/cmd/bleve/cmd/check.go +++ b/cmd/bleve/cmd/check.go @@ -100,7 +100,7 @@ func checkField(index bleve.Index, fieldName string) (int, error) { func getDictionary(index bleve.Index, field string) (map[string]uint64, error) { rv := make(map[string]uint64) - i, _, err := index.Advanced() + i, err := index.Advanced() if err != nil { log.Fatal(err) } diff --git a/cmd/bleve/cmd/dictionary.go b/cmd/bleve/cmd/dictionary.go index 72a58238d..3f42d122a 100644 --- a/cmd/bleve/cmd/dictionary.go +++ b/cmd/bleve/cmd/dictionary.go @@ -29,7 +29,7 @@ var dictionaryCmd = &cobra.Command{ if len(args) < 2 { return fmt.Errorf("must specify field") } - i, _, err := idx.Advanced() + i, err := idx.Advanced() if err != nil { return fmt.Errorf("error getting index: %v", err) } diff --git a/cmd/bleve/cmd/dump.go b/cmd/bleve/cmd/dump.go index bd44fd672..1082b4a20 100644 --- a/cmd/bleve/cmd/dump.go +++ b/cmd/bleve/cmd/dump.go @@ -29,7 +29,7 @@ var dumpCmd = &cobra.Command{ Short: "dumps the contents of the index", Long: `The dump command will dump (possibly a section of) the index.`, RunE: func(cmd *cobra.Command, args []string) error { - i, _, err := idx.Advanced() + i, err := idx.Advanced() if err != nil { return fmt.Errorf("error getting index: %v", err) } diff --git a/cmd/bleve/cmd/dumpDoc.go b/cmd/bleve/cmd/dumpDoc.go index 368e1756a..5dbf52e59 100644 --- a/cmd/bleve/cmd/dumpDoc.go +++ b/cmd/bleve/cmd/dumpDoc.go @@ -31,7 +31,7 @@ var dumpDocCmd = &cobra.Command{ return fmt.Errorf("must specify docid") } - i, _, err := idx.Advanced() + i, err := idx.Advanced() if err != nil { return fmt.Errorf("error getting index: %v", err) } diff --git a/cmd/bleve/cmd/dumpFields.go b/cmd/bleve/cmd/dumpFields.go index 31fa00c80..d0b7a1d31 100644 --- a/cmd/bleve/cmd/dumpFields.go +++ b/cmd/bleve/cmd/dumpFields.go @@ -27,7 +27,7 @@ var dumpFieldsCmd = &cobra.Command{ Short: "dump only the field rows", Long: `The fields sub-command of dump will only dump the field rows.`, RunE: func(cmd *cobra.Command, args []string) error { - i, _, err := idx.Advanced() + i, err := idx.Advanced() if err != nil { return fmt.Errorf("error getting index: %v", err) } diff --git a/cmd/bleve/cmd/fields.go b/cmd/bleve/cmd/fields.go index 6ff40aff4..11b369f0c 100644 --- a/cmd/bleve/cmd/fields.go +++ b/cmd/bleve/cmd/fields.go @@ -26,7 +26,7 @@ var fieldsCmd = &cobra.Command{ Short: "lists the fields in this index", Long: `The fields command will list the fields used in this index.`, RunE: func(cmd *cobra.Command, args []string) error { - i, _, err := idx.Advanced() + i, err := idx.Advanced() if err != nil { return fmt.Errorf("error getting index: %v", err) } diff --git a/config.go b/config.go index 41cd2502c..43c551470 100644 --- a/config.go +++ b/config.go @@ -20,7 +20,7 @@ import ( "log" "time" - "github.com/blevesearch/bleve/index/store/gtreap" + "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" "github.com/blevesearch/bleve/index/upsidedown" "github.com/blevesearch/bleve/registry" "github.com/blevesearch/bleve/search/highlight/highlighter/html" diff --git a/config/config.go b/config/config.go index 5ed2d9c3f..f963fbcc7 100644 --- a/config/config.go +++ b/config/config.go @@ -105,10 +105,10 @@ import ( _ "github.com/blevesearch/bleve/analysis/lang/tr" // kv stores - _ "github.com/blevesearch/bleve/index/store/boltdb" - _ "github.com/blevesearch/bleve/index/store/goleveldb" - _ "github.com/blevesearch/bleve/index/store/gtreap" - _ "github.com/blevesearch/bleve/index/store/moss" + _ "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" + _ "github.com/blevesearch/bleve/index/upsidedown/store/goleveldb" + _ "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" + _ "github.com/blevesearch/bleve/index/upsidedown/store/moss" // index types _ "github.com/blevesearch/bleve/index/upsidedown" diff --git a/config_disk.go b/config_disk.go index d03bceb40..7db7d0cd3 100644 --- a/config_disk.go +++ b/config_disk.go @@ -16,7 +16,7 @@ package bleve -import "github.com/blevesearch/bleve/index/store/boltdb" +import "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" // in normal environments we configure boltdb as the default storage func initDisk() { diff --git a/go.mod b/go.mod index 8572d7688..f9adfa933 100644 --- a/go.mod +++ b/go.mod @@ -4,18 +4,18 @@ go 1.13 require ( github.com/RoaringBitmap/roaring v0.4.23 - github.com/blevesearch/bleve_index_api v0.0.3 + github.com/blevesearch/bleve_index_api v0.0.4 github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040 github.com/blevesearch/cld2 v0.0.0-20200327141045-8b5f551d37f5 // indirect github.com/blevesearch/go-porterstemmer v1.0.3 - github.com/blevesearch/scorch_segment_api v0.0.5 + github.com/blevesearch/scorch_segment_api v0.0.6 github.com/blevesearch/segment v0.9.0 github.com/blevesearch/snowballstem v0.9.0 - github.com/blevesearch/zapx/v11 v11.1.4 - github.com/blevesearch/zapx/v12 v12.1.4 - github.com/blevesearch/zapx/v13 v13.1.4 - github.com/blevesearch/zapx/v14 v14.1.4 - github.com/blevesearch/zapx/v15 v15.1.4 + github.com/blevesearch/zapx/v11 v11.1.5 + github.com/blevesearch/zapx/v12 v12.1.5 + github.com/blevesearch/zapx/v13 v13.1.5 + github.com/blevesearch/zapx/v14 v14.1.5 + github.com/blevesearch/zapx/v15 v15.1.5 github.com/couchbase/moss v0.1.0 github.com/couchbase/vellum v1.0.2 github.com/golang/protobuf v1.3.2 diff --git a/go.sum b/go.sum index cef95b67e..26319f401 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/RoaringBitmap/roaring v0.4.23 h1:gpyfd12QohbqhFO4NVDUdoPOCXsyahYRQhINmlHxKeo= github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/blevesearch/bleve_index_api v0.0.3 h1:DNaKT/0F9r2WQA0EQwVTJSE12lZv11J6od0IV5Zzbvg= -github.com/blevesearch/bleve_index_api v0.0.3/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= +github.com/blevesearch/bleve_index_api v0.0.4 h1:v+rdWIJ/wmVL81rW0G5cRdIO/Cjbd9NOsmuB0OIbaLs= +github.com/blevesearch/bleve_index_api v0.0.4/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040 h1:SjYVcfJVZoCfBlg+fkaq2eoZHTf5HaJfaTeTkOtyfHQ= github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040/go.mod h1:WH+MU2F4T0VmSdaPX+Wu5GYoZBrYWdOZWSjzvYcDmqQ= github.com/blevesearch/cld2 v0.0.0-20200327141045-8b5f551d37f5 h1:/4ikScMMYMqsRFWJjCyzd3CNWB0lxvqDkqa5nEv6NMc= @@ -12,22 +12,22 @@ github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+ github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M= github.com/blevesearch/mmap-go v1.0.2 h1:JtMHb+FgQCTTYIhtMvimw15dJwu1Y5lrZDMOFXVWPk0= github.com/blevesearch/mmap-go v1.0.2/go.mod h1:ol2qBqYaOUsGdm7aRMRrYGgPvnwLe6Y+7LMvAB5IbSA= -github.com/blevesearch/scorch_segment_api v0.0.5 h1:LBndHXXi79/8Omh3h0tFBPs1hSf3MgjB7azkt4vAxWg= -github.com/blevesearch/scorch_segment_api v0.0.5/go.mod h1:Ilxtn7p82x+1djbDr+XLXATdYuvVYDlECSip1l/3Roo= +github.com/blevesearch/scorch_segment_api v0.0.6 h1:AL1ZM8rykkd9GQEo4QVPicCyrZmDD1C0DLmKgT2klIQ= +github.com/blevesearch/scorch_segment_api v0.0.6/go.mod h1:65b3su9AXLFeAWQlYHb0qyyPzAzscNmWXMa6qQOMJPo= github.com/blevesearch/segment v0.9.0 h1:5lG7yBCx98or7gK2cHMKPukPZ/31Kag7nONpoBt22Ac= github.com/blevesearch/segment v0.9.0/go.mod h1:9PfHYUdQCgHktBgvtUOF4x+pc4/l8rdH0u5spnW85UQ= github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s= github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs= -github.com/blevesearch/zapx/v11 v11.1.4 h1:p4FhcBPDB/lhBctXGAB1r7AxMbg5uta5oRKoCuMtiRA= -github.com/blevesearch/zapx/v11 v11.1.4/go.mod h1:MTlzXennnLzspvhHYEbZupmr823icJiSj41042mcV6c= -github.com/blevesearch/zapx/v12 v12.1.4 h1:5zB6BmQYtIEEAXrY8iZh09rkpuTCTVOHXqwsF0/4Yxw= -github.com/blevesearch/zapx/v12 v12.1.4/go.mod h1:wM4SGTOyF8SUkv36C3NUy82oHAEF+nKhua31Z9IT2Bk= -github.com/blevesearch/zapx/v13 v13.1.4 h1:e7caDqGHzZEQwLoUYHzY4CXJSlEy2PsabaSup4W5GNI= -github.com/blevesearch/zapx/v13 v13.1.4/go.mod h1:tpvyPg3yhbColAlAcQQSDAi/4vKzQl46jOcUSA4RUag= -github.com/blevesearch/zapx/v14 v14.1.4 h1:jWnVstovnq81b38nP3Y0T0rTa+dWXjPSWJmnrtkZBxY= -github.com/blevesearch/zapx/v14 v14.1.4/go.mod h1:VCHYImrCnhiSC/4NOlM1W3k4G+hjD2VsDD3YzZbUImY= -github.com/blevesearch/zapx/v15 v15.1.4 h1:x2vZerNVhjilFxkG89+eIPX4hywVxwPPR8WDeX3DuXA= -github.com/blevesearch/zapx/v15 v15.1.4/go.mod h1:Q0iQzBh6k4FKqj7zqlIsTIrVBUkQD7HG2p+Qp6XjmKo= +github.com/blevesearch/zapx/v11 v11.1.5 h1:junThJcb8Zb9R06FXrSrbGv8w+q0JCeWiCUmBZCzoF0= +github.com/blevesearch/zapx/v11 v11.1.5/go.mod h1:t0iWZlu/G6tiOr2kS4yDQfomnErPOwe7MyTSNfmanZc= +github.com/blevesearch/zapx/v12 v12.1.5 h1:iGVqwKCEvN313f5wxVmgu3G53oIRlzgcStVYmIhzJyg= +github.com/blevesearch/zapx/v12 v12.1.5/go.mod h1:unFlOztl5e37f0shGV/c3O2cwzkQozgoSBwtKz7pYi8= +github.com/blevesearch/zapx/v13 v13.1.5 h1:py2pA1aZhYjmKMngJE13B7eB32zaLz5Ok5117KkIiWA= +github.com/blevesearch/zapx/v13 v13.1.5/go.mod h1:+9llGYb/i+2hl5Sh96AZsiCCfDjMde3zG+MUc8wTvGI= +github.com/blevesearch/zapx/v14 v14.1.5 h1:zDXCsgk0kMQ6oUS8DvNtUuqLvqPZ+5qQE3YBF+hl3lQ= +github.com/blevesearch/zapx/v14 v14.1.5/go.mod h1:SgHVOkbyz7GX53h4mv6jLRWwWW/lfvC+tW8Xz2CiXDw= +github.com/blevesearch/zapx/v15 v15.1.5 h1:YGOuePgbuCM3vS4etn2qQOOxGXr76KFbkO3pFsDELUo= +github.com/blevesearch/zapx/v15 v15.1.5/go.mod h1:0Oh7/luoaUujNBBf5tisBHDwJh0UQ/TFuVH0FUg5XlQ= 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= diff --git a/http/debug.go b/http/debug.go index 99997f4a8..0788cfdee 100644 --- a/http/debug.go +++ b/http/debug.go @@ -57,7 +57,7 @@ func (h *DebugDocumentHandler) ServeHTTP(w http.ResponseWriter, req *http.Reques docID = h.DocIDLookup(req) } - internalIndex, _, err := index.Advanced() + internalIndex, err := index.Advanced() if err != nil { showError(w, req, fmt.Sprintf("error getting index: %v", err), 500) return diff --git a/index.go b/index.go index 06d79f57f..9cc753ea6 100644 --- a/index.go +++ b/index.go @@ -21,7 +21,6 @@ import ( "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/size" index "github.com/blevesearch/bleve_index_api" - store "github.com/blevesearch/bleve_index_api/store" ) // A Batch groups together multiple Index and Delete @@ -245,9 +244,8 @@ type Index interface { // SetName lets you assign your own logical name to this index SetName(string) - // Advanced returns the indexer and data store, exposing lower level - // methods to enumerate records and access data. - Advanced() (index.Index, store.KVStore, error) + // Advanced returns the internal index implementation + Advanced() (index.Index, error) } // New index at the specified path, must not exist. diff --git a/index/scorch/scorch.go b/index/scorch/scorch.go index 68988e7d1..e719ed878 100644 --- a/index/scorch/scorch.go +++ b/index/scorch/scorch.go @@ -26,7 +26,6 @@ import ( "github.com/RoaringBitmap/roaring" "github.com/blevesearch/bleve/registry" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve_index_api/store" segment "github.com/blevesearch/scorch_segment_api" bolt "go.etcd.io/bbolt" ) @@ -582,10 +581,6 @@ func analyze(d index.Document) { }) } -func (s *Scorch) Advanced() (store.KVStore, error) { - return nil, nil -} - func (s *Scorch) AddEligibleForRemoval(epoch uint64) { s.rootLock.Lock() if s.root == nil || s.root.epoch != epoch { diff --git a/index/upsidedown/analysis_test.go b/index/upsidedown/analysis_test.go index f90ecd95d..cc3cc5454 100644 --- a/index/upsidedown/analysis_test.go +++ b/index/upsidedown/analysis_test.go @@ -20,7 +20,7 @@ import ( "github.com/blevesearch/bleve/analysis/analyzer/standard" "github.com/blevesearch/bleve/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/store/null" + "github.com/blevesearch/bleve/index/upsidedown/store/null" "github.com/blevesearch/bleve/registry" ) diff --git a/index/upsidedown/benchmark_boltdb_test.go b/index/upsidedown/benchmark_boltdb_test.go index c505aeea2..0f96a48a2 100644 --- a/index/upsidedown/benchmark_boltdb_test.go +++ b/index/upsidedown/benchmark_boltdb_test.go @@ -17,7 +17,7 @@ package upsidedown import ( "testing" - "github.com/blevesearch/bleve/index/store/boltdb" + "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" ) var boltTestConfig = map[string]interface{}{ diff --git a/index/upsidedown/benchmark_gtreap_test.go b/index/upsidedown/benchmark_gtreap_test.go index 501c42ad5..30b87e305 100644 --- a/index/upsidedown/benchmark_gtreap_test.go +++ b/index/upsidedown/benchmark_gtreap_test.go @@ -17,7 +17,7 @@ package upsidedown import ( "testing" - "github.com/blevesearch/bleve/index/store/gtreap" + "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" ) func BenchmarkGTreapIndexing1Workers(b *testing.B) { diff --git a/index/upsidedown/benchmark_null_test.go b/index/upsidedown/benchmark_null_test.go index fce4eea23..5f92e6e22 100644 --- a/index/upsidedown/benchmark_null_test.go +++ b/index/upsidedown/benchmark_null_test.go @@ -17,7 +17,7 @@ package upsidedown import ( "testing" - "github.com/blevesearch/bleve/index/store/null" + "github.com/blevesearch/bleve/index/upsidedown/store/null" ) func BenchmarkNullIndexing1Workers(b *testing.B) { diff --git a/index/upsidedown/dump_test.go b/index/upsidedown/dump_test.go index e18fe3944..b8b7ea406 100644 --- a/index/upsidedown/dump_test.go +++ b/index/upsidedown/dump_test.go @@ -19,7 +19,7 @@ import ( "time" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/store/boltdb" + "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" "github.com/blevesearch/bleve/document" ) diff --git a/index/upsidedown/field_dict_test.go b/index/upsidedown/field_dict_test.go index cd858f2f1..37ac0ea0c 100644 --- a/index/upsidedown/field_dict_test.go +++ b/index/upsidedown/field_dict_test.go @@ -20,7 +20,7 @@ import ( "github.com/blevesearch/bleve/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/store/boltdb" + "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" ) func TestIndexFieldDict(t *testing.T) { diff --git a/index/upsidedown/reader_test.go b/index/upsidedown/reader_test.go index 0e1c3c6f2..5dcf7df7d 100644 --- a/index/upsidedown/reader_test.go +++ b/index/upsidedown/reader_test.go @@ -20,7 +20,7 @@ import ( "github.com/blevesearch/bleve/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/store/boltdb" + "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" ) func TestIndexReader(t *testing.T) { diff --git a/index/store/boltdb/iterator.go b/index/upsidedown/store/boltdb/iterator.go similarity index 100% rename from index/store/boltdb/iterator.go rename to index/upsidedown/store/boltdb/iterator.go diff --git a/index/store/boltdb/reader.go b/index/upsidedown/store/boltdb/reader.go similarity index 100% rename from index/store/boltdb/reader.go rename to index/upsidedown/store/boltdb/reader.go diff --git a/index/store/boltdb/stats.go b/index/upsidedown/store/boltdb/stats.go similarity index 100% rename from index/store/boltdb/stats.go rename to index/upsidedown/store/boltdb/stats.go diff --git a/index/store/boltdb/store.go b/index/upsidedown/store/boltdb/store.go similarity index 100% rename from index/store/boltdb/store.go rename to index/upsidedown/store/boltdb/store.go diff --git a/index/store/boltdb/store_test.go b/index/upsidedown/store/boltdb/store_test.go similarity index 98% rename from index/store/boltdb/store_test.go rename to index/upsidedown/store/boltdb/store_test.go index b83bd8b41..6ca4383b1 100644 --- a/index/store/boltdb/store_test.go +++ b/index/upsidedown/store/boltdb/store_test.go @@ -19,7 +19,7 @@ import ( "testing" store "github.com/blevesearch/bleve_index_api/store" - "github.com/blevesearch/bleve/index/store/test" + "github.com/blevesearch/bleve/index/upsidedown/store/test" bolt "go.etcd.io/bbolt" ) diff --git a/index/store/boltdb/writer.go b/index/upsidedown/store/boltdb/writer.go similarity index 100% rename from index/store/boltdb/writer.go rename to index/upsidedown/store/boltdb/writer.go diff --git a/index/store/goleveldb/batch.go b/index/upsidedown/store/goleveldb/batch.go similarity index 100% rename from index/store/goleveldb/batch.go rename to index/upsidedown/store/goleveldb/batch.go diff --git a/index/store/goleveldb/config.go b/index/upsidedown/store/goleveldb/config.go similarity index 100% rename from index/store/goleveldb/config.go rename to index/upsidedown/store/goleveldb/config.go diff --git a/index/store/goleveldb/iterator.go b/index/upsidedown/store/goleveldb/iterator.go similarity index 100% rename from index/store/goleveldb/iterator.go rename to index/upsidedown/store/goleveldb/iterator.go diff --git a/index/store/goleveldb/reader.go b/index/upsidedown/store/goleveldb/reader.go similarity index 100% rename from index/store/goleveldb/reader.go rename to index/upsidedown/store/goleveldb/reader.go diff --git a/index/store/goleveldb/store.go b/index/upsidedown/store/goleveldb/store.go similarity index 100% rename from index/store/goleveldb/store.go rename to index/upsidedown/store/goleveldb/store.go diff --git a/index/store/goleveldb/store_test.go b/index/upsidedown/store/goleveldb/store_test.go similarity index 97% rename from index/store/goleveldb/store_test.go rename to index/upsidedown/store/goleveldb/store_test.go index 8bb0eb3a1..83b82de98 100644 --- a/index/store/goleveldb/store_test.go +++ b/index/upsidedown/store/goleveldb/store_test.go @@ -19,7 +19,7 @@ import ( "testing" store "github.com/blevesearch/bleve_index_api/store" - "github.com/blevesearch/bleve/index/store/test" + "github.com/blevesearch/bleve/index/upsidedown/store/test" ) func open(t *testing.T, mo store.MergeOperator) store.KVStore { diff --git a/index/store/goleveldb/writer.go b/index/upsidedown/store/goleveldb/writer.go similarity index 100% rename from index/store/goleveldb/writer.go rename to index/upsidedown/store/goleveldb/writer.go diff --git a/index/store/gtreap/iterator.go b/index/upsidedown/store/gtreap/iterator.go similarity index 100% rename from index/store/gtreap/iterator.go rename to index/upsidedown/store/gtreap/iterator.go diff --git a/index/store/gtreap/reader.go b/index/upsidedown/store/gtreap/reader.go similarity index 100% rename from index/store/gtreap/reader.go rename to index/upsidedown/store/gtreap/reader.go diff --git a/index/store/gtreap/store.go b/index/upsidedown/store/gtreap/store.go similarity index 100% rename from index/store/gtreap/store.go rename to index/upsidedown/store/gtreap/store.go diff --git a/index/store/gtreap/store_test.go b/index/upsidedown/store/gtreap/store_test.go similarity index 97% rename from index/store/gtreap/store_test.go rename to index/upsidedown/store/gtreap/store_test.go index b758972a8..85d4f5026 100644 --- a/index/store/gtreap/store_test.go +++ b/index/upsidedown/store/gtreap/store_test.go @@ -18,7 +18,7 @@ import ( "testing" store "github.com/blevesearch/bleve_index_api/store" - "github.com/blevesearch/bleve/index/store/test" + "github.com/blevesearch/bleve/index/upsidedown/store/test" ) func open(t *testing.T, mo store.MergeOperator) store.KVStore { diff --git a/index/store/gtreap/writer.go b/index/upsidedown/store/gtreap/writer.go similarity index 100% rename from index/store/gtreap/writer.go rename to index/upsidedown/store/gtreap/writer.go diff --git a/index/store/metrics/batch.go b/index/upsidedown/store/metrics/batch.go similarity index 100% rename from index/store/metrics/batch.go rename to index/upsidedown/store/metrics/batch.go diff --git a/index/store/metrics/iterator.go b/index/upsidedown/store/metrics/iterator.go similarity index 100% rename from index/store/metrics/iterator.go rename to index/upsidedown/store/metrics/iterator.go diff --git a/index/store/metrics/metrics_test.go b/index/upsidedown/store/metrics/metrics_test.go similarity index 98% rename from index/store/metrics/metrics_test.go rename to index/upsidedown/store/metrics/metrics_test.go index fb78514bf..6699c70d2 100644 --- a/index/store/metrics/metrics_test.go +++ b/index/upsidedown/store/metrics/metrics_test.go @@ -20,7 +20,7 @@ import ( "fmt" "testing" - "github.com/blevesearch/bleve/index/store/gtreap" + "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" ) func TestMetricsStore(t *testing.T) { diff --git a/index/store/metrics/reader.go b/index/upsidedown/store/metrics/reader.go similarity index 100% rename from index/store/metrics/reader.go rename to index/upsidedown/store/metrics/reader.go diff --git a/index/store/metrics/stats.go b/index/upsidedown/store/metrics/stats.go similarity index 100% rename from index/store/metrics/stats.go rename to index/upsidedown/store/metrics/stats.go diff --git a/index/store/metrics/store.go b/index/upsidedown/store/metrics/store.go similarity index 100% rename from index/store/metrics/store.go rename to index/upsidedown/store/metrics/store.go diff --git a/index/store/metrics/store_test.go b/index/upsidedown/store/metrics/store_test.go similarity index 94% rename from index/store/metrics/store_test.go rename to index/upsidedown/store/metrics/store_test.go index 473a27746..f655e06e3 100644 --- a/index/store/metrics/store_test.go +++ b/index/upsidedown/store/metrics/store_test.go @@ -18,8 +18,8 @@ import ( "testing" store "github.com/blevesearch/bleve_index_api/store" - "github.com/blevesearch/bleve/index/store/gtreap" - "github.com/blevesearch/bleve/index/store/test" + "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" + "github.com/blevesearch/bleve/index/upsidedown/store/test" ) func open(t *testing.T, mo store.MergeOperator) store.KVStore { diff --git a/index/store/metrics/util.go b/index/upsidedown/store/metrics/util.go similarity index 100% rename from index/store/metrics/util.go rename to index/upsidedown/store/metrics/util.go diff --git a/index/store/metrics/writer.go b/index/upsidedown/store/metrics/writer.go similarity index 100% rename from index/store/metrics/writer.go rename to index/upsidedown/store/metrics/writer.go diff --git a/index/store/moss/batch.go b/index/upsidedown/store/moss/batch.go similarity index 100% rename from index/store/moss/batch.go rename to index/upsidedown/store/moss/batch.go diff --git a/index/store/moss/iterator.go b/index/upsidedown/store/moss/iterator.go similarity index 100% rename from index/store/moss/iterator.go rename to index/upsidedown/store/moss/iterator.go diff --git a/index/store/moss/lower.go b/index/upsidedown/store/moss/lower.go similarity index 100% rename from index/store/moss/lower.go rename to index/upsidedown/store/moss/lower.go diff --git a/index/store/moss/lower_test.go b/index/upsidedown/store/moss/lower_test.go similarity index 97% rename from index/store/moss/lower_test.go rename to index/upsidedown/store/moss/lower_test.go index 4c3f45a4d..345eeaeeb 100644 --- a/index/store/moss/lower_test.go +++ b/index/upsidedown/store/moss/lower_test.go @@ -20,7 +20,7 @@ import ( "testing" store "github.com/blevesearch/bleve_index_api/store" - "github.com/blevesearch/bleve/index/store/test" + "github.com/blevesearch/bleve/index/upsidedown/store/test" ) func openWithLower(t *testing.T, mo store.MergeOperator) (string, store.KVStore) { diff --git a/index/store/moss/reader.go b/index/upsidedown/store/moss/reader.go similarity index 100% rename from index/store/moss/reader.go rename to index/upsidedown/store/moss/reader.go diff --git a/index/store/moss/stats.go b/index/upsidedown/store/moss/stats.go similarity index 100% rename from index/store/moss/stats.go rename to index/upsidedown/store/moss/stats.go diff --git a/index/store/moss/store.go b/index/upsidedown/store/moss/store.go similarity index 100% rename from index/store/moss/store.go rename to index/upsidedown/store/moss/store.go diff --git a/index/store/moss/store_test.go b/index/upsidedown/store/moss/store_test.go similarity index 97% rename from index/store/moss/store_test.go rename to index/upsidedown/store/moss/store_test.go index 3dd571a2f..9b0454654 100644 --- a/index/store/moss/store_test.go +++ b/index/upsidedown/store/moss/store_test.go @@ -18,7 +18,7 @@ import ( "testing" store "github.com/blevesearch/bleve_index_api/store" - "github.com/blevesearch/bleve/index/store/test" + "github.com/blevesearch/bleve/index/upsidedown/store/test" ) func open(t *testing.T, mo store.MergeOperator) store.KVStore { diff --git a/index/store/moss/writer.go b/index/upsidedown/store/moss/writer.go similarity index 100% rename from index/store/moss/writer.go rename to index/upsidedown/store/moss/writer.go diff --git a/index/store/null/null.go b/index/upsidedown/store/null/null.go similarity index 100% rename from index/store/null/null.go rename to index/upsidedown/store/null/null.go diff --git a/index/store/null/null_test.go b/index/upsidedown/store/null/null_test.go similarity index 100% rename from index/store/null/null_test.go rename to index/upsidedown/store/null/null_test.go diff --git a/index/store/test/README.md b/index/upsidedown/store/test/README.md similarity index 100% rename from index/store/test/README.md rename to index/upsidedown/store/test/README.md diff --git a/index/store/test/bytes.go b/index/upsidedown/store/test/bytes.go similarity index 100% rename from index/store/test/bytes.go rename to index/upsidedown/store/test/bytes.go diff --git a/index/store/test/crud.go b/index/upsidedown/store/test/crud.go similarity index 100% rename from index/store/test/crud.go rename to index/upsidedown/store/test/crud.go diff --git a/index/store/test/isolation.go b/index/upsidedown/store/test/isolation.go similarity index 100% rename from index/store/test/isolation.go rename to index/upsidedown/store/test/isolation.go diff --git a/index/store/test/iterator.go b/index/upsidedown/store/test/iterator.go similarity index 100% rename from index/store/test/iterator.go rename to index/upsidedown/store/test/iterator.go diff --git a/index/store/test/merge.go b/index/upsidedown/store/test/merge.go similarity index 100% rename from index/store/test/merge.go rename to index/upsidedown/store/test/merge.go diff --git a/index/upsidedown/upsidedown_test.go b/index/upsidedown/upsidedown_test.go index fa39d34fd..37c2ce646 100644 --- a/index/upsidedown/upsidedown_test.go +++ b/index/upsidedown/upsidedown_test.go @@ -29,8 +29,8 @@ import ( regexpTokenizer "github.com/blevesearch/bleve/analysis/tokenizer/regexp" "github.com/blevesearch/bleve/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/store/boltdb" - "github.com/blevesearch/bleve/index/store/null" + "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" + "github.com/blevesearch/bleve/index/upsidedown/store/null" "github.com/blevesearch/bleve/registry" ) diff --git a/index_alias_impl.go b/index_alias_impl.go index c178bb683..4092932fa 100644 --- a/index_alias_impl.go +++ b/index_alias_impl.go @@ -19,10 +19,9 @@ import ( "sync" "time" - index "github.com/blevesearch/bleve_index_api" - store "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" + index "github.com/blevesearch/bleve_index_api" ) type indexAliasImpl struct { @@ -368,17 +367,17 @@ func (i *indexAliasImpl) DeleteInternal(key []byte) error { return i.indexes[0].DeleteInternal(key) } -func (i *indexAliasImpl) Advanced() (index.Index, store.KVStore, error) { +func (i *indexAliasImpl) Advanced() (index.Index, error) { i.mutex.RLock() defer i.mutex.RUnlock() if !i.open { - return nil, nil, ErrorIndexClosed + return nil, ErrorIndexClosed } err := i.isAliasToSingleIndex() if err != nil { - return nil, nil, err + return nil, err } return i.indexes[0].Advanced() diff --git a/index_alias_impl_test.go b/index_alias_impl_test.go index 1c6c3b3a7..759d0715a 100644 --- a/index_alias_impl_test.go +++ b/index_alias_impl_test.go @@ -22,11 +22,10 @@ import ( "time" "github.com/blevesearch/bleve/document" - index "github.com/blevesearch/bleve_index_api" - store "github.com/blevesearch/bleve_index_api/store" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/numeric" "github.com/blevesearch/bleve/search" + index "github.com/blevesearch/bleve_index_api" ) func TestIndexAliasSingle(t *testing.T) { @@ -1334,8 +1333,8 @@ func (i *stubIndex) DeleteInternal(key []byte) error { return i.err } -func (i *stubIndex) Advanced() (index.Index, store.KVStore, error) { - return nil, nil, nil +func (i *stubIndex) Advanced() (index.Index, error) { + return nil, nil } func (i *stubIndex) NewBatch() *Batch { diff --git a/index_impl.go b/index_impl.go index ac375b873..ee6d25392 100644 --- a/index_impl.go +++ b/index_impl.go @@ -32,7 +32,6 @@ import ( "github.com/blevesearch/bleve/search/facet" "github.com/blevesearch/bleve/search/highlight" index "github.com/blevesearch/bleve_index_api" - store "github.com/blevesearch/bleve_index_api/store" ) type indexImpl struct { @@ -228,14 +227,9 @@ func openIndexUsing(path string, runtimeConfig map[string]interface{}) (rv *inde return rv, err } -// Advanced returns implementation internals -// necessary ONLY for advanced usage. -func (i *indexImpl) Advanced() (index.Index, store.KVStore, error) { - s, err := i.i.Advanced() - if err != nil { - return nil, nil, err - } - return i.i, s, nil +// Advanced returns internal index implementation +func (i *indexImpl) Advanced() (index.Index, error) { + return i.i, nil } // Mapping returns the IndexMapping in use by this diff --git a/index_test.go b/index_test.go index 2ee1df961..e98badd53 100644 --- a/index_test.go +++ b/index_test.go @@ -34,8 +34,8 @@ import ( "github.com/blevesearch/bleve/analysis/analyzer/keyword" "github.com/blevesearch/bleve/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/store/boltdb" - "github.com/blevesearch/bleve/index/store/null" + "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" + "github.com/blevesearch/bleve/index/upsidedown/store/null" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/query" diff --git a/search/searcher/base_test.go b/search/searcher/base_test.go index 450071c08..dea685356 100644 --- a/search/searcher/base_test.go +++ b/search/searcher/base_test.go @@ -23,7 +23,7 @@ import ( "github.com/blevesearch/bleve/document" index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/index/scorch" - "github.com/blevesearch/bleve/index/store/gtreap" + "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" "github.com/blevesearch/bleve/index/upsidedown" ) diff --git a/search/searcher/search_docid_test.go b/search/searcher/search_docid_test.go index e27b6e8cf..f0d42afdd 100644 --- a/search/searcher/search_docid_test.go +++ b/search/searcher/search_docid_test.go @@ -19,7 +19,7 @@ import ( "github.com/blevesearch/bleve/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/store/gtreap" + "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" "github.com/blevesearch/bleve/index/upsidedown" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_geoboundingbox_test.go b/search/searcher/search_geoboundingbox_test.go index 11a355a39..1fcdf7bce 100644 --- a/search/searcher/search_geoboundingbox_test.go +++ b/search/searcher/search_geoboundingbox_test.go @@ -21,7 +21,7 @@ import ( "github.com/blevesearch/bleve/document" "github.com/blevesearch/bleve/geo" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/store/gtreap" + "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" "github.com/blevesearch/bleve/index/upsidedown" "github.com/blevesearch/bleve/numeric" "github.com/blevesearch/bleve/search" diff --git a/search/searcher/search_geopolygon_test.go b/search/searcher/search_geopolygon_test.go index 0272b823d..cedd9a7ee 100644 --- a/search/searcher/search_geopolygon_test.go +++ b/search/searcher/search_geopolygon_test.go @@ -21,7 +21,7 @@ import ( "github.com/blevesearch/bleve/document" "github.com/blevesearch/bleve/geo" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/store/gtreap" + "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" "github.com/blevesearch/bleve/index/upsidedown" "github.com/blevesearch/bleve/search" ) diff --git a/search/searcher/search_term_test.go b/search/searcher/search_term_test.go index cb6040a30..6c57dbcad 100644 --- a/search/searcher/search_term_test.go +++ b/search/searcher/search_term_test.go @@ -20,7 +20,7 @@ import ( "github.com/blevesearch/bleve/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/store/gtreap" + "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" "github.com/blevesearch/bleve/index/upsidedown" "github.com/blevesearch/bleve/search" ) diff --git a/test/versus_test.go b/test/versus_test.go index 4257a9849..e2f38c4e2 100644 --- a/test/versus_test.go +++ b/test/versus_test.go @@ -29,7 +29,7 @@ import ( "github.com/blevesearch/bleve" "github.com/blevesearch/bleve/index/scorch" - "github.com/blevesearch/bleve/index/store/boltdb" + "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" "github.com/blevesearch/bleve/index/upsidedown" "github.com/blevesearch/bleve/mapping" "github.com/blevesearch/bleve/search" From 9c73f9d2901912e9c4ebd00683f574629c010a80 Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Fri, 4 Dec 2020 10:17:01 -0500 Subject: [PATCH 12/28] make upsidedown store API ext module (#1512) also, place shared kvstore test code in this module, not in upsidedown (avoids circular deps) --- go.mod | 1 + go.sum | 2 + index/upsidedown/dump.go | 2 +- index/upsidedown/field_dict.go | 2 +- index/upsidedown/index_reader.go | 2 +- index/upsidedown/reader.go | 2 +- index/upsidedown/stats.go | 2 +- index/upsidedown/store/boltdb/reader.go | 2 +- index/upsidedown/store/boltdb/store.go | 2 +- index/upsidedown/store/boltdb/store_test.go | 4 +- index/upsidedown/store/boltdb/writer.go | 2 +- index/upsidedown/store/goleveldb/batch.go | 2 +- index/upsidedown/store/goleveldb/reader.go | 2 +- index/upsidedown/store/goleveldb/store.go | 2 +- .../upsidedown/store/goleveldb/store_test.go | 4 +- index/upsidedown/store/goleveldb/writer.go | 2 +- index/upsidedown/store/gtreap/reader.go | 2 +- index/upsidedown/store/gtreap/store.go | 2 +- index/upsidedown/store/gtreap/store_test.go | 4 +- index/upsidedown/store/gtreap/writer.go | 2 +- index/upsidedown/store/metrics/batch.go | 2 +- index/upsidedown/store/metrics/iterator.go | 2 +- index/upsidedown/store/metrics/reader.go | 2 +- index/upsidedown/store/metrics/stats.go | 2 +- index/upsidedown/store/metrics/store.go | 2 +- index/upsidedown/store/metrics/store_test.go | 4 +- index/upsidedown/store/metrics/writer.go | 2 +- index/upsidedown/store/moss/batch.go | 2 +- index/upsidedown/store/moss/lower.go | 2 +- index/upsidedown/store/moss/lower_test.go | 4 +- index/upsidedown/store/moss/reader.go | 2 +- index/upsidedown/store/moss/stats.go | 2 +- index/upsidedown/store/moss/store.go | 2 +- index/upsidedown/store/moss/store_test.go | 4 +- index/upsidedown/store/moss/writer.go | 2 +- index/upsidedown/store/null/null.go | 2 +- index/upsidedown/store/null/null_test.go | 2 +- index/upsidedown/store/test/README.md | 11 - index/upsidedown/store/test/bytes.go | 276 ----------- index/upsidedown/store/test/crud.go | 112 ----- index/upsidedown/store/test/isolation.go | 191 -------- index/upsidedown/store/test/iterator.go | 438 ------------------ index/upsidedown/store/test/merge.go | 122 ----- index/upsidedown/upsidedown.go | 2 +- registry/store.go | 2 +- 45 files changed, 46 insertions(+), 1193 deletions(-) delete mode 100644 index/upsidedown/store/test/README.md delete mode 100644 index/upsidedown/store/test/bytes.go delete mode 100644 index/upsidedown/store/test/crud.go delete mode 100644 index/upsidedown/store/test/isolation.go delete mode 100644 index/upsidedown/store/test/iterator.go delete mode 100644 index/upsidedown/store/test/merge.go diff --git a/go.mod b/go.mod index f9adfa933..78d75a613 100644 --- a/go.mod +++ b/go.mod @@ -11,6 +11,7 @@ require ( github.com/blevesearch/scorch_segment_api v0.0.6 github.com/blevesearch/segment v0.9.0 github.com/blevesearch/snowballstem v0.9.0 + github.com/blevesearch/upsidedown_store_api v0.0.1 github.com/blevesearch/zapx/v11 v11.1.5 github.com/blevesearch/zapx/v12 v12.1.5 github.com/blevesearch/zapx/v13 v13.1.5 diff --git a/go.sum b/go.sum index 26319f401..3e3293b68 100644 --- a/go.sum +++ b/go.sum @@ -18,6 +18,8 @@ github.com/blevesearch/segment v0.9.0 h1:5lG7yBCx98or7gK2cHMKPukPZ/31Kag7nONpoBt github.com/blevesearch/segment v0.9.0/go.mod h1:9PfHYUdQCgHktBgvtUOF4x+pc4/l8rdH0u5spnW85UQ= github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s= github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs= +github.com/blevesearch/upsidedown_store_api v0.0.1 h1:cf3YQ6c3jvZ/gvHL6k71cshDG+nYTgL5PTWFqYXA3bg= +github.com/blevesearch/upsidedown_store_api v0.0.1/go.mod h1:jRZGTYWNqHXvOOjvT0WXHYO5Yin7U/PmTX1nevIY8yo= github.com/blevesearch/zapx/v11 v11.1.5 h1:junThJcb8Zb9R06FXrSrbGv8w+q0JCeWiCUmBZCzoF0= github.com/blevesearch/zapx/v11 v11.1.5/go.mod h1:t0iWZlu/G6tiOr2kS4yDQfomnErPOwe7MyTSNfmanZc= github.com/blevesearch/zapx/v12 v12.1.5 h1:iGVqwKCEvN313f5wxVmgu3G53oIRlzgcStVYmIhzJyg= diff --git a/index/upsidedown/dump.go b/index/upsidedown/dump.go index 66505ff56..64ebb1b26 100644 --- a/index/upsidedown/dump.go +++ b/index/upsidedown/dump.go @@ -18,7 +18,7 @@ import ( "bytes" "sort" - "github.com/blevesearch/bleve_index_api/store" + "github.com/blevesearch/upsidedown_store_api" ) // the functions in this file are only intended to be used by diff --git a/index/upsidedown/field_dict.go b/index/upsidedown/field_dict.go index dc848afde..c4be57740 100644 --- a/index/upsidedown/field_dict.go +++ b/index/upsidedown/field_dict.go @@ -18,7 +18,7 @@ import ( "fmt" index "github.com/blevesearch/bleve_index_api" - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" ) type UpsideDownCouchFieldDict struct { diff --git a/index/upsidedown/index_reader.go b/index/upsidedown/index_reader.go index 6ac7fc932..23ad24207 100644 --- a/index/upsidedown/index_reader.go +++ b/index/upsidedown/index_reader.go @@ -19,7 +19,7 @@ import ( "github.com/blevesearch/bleve/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve_index_api/store" + "github.com/blevesearch/upsidedown_store_api" ) var reflectStaticSizeIndexReader int diff --git a/index/upsidedown/reader.go b/index/upsidedown/reader.go index 05bc769f5..0d2d11028 100644 --- a/index/upsidedown/reader.go +++ b/index/upsidedown/reader.go @@ -21,7 +21,7 @@ import ( "sync/atomic" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve_index_api/store" + "github.com/blevesearch/upsidedown_store_api" "github.com/blevesearch/bleve/size" ) diff --git a/index/upsidedown/stats.go b/index/upsidedown/stats.go index db9cd1cab..c1b4ddc01 100644 --- a/index/upsidedown/stats.go +++ b/index/upsidedown/stats.go @@ -18,7 +18,7 @@ import ( "encoding/json" "sync/atomic" - "github.com/blevesearch/bleve_index_api/store" + "github.com/blevesearch/upsidedown_store_api" ) type indexStat struct { diff --git a/index/upsidedown/store/boltdb/reader.go b/index/upsidedown/store/boltdb/reader.go index de6b5159a..79513f600 100644 --- a/index/upsidedown/store/boltdb/reader.go +++ b/index/upsidedown/store/boltdb/reader.go @@ -15,7 +15,7 @@ package boltdb import ( - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" bolt "go.etcd.io/bbolt" ) diff --git a/index/upsidedown/store/boltdb/store.go b/index/upsidedown/store/boltdb/store.go index b93fc3382..5bfbb6db8 100644 --- a/index/upsidedown/store/boltdb/store.go +++ b/index/upsidedown/store/boltdb/store.go @@ -28,7 +28,7 @@ import ( "fmt" "os" - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" "github.com/blevesearch/bleve/registry" bolt "go.etcd.io/bbolt" ) diff --git a/index/upsidedown/store/boltdb/store_test.go b/index/upsidedown/store/boltdb/store_test.go index 6ca4383b1..6f2b0e78a 100644 --- a/index/upsidedown/store/boltdb/store_test.go +++ b/index/upsidedown/store/boltdb/store_test.go @@ -18,8 +18,8 @@ import ( "os" "testing" - store "github.com/blevesearch/bleve_index_api/store" - "github.com/blevesearch/bleve/index/upsidedown/store/test" + store "github.com/blevesearch/upsidedown_store_api" + "github.com/blevesearch/upsidedown_store_api/test" bolt "go.etcd.io/bbolt" ) diff --git a/index/upsidedown/store/boltdb/writer.go b/index/upsidedown/store/boltdb/writer.go index 6044ca06b..c25583cab 100644 --- a/index/upsidedown/store/boltdb/writer.go +++ b/index/upsidedown/store/boltdb/writer.go @@ -17,7 +17,7 @@ package boltdb import ( "fmt" - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" ) type Writer struct { diff --git a/index/upsidedown/store/goleveldb/batch.go b/index/upsidedown/store/goleveldb/batch.go index a74c70a2f..7a58bb83b 100644 --- a/index/upsidedown/store/goleveldb/batch.go +++ b/index/upsidedown/store/goleveldb/batch.go @@ -15,7 +15,7 @@ package goleveldb import ( - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" "github.com/syndtr/goleveldb/leveldb" ) diff --git a/index/upsidedown/store/goleveldb/reader.go b/index/upsidedown/store/goleveldb/reader.go index 20b7ec8ca..584109269 100644 --- a/index/upsidedown/store/goleveldb/reader.go +++ b/index/upsidedown/store/goleveldb/reader.go @@ -15,7 +15,7 @@ package goleveldb import ( - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/util" ) diff --git a/index/upsidedown/store/goleveldb/store.go b/index/upsidedown/store/goleveldb/store.go index aad05a51b..de41c73ad 100644 --- a/index/upsidedown/store/goleveldb/store.go +++ b/index/upsidedown/store/goleveldb/store.go @@ -19,7 +19,7 @@ import ( "fmt" "os" - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" "github.com/blevesearch/bleve/registry" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/opt" diff --git a/index/upsidedown/store/goleveldb/store_test.go b/index/upsidedown/store/goleveldb/store_test.go index 83b82de98..c9e5d4db3 100644 --- a/index/upsidedown/store/goleveldb/store_test.go +++ b/index/upsidedown/store/goleveldb/store_test.go @@ -18,8 +18,8 @@ import ( "os" "testing" - store "github.com/blevesearch/bleve_index_api/store" - "github.com/blevesearch/bleve/index/upsidedown/store/test" + store "github.com/blevesearch/upsidedown_store_api" + "github.com/blevesearch/upsidedown_store_api/test" ) func open(t *testing.T, mo store.MergeOperator) store.KVStore { diff --git a/index/upsidedown/store/goleveldb/writer.go b/index/upsidedown/store/goleveldb/writer.go index 8efaeaf15..4746c94fe 100644 --- a/index/upsidedown/store/goleveldb/writer.go +++ b/index/upsidedown/store/goleveldb/writer.go @@ -17,7 +17,7 @@ package goleveldb import ( "fmt" - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" "github.com/syndtr/goleveldb/leveldb" ) diff --git a/index/upsidedown/store/gtreap/reader.go b/index/upsidedown/store/gtreap/reader.go index 6ab5be4c5..34df81302 100644 --- a/index/upsidedown/store/gtreap/reader.go +++ b/index/upsidedown/store/gtreap/reader.go @@ -18,7 +18,7 @@ package gtreap import ( - "github.com/blevesearch/bleve_index_api/store" + "github.com/blevesearch/upsidedown_store_api" "github.com/steveyen/gtreap" ) diff --git a/index/upsidedown/store/gtreap/store.go b/index/upsidedown/store/gtreap/store.go index 8d3c695b7..6f186257d 100644 --- a/index/upsidedown/store/gtreap/store.go +++ b/index/upsidedown/store/gtreap/store.go @@ -24,7 +24,7 @@ import ( "os" "sync" - "github.com/blevesearch/bleve_index_api/store" + "github.com/blevesearch/upsidedown_store_api" "github.com/blevesearch/bleve/registry" "github.com/steveyen/gtreap" ) diff --git a/index/upsidedown/store/gtreap/store_test.go b/index/upsidedown/store/gtreap/store_test.go index 85d4f5026..2fc3aa87f 100644 --- a/index/upsidedown/store/gtreap/store_test.go +++ b/index/upsidedown/store/gtreap/store_test.go @@ -17,8 +17,8 @@ package gtreap import ( "testing" - store "github.com/blevesearch/bleve_index_api/store" - "github.com/blevesearch/bleve/index/upsidedown/store/test" + store "github.com/blevesearch/upsidedown_store_api" + "github.com/blevesearch/upsidedown_store_api/test" ) func open(t *testing.T, mo store.MergeOperator) store.KVStore { diff --git a/index/upsidedown/store/gtreap/writer.go b/index/upsidedown/store/gtreap/writer.go index 23c182d9e..80aa15b19 100644 --- a/index/upsidedown/store/gtreap/writer.go +++ b/index/upsidedown/store/gtreap/writer.go @@ -21,7 +21,7 @@ import ( "fmt" "math/rand" - "github.com/blevesearch/bleve_index_api/store" + "github.com/blevesearch/upsidedown_store_api" ) type Writer struct { diff --git a/index/upsidedown/store/metrics/batch.go b/index/upsidedown/store/metrics/batch.go index 4f0c308de..8293509d6 100644 --- a/index/upsidedown/store/metrics/batch.go +++ b/index/upsidedown/store/metrics/batch.go @@ -14,7 +14,7 @@ package metrics -import store "github.com/blevesearch/bleve_index_api/store" +import store "github.com/blevesearch/upsidedown_store_api" type Batch struct { s *Store diff --git a/index/upsidedown/store/metrics/iterator.go b/index/upsidedown/store/metrics/iterator.go index d7d637ff4..c55d2c3d4 100644 --- a/index/upsidedown/store/metrics/iterator.go +++ b/index/upsidedown/store/metrics/iterator.go @@ -14,7 +14,7 @@ package metrics -import store "github.com/blevesearch/bleve_index_api/store" +import store "github.com/blevesearch/upsidedown_store_api" type Iterator struct { s *Store diff --git a/index/upsidedown/store/metrics/reader.go b/index/upsidedown/store/metrics/reader.go index fa4613e93..ad1c25a5d 100644 --- a/index/upsidedown/store/metrics/reader.go +++ b/index/upsidedown/store/metrics/reader.go @@ -14,7 +14,7 @@ package metrics -import store "github.com/blevesearch/bleve_index_api/store" +import store "github.com/blevesearch/upsidedown_store_api" type Reader struct { s *Store diff --git a/index/upsidedown/store/metrics/stats.go b/index/upsidedown/store/metrics/stats.go index f89def1fd..c30d2dd62 100644 --- a/index/upsidedown/store/metrics/stats.go +++ b/index/upsidedown/store/metrics/stats.go @@ -17,7 +17,7 @@ package metrics import ( "encoding/json" - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" ) type stats struct { diff --git a/index/upsidedown/store/metrics/store.go b/index/upsidedown/store/metrics/store.go index a7f63f78a..5ae7870f6 100644 --- a/index/upsidedown/store/metrics/store.go +++ b/index/upsidedown/store/metrics/store.go @@ -25,7 +25,7 @@ import ( "sync" "time" - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" "github.com/blevesearch/bleve/registry" "github.com/rcrowley/go-metrics" ) diff --git a/index/upsidedown/store/metrics/store_test.go b/index/upsidedown/store/metrics/store_test.go index f655e06e3..1513dd18d 100644 --- a/index/upsidedown/store/metrics/store_test.go +++ b/index/upsidedown/store/metrics/store_test.go @@ -17,9 +17,9 @@ package metrics import ( "testing" - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" - "github.com/blevesearch/bleve/index/upsidedown/store/test" + "github.com/blevesearch/upsidedown_store_api/test" ) func open(t *testing.T, mo store.MergeOperator) store.KVStore { diff --git a/index/upsidedown/store/metrics/writer.go b/index/upsidedown/store/metrics/writer.go index b61c024bf..c278e3882 100644 --- a/index/upsidedown/store/metrics/writer.go +++ b/index/upsidedown/store/metrics/writer.go @@ -17,7 +17,7 @@ package metrics import ( "fmt" - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" ) type Writer struct { diff --git a/index/upsidedown/store/moss/batch.go b/index/upsidedown/store/moss/batch.go index 4506a176a..0aa998a2f 100644 --- a/index/upsidedown/store/moss/batch.go +++ b/index/upsidedown/store/moss/batch.go @@ -17,7 +17,7 @@ package moss import ( "github.com/couchbase/moss" - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" ) type Batch struct { diff --git a/index/upsidedown/store/moss/lower.go b/index/upsidedown/store/moss/lower.go index b27adb5d4..0b0dd8044 100644 --- a/index/upsidedown/store/moss/lower.go +++ b/index/upsidedown/store/moss/lower.go @@ -25,7 +25,7 @@ import ( "github.com/couchbase/moss" - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" "github.com/blevesearch/bleve/registry" ) diff --git a/index/upsidedown/store/moss/lower_test.go b/index/upsidedown/store/moss/lower_test.go index 345eeaeeb..10626da7b 100644 --- a/index/upsidedown/store/moss/lower_test.go +++ b/index/upsidedown/store/moss/lower_test.go @@ -19,8 +19,8 @@ import ( "os" "testing" - store "github.com/blevesearch/bleve_index_api/store" - "github.com/blevesearch/bleve/index/upsidedown/store/test" + store "github.com/blevesearch/upsidedown_store_api" + "github.com/blevesearch/upsidedown_store_api/test" ) func openWithLower(t *testing.T, mo store.MergeOperator) (string, store.KVStore) { diff --git a/index/upsidedown/store/moss/reader.go b/index/upsidedown/store/moss/reader.go index 8f110e5f8..93063cdc7 100644 --- a/index/upsidedown/store/moss/reader.go +++ b/index/upsidedown/store/moss/reader.go @@ -17,7 +17,7 @@ package moss import ( "github.com/couchbase/moss" - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" ) type Reader struct { diff --git a/index/upsidedown/store/moss/stats.go b/index/upsidedown/store/moss/stats.go index b5be0dc1f..c39fc4b99 100644 --- a/index/upsidedown/store/moss/stats.go +++ b/index/upsidedown/store/moss/stats.go @@ -17,7 +17,7 @@ package moss import ( "encoding/json" - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" ) type stats struct { diff --git a/index/upsidedown/store/moss/store.go b/index/upsidedown/store/moss/store.go index 8a7c03fea..e2099c286 100644 --- a/index/upsidedown/store/moss/store.go +++ b/index/upsidedown/store/moss/store.go @@ -24,7 +24,7 @@ import ( "github.com/couchbase/moss" - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" "github.com/blevesearch/bleve/registry" ) diff --git a/index/upsidedown/store/moss/store_test.go b/index/upsidedown/store/moss/store_test.go index 9b0454654..49013b6d2 100644 --- a/index/upsidedown/store/moss/store_test.go +++ b/index/upsidedown/store/moss/store_test.go @@ -17,8 +17,8 @@ package moss import ( "testing" - store "github.com/blevesearch/bleve_index_api/store" - "github.com/blevesearch/bleve/index/upsidedown/store/test" + store "github.com/blevesearch/upsidedown_store_api" + "github.com/blevesearch/upsidedown_store_api/test" ) func open(t *testing.T, mo store.MergeOperator) store.KVStore { diff --git a/index/upsidedown/store/moss/writer.go b/index/upsidedown/store/moss/writer.go index 5209c8fc1..cb447167f 100644 --- a/index/upsidedown/store/moss/writer.go +++ b/index/upsidedown/store/moss/writer.go @@ -17,7 +17,7 @@ package moss import ( "fmt" - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" "github.com/couchbase/moss" ) diff --git a/index/upsidedown/store/null/null.go b/index/upsidedown/store/null/null.go index d4a295a88..d7c1b5750 100644 --- a/index/upsidedown/store/null/null.go +++ b/index/upsidedown/store/null/null.go @@ -15,7 +15,7 @@ package null import ( - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" "github.com/blevesearch/bleve/registry" ) diff --git a/index/upsidedown/store/null/null_test.go b/index/upsidedown/store/null/null_test.go index f4f2c0e28..2042f4d9e 100644 --- a/index/upsidedown/store/null/null_test.go +++ b/index/upsidedown/store/null/null_test.go @@ -17,7 +17,7 @@ package null import ( "testing" - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" ) func TestStore(t *testing.T) { diff --git a/index/upsidedown/store/test/README.md b/index/upsidedown/store/test/README.md deleted file mode 100644 index 392df2811..000000000 --- a/index/upsidedown/store/test/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Generic KVStore implementation tests - -These are a set of common tests that should pass on any correct KVStore implementation. - -Each test function in this package has the form: - - func CommonTest(t *testing.T, s store.KVStore) {...} - -A KVStore implementation test should use the same name, including its own KVStore name in the test function. It should instantiate an instance of the store, and pass the testing.T and store to the common function. - -The common test functions should *NOT* close the KVStore. The KVStore test implementation should close the store and cleanup any state. \ No newline at end of file diff --git a/index/upsidedown/store/test/bytes.go b/index/upsidedown/store/test/bytes.go deleted file mode 100644 index 704ba2d54..000000000 --- a/index/upsidedown/store/test/bytes.go +++ /dev/null @@ -1,276 +0,0 @@ -// Copyright (c) 2014 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package test - -import ( - "bytes" - "reflect" - "testing" - - store "github.com/blevesearch/bleve_index_api/store" -) - -// tests which focus on the byte ownership - -// CommonTestReaderOwnsGetBytes attempts to mutate the returned bytes -// first, while the reader is still open, second after that reader is -// closed, then the original key is read again, to ensure these -// modifications did not cause panic, or mutate the stored value -func CommonTestReaderOwnsGetBytes(t *testing.T, s store.KVStore) { - - originalKey := []byte("key") - originalVal := []byte("val") - - // open a writer - writer, err := s.Writer() - if err != nil { - t.Fatal(err) - } - - // write key/val - batch := writer.NewBatch() - batch.Set(originalKey, originalVal) - err = writer.ExecuteBatch(batch) - if err != nil { - t.Fatal(err) - } - - // close the writer - err = writer.Close() - if err != nil { - t.Fatal(err) - } - - // open a reader - reader, err := s.Reader() - if err != nil { - t.Fatal(err) - } - - // read key - returnedVal, err := reader.Get(originalKey) - if err != nil { - t.Fatal(err) - } - - // check that it is the expected value - if !reflect.DeepEqual(returnedVal, originalVal) { - t.Fatalf("expected value: %v for '%s', got %v", originalVal, originalKey, returnedVal) - } - - // mutate the returned value with reader still open - for i := range returnedVal { - returnedVal[i] = '1' - } - - // read the key again - returnedVal2, err := reader.Get(originalKey) - if err != nil { - t.Fatal(err) - } - - // check that it is the expected value - if !reflect.DeepEqual(returnedVal2, originalVal) { - t.Fatalf("expected value: %v for '%s', got %v", originalVal, originalKey, returnedVal2) - } - - // close the reader - err = reader.Close() - if err != nil { - t.Fatal(err) - } - - // mutate the original returned value again - for i := range returnedVal { - returnedVal[i] = '2' - } - - // open another reader - reader, err = s.Reader() - if err != nil { - t.Fatal(err) - } - - // read the key again - returnedVal3, err := reader.Get(originalKey) - if err != nil { - t.Fatal(err) - } - - // check that it is the expected value - if !reflect.DeepEqual(returnedVal3, originalVal) { - t.Fatalf("expected value: %v for '%s', got %v", originalVal, originalKey, returnedVal3) - } - - // close the reader - err = reader.Close() - if err != nil { - t.Fatal(err) - } - - // finally check that the value we mutated still has what we set it to - for i := range returnedVal { - if returnedVal[i] != '2' { - t.Errorf("expected byte to be '2', got %v", returnedVal[i]) - } - } -} - -func CommonTestWriterOwnsBytes(t *testing.T, s store.KVStore) { - - keyBuffer := make([]byte, 5) - valBuffer := make([]byte, 5) - - // open a writer - writer, err := s.Writer() - if err != nil { - t.Fatal(err) - } - - // write key/val pairs reusing same buffer - batch := writer.NewBatch() - for i := 0; i < 10; i++ { - keyBuffer[0] = 'k' - keyBuffer[1] = 'e' - keyBuffer[2] = 'y' - keyBuffer[3] = '-' - keyBuffer[4] = byte('0' + i) - valBuffer[0] = 'v' - valBuffer[1] = 'a' - valBuffer[2] = 'l' - valBuffer[3] = '-' - valBuffer[4] = byte('0' + i) - batch.Set(keyBuffer, valBuffer) - } - err = writer.ExecuteBatch(batch) - if err != nil { - t.Fatal(err) - } - - // close the writer - err = writer.Close() - if err != nil { - t.Fatal(err) - } - - // open a reader - reader, err := s.Reader() - if err != nil { - t.Fatal(err) - } - - // check that we can read back what we expect - allks := make([][]byte, 0) - allvs := make([][]byte, 0) - iter := reader.RangeIterator(nil, nil) - for iter.Valid() { - // if we want to keep bytes from iteration we must copy - k := iter.Key() - copyk := make([]byte, len(k)) - copy(copyk, k) - allks = append(allks, copyk) - v := iter.Key() - copyv := make([]byte, len(v)) - copy(copyv, v) - allvs = append(allvs, copyv) - iter.Next() - } - err = iter.Close() - if err != nil { - t.Fatal(err) - } - - if len(allks) != 10 { - t.Fatalf("expected 10 k/v pairs, got %d", len(allks)) - } - for i, key := range allks { - val := allvs[i] - if !bytes.HasSuffix(key, []byte{byte('0' + i)}) { - t.Errorf("expected key %v to end in %d", key, []byte{byte('0' + i)}) - } - if !bytes.HasSuffix(val, []byte{byte('0' + i)}) { - t.Errorf("expected val %v to end in %d", val, []byte{byte('0' + i)}) - } - } - - // close the reader - err = reader.Close() - if err != nil { - t.Fatal(err) - } - - // open a writer - writer, err = s.Writer() - if err != nil { - t.Fatal(err) - } - - // now delete using same approach - batch = writer.NewBatch() - for i := 0; i < 10; i++ { - keyBuffer[0] = 'k' - keyBuffer[1] = 'e' - keyBuffer[2] = 'y' - keyBuffer[3] = '-' - keyBuffer[4] = byte('0' + i) - batch.Delete(keyBuffer) - } - err = writer.ExecuteBatch(batch) - if err != nil { - t.Fatal(err) - } - - // close the writer - err = writer.Close() - if err != nil { - t.Fatal(err) - } - - // open a reader - reader, err = s.Reader() - if err != nil { - t.Fatal(err) - } - - // check that we can read back what we expect - allks = make([][]byte, 0) - iter = reader.RangeIterator(nil, nil) - for iter.Valid() { - // if we want to keep bytes from iteration we must copy - k := iter.Key() - copyk := make([]byte, len(k)) - copy(copyk, k) - allks = append(allks, copyk) - v := iter.Key() - copyv := make([]byte, len(v)) - copy(copyv, v) - allvs = append(allvs, copyv) - iter.Next() - } - err = iter.Close() - if err != nil { - t.Fatal(err) - } - - if len(allks) != 0 { - t.Fatalf("expected 0 k/v pairs remaining, got %d", len(allks)) - } - - // close the reader - err = reader.Close() - if err != nil { - t.Fatal(err) - } -} diff --git a/index/upsidedown/store/test/crud.go b/index/upsidedown/store/test/crud.go deleted file mode 100644 index 72024c6ee..000000000 --- a/index/upsidedown/store/test/crud.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) 2014 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package test - -import ( - "testing" - - store "github.com/blevesearch/bleve_index_api/store" -) - -// basic crud tests - -func CommonTestKVCrud(t *testing.T, s store.KVStore) { - - writer, err := s.Writer() - if err != nil { - t.Error(err) - } - - batch := writer.NewBatch() - batch.Set([]byte("a"), []byte("val-a")) - batch.Set([]byte("z"), []byte("val-z")) - batch.Delete([]byte("z")) - err = writer.ExecuteBatch(batch) - if err != nil { - t.Fatal(err) - } - - batch.Reset() - - batch.Set([]byte("b"), []byte("val-b")) - batch.Set([]byte("c"), []byte("val-c")) - batch.Set([]byte("d"), []byte("val-d")) - batch.Set([]byte("e"), []byte("val-e")) - batch.Set([]byte("f"), []byte("val-f")) - batch.Set([]byte("g"), []byte("val-g")) - batch.Set([]byte("h"), []byte("val-h")) - batch.Set([]byte("i"), []byte("val-i")) - batch.Set([]byte("j"), []byte("val-j")) - - err = writer.ExecuteBatch(batch) - if err != nil { - t.Fatal(err) - } - err = writer.Close() - if err != nil { - t.Fatal(err) - } - - reader, err := s.Reader() - if err != nil { - t.Error(err) - } - defer func() { - err := reader.Close() - if err != nil { - t.Fatal(err) - } - }() - it := reader.RangeIterator([]byte("b"), nil) - key, val, valid := it.Current() - if !valid { - t.Fatalf("valid false, expected true") - } - if string(key) != "b" { - t.Fatalf("expected key b, got %s", key) - } - if string(val) != "val-b" { - t.Fatalf("expected value val-b, got %s", val) - } - - it.Next() - key, val, valid = it.Current() - if !valid { - t.Fatalf("valid false, expected true") - } - if string(key) != "c" { - t.Fatalf("expected key c, got %s", key) - } - if string(val) != "val-c" { - t.Fatalf("expected value val-c, got %s", val) - } - - it.Seek([]byte("i")) - key, val, valid = it.Current() - if !valid { - t.Fatalf("valid false, expected true") - } - if string(key) != "i" { - t.Fatalf("expected key i, got %s", key) - } - if string(val) != "val-i" { - t.Fatalf("expected value val-i, got %s", val) - } - - err = it.Close() - if err != nil { - t.Fatal(err) - } -} diff --git a/index/upsidedown/store/test/isolation.go b/index/upsidedown/store/test/isolation.go deleted file mode 100644 index 7f1e983ad..000000000 --- a/index/upsidedown/store/test/isolation.go +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright (c) 2014 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package test - -import ( - "fmt" - "reflect" - "testing" - - store "github.com/blevesearch/bleve_index_api/store" -) - -// tests focused on verifying that readers are isolated from writers - -func CommonTestReaderIsolation(t *testing.T, s store.KVStore) { - // insert a kv pair - writer, err := s.Writer() - if err != nil { - t.Error(err) - } - - // ************************************************** - // this is a hack only required for BoltDB - // however its harmless so to keep the tests - // the same everywhere, we include it here - // - // this is a hack to try to pre-emptively overflow - // boltdb writes *MAY* block a long reader - // in particular, if the write requires additional - // allocation, it must acquire the same lock as - // the reader, thus cannot continue until that - // reader is closed. - // in general this is not a problem for bleve - // (though it may affect performance in some cases) - // but it is a problem for this test which attempts - // to easily verify that readers are isolated - // this hack writes enough initial data such that - // the subsequent writes do not require additional - // space - hackSize := 1000 - batch := writer.NewBatch() - for i := 0; i < hackSize; i++ { - k := fmt.Sprintf("x%d", i) - batch.Set([]byte(k), []byte("filler")) - } - err = writer.ExecuteBatch(batch) - if err != nil { - t.Fatal(err) - } - // ************************************************** - - batch = writer.NewBatch() - batch.Set([]byte("a"), []byte("val-a")) - err = writer.ExecuteBatch(batch) - if err != nil { - t.Fatal(err) - } - err = writer.Close() - if err != nil { - t.Fatal(err) - } - - // create an isolated reader - reader, err := s.Reader() - if err != nil { - t.Error(err) - } - defer func() { - err := reader.Close() - if err != nil { - t.Fatal(err) - } - }() - - // verify that we see the value already inserted - val, err := reader.Get([]byte("a")) - if err != nil { - t.Error(err) - } - if !reflect.DeepEqual(val, []byte("val-a")) { - t.Errorf("expected val-a, got nil") - } - - // verify that an iterator sees it - count := 0 - it := reader.RangeIterator([]byte{0}, []byte{'x'}) - defer func() { - err := it.Close() - if err != nil { - t.Fatal(err) - } - }() - for it.Valid() { - it.Next() - count++ - } - if count != 1 { - t.Errorf("expected iterator to see 1, saw %d", count) - } - - // add something after the reader was created - writer, err = s.Writer() - if err != nil { - t.Error(err) - } - batch = writer.NewBatch() - batch.Set([]byte("b"), []byte("val-b")) - err = writer.ExecuteBatch(batch) - if err != nil { - t.Fatal(err) - } - err = writer.Close() - if err != nil { - t.Fatal(err) - } - - // ensure that a newer reader sees it - newReader, err := s.Reader() - if err != nil { - t.Error(err) - } - defer func() { - err := newReader.Close() - if err != nil { - t.Fatal(err) - } - }() - val, err = newReader.Get([]byte("b")) - if err != nil { - t.Error(err) - } - if !reflect.DeepEqual(val, []byte("val-b")) { - t.Errorf("expected val-b, got nil") - } - - // ensure that the direct iterator sees it - count = 0 - it2 := newReader.RangeIterator([]byte{0}, []byte{'x'}) - defer func() { - err := it2.Close() - if err != nil { - t.Fatal(err) - } - }() - for it2.Valid() { - it2.Next() - count++ - } - if count != 2 { - t.Errorf("expected iterator to see 2, saw %d", count) - } - - // but that the isolated reader does not - val, err = reader.Get([]byte("b")) - if err != nil { - t.Error(err) - } - if val != nil { - t.Errorf("expected nil, got %v", val) - } - - // and ensure that the iterator on the isolated reader also does not - count = 0 - it3 := reader.RangeIterator([]byte{0}, []byte{'x'}) - defer func() { - err := it3.Close() - if err != nil { - t.Fatal(err) - } - }() - for it3.Valid() { - it3.Next() - count++ - } - if count != 1 { - t.Errorf("expected iterator to see 1, saw %d", count) - } - -} diff --git a/index/upsidedown/store/test/iterator.go b/index/upsidedown/store/test/iterator.go deleted file mode 100644 index 7457c1756..000000000 --- a/index/upsidedown/store/test/iterator.go +++ /dev/null @@ -1,438 +0,0 @@ -// Copyright (c) 2014 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package test - -import ( - "bytes" - "reflect" - "strings" - "testing" - - store "github.com/blevesearch/bleve_index_api/store" -) - -// tests around the correct behavior of iterators - -type testRow struct { - key []byte - val []byte -} - -func batchWriteRows(s store.KVStore, rows []testRow) error { - // open a writer - writer, err := s.Writer() - if err != nil { - return err - } - - // write the data - batch := writer.NewBatch() - for _, row := range rows { - batch.Set(row.key, row.val) - } - err = writer.ExecuteBatch(batch) - if err != nil { - return err - } - - // close the writer - err = writer.Close() - if err != nil { - return err - } - return nil -} - -func CommonTestPrefixIterator(t *testing.T, s store.KVStore) { - - data := []testRow{ - {[]byte("apple"), []byte("val")}, - {[]byte("cat1"), []byte("val")}, - {[]byte("cat2"), []byte("val")}, - {[]byte("cat3"), []byte("val")}, - {[]byte("dog1"), []byte("val")}, - {[]byte("dog2"), []byte("val")}, - {[]byte("dog4"), []byte("val")}, - {[]byte("elephant"), []byte("val")}, - } - - expectedCats := [][]byte{ - []byte("cat1"), - []byte("cat2"), - []byte("cat3"), - } - - expectedDogs := [][]byte{ - []byte("dog1"), - // we seek to "dog3" and ensure it skips over "dog2" - // but still finds "dog4" even though there was no "dog3" - []byte("dog4"), - } - - err := batchWriteRows(s, data) - if err != nil { - t.Fatal(err) - } - - // open a reader - reader, err := s.Reader() - if err != nil { - t.Fatal(err) - } - - // get a prefix reader - cats := make([][]byte, 0) - iter := reader.PrefixIterator([]byte("cat")) - for iter.Valid() { - // if we want to keep bytes from iteration we must copy - k := iter.Key() - copyk := make([]byte, len(k)) - copy(copyk, k) - cats = append(cats, copyk) - iter.Next() - } - err = iter.Close() - if err != nil { - t.Fatal(err) - } - - // check that we found all the cats - if !reflect.DeepEqual(cats, expectedCats) { - t.Fatalf("expected cats %v, got %v", expectedCats, cats) - } - - // get a prefix reader - dogs := make([][]byte, 0) - iter = reader.PrefixIterator([]byte("dog")) - for iter.Valid() { - // if we want to keep bytes from iteration we must copy - k := iter.Key() - copyk := make([]byte, len(k)) - copy(copyk, k) - dogs = append(dogs, copyk) - if len(dogs) < 2 { - iter.Seek([]byte("dog3")) - } else { - iter.Next() - } - } - err = iter.Close() - if err != nil { - t.Fatal(err) - } - - // check that we found the expected dogs - if !reflect.DeepEqual(dogs, expectedDogs) { - t.Fatalf("expected dogs %v, got %v", expectedDogs, dogs) - } - - // close the reader - err = reader.Close() - if err != nil { - t.Fatal(err) - } -} - -func CommonTestPrefixIteratorSeek(t *testing.T, s store.KVStore) { - - data := []testRow{ - {[]byte("a"), []byte("val")}, - {[]byte("b1"), []byte("val")}, - {[]byte("b2"), []byte("val")}, - {[]byte("b3"), []byte("val")}, - {[]byte("c"), []byte("val")}, - } - - err := batchWriteRows(s, data) - if err != nil { - t.Fatal(err) - } - - // open a reader - reader, err := s.Reader() - if err != nil { - t.Fatal(err) - } - defer func() { - err := reader.Close() - if err != nil { - t.Fatal(err) - } - }() - - // get an iterator on a central subset of the data - iter := reader.PrefixIterator([]byte("b")) - defer func() { - err := iter.Close() - if err != nil { - t.Fatal(err) - } - }() - - // check that all keys have prefix - found := []string{} - for ; iter.Valid(); iter.Next() { - found = append(found, string(iter.Key())) - } - for _, f := range found { - if !strings.HasPrefix(f, "b") { - t.Errorf("got key '%s' that doesn't have correct prefix", f) - } - } - if len(found) != 3 { - t.Errorf("expected 3 keys with prefix, got %d", len(found)) - } - - // now try to seek before the prefix and repeat - found = []string{} - for iter.Seek([]byte("a")); iter.Valid(); iter.Next() { - found = append(found, string(iter.Key())) - } - for _, f := range found { - if !strings.HasPrefix(f, "b") { - t.Errorf("got key '%s' that doesn't have correct prefix", f) - } - } - if len(found) != 3 { - t.Errorf("expected 3 keys with prefix, got %d", len(found)) - } - - // now try to seek after the prefix and repeat - found = []string{} - for iter.Seek([]byte("c")); iter.Valid(); iter.Next() { - found = append(found, string(iter.Key())) - } - for _, f := range found { - if !strings.HasPrefix(f, "b") { - t.Errorf("got key '%s' that doesn't have correct prefix", f) - } - } - if len(found) != 0 { - t.Errorf("expected 0 keys with prefix, got %d", len(found)) - } - -} - -func CommonTestRangeIterator(t *testing.T, s store.KVStore) { - - data := []testRow{ - {[]byte("a1"), []byte("val")}, - {[]byte("b1"), []byte("val")}, - {[]byte("b2"), []byte("val")}, - {[]byte("b3"), []byte("val")}, - {[]byte("c1"), []byte("val")}, - {[]byte("c2"), []byte("val")}, - {[]byte("c4"), []byte("val")}, - {[]byte("d1"), []byte("val")}, - } - - expectedAll := make([][]byte, 0) - expectedBToC := make([][]byte, 0) - expectedCToDSeek3 := make([][]byte, 0) - expectedCToEnd := make([][]byte, 0) - for _, row := range data { - expectedAll = append(expectedAll, row.key) - if bytes.HasPrefix(row.key, []byte("b")) { - expectedBToC = append(expectedBToC, row.key) - } - if bytes.HasPrefix(row.key, []byte("c")) && !bytes.HasSuffix(row.key, []byte("2")) { - expectedCToDSeek3 = append(expectedCToDSeek3, row.key) - } - if bytes.Compare(row.key, []byte("c")) > 0 { - expectedCToEnd = append(expectedCToEnd, row.key) - } - } - - err := batchWriteRows(s, data) - if err != nil { - t.Fatal(err) - } - - // open a reader - reader, err := s.Reader() - if err != nil { - t.Fatal(err) - } - - // get a range iterator (all) - all := make([][]byte, 0) - iter := reader.RangeIterator(nil, nil) - for iter.Valid() { - // if we want to keep bytes from iteration we must copy - k := iter.Key() - copyk := make([]byte, len(k)) - copy(copyk, k) - all = append(all, copyk) - iter.Next() - } - err = iter.Close() - if err != nil { - t.Fatal(err) - } - - // check that we found all - if !reflect.DeepEqual(all, expectedAll) { - t.Fatalf("expected all %v, got %v", expectedAll, all) - } - - // get range iterator from b - c - bToC := make([][]byte, 0) - iter = reader.RangeIterator([]byte("b"), []byte("c")) - for iter.Valid() { - // if we want to keep bytes from iteration we must copy - k := iter.Key() - copyk := make([]byte, len(k)) - copy(copyk, k) - bToC = append(bToC, copyk) - iter.Next() - } - err = iter.Close() - if err != nil { - t.Fatal(err) - } - - // check that we found b-c - if !reflect.DeepEqual(bToC, expectedBToC) { - t.Fatalf("expected b-c %v, got %v", expectedBToC, bToC) - } - - // get range iterator from c - d, but seek to 'c3' - cToDSeek3 := make([][]byte, 0) - iter = reader.RangeIterator([]byte("c"), []byte("d")) - for iter.Valid() { - // if we want to keep bytes from iteration we must copy - k := iter.Key() - copyk := make([]byte, len(k)) - copy(copyk, k) - cToDSeek3 = append(cToDSeek3, copyk) - if len(cToDSeek3) < 2 { - iter.Seek([]byte("c3")) - } else { - iter.Next() - } - } - err = iter.Close() - if err != nil { - t.Fatal(err) - } - - // check that we found c-d with seek to c3 - if !reflect.DeepEqual(cToDSeek3, expectedCToDSeek3) { - t.Fatalf("expected b-c %v, got %v", expectedCToDSeek3, cToDSeek3) - } - - // get range iterator from c to the end - cToEnd := make([][]byte, 0) - iter = reader.RangeIterator([]byte("c"), nil) - for iter.Valid() { - // if we want to keep bytes from iteration we must copy - k := iter.Key() - copyk := make([]byte, len(k)) - copy(copyk, k) - cToEnd = append(cToEnd, copyk) - iter.Next() - } - err = iter.Close() - if err != nil { - t.Fatal(err) - } - - // check that we found c to end - if !reflect.DeepEqual(cToEnd, expectedCToEnd) { - t.Fatalf("expected b-c %v, got %v", expectedCToEnd, cToEnd) - } - - // close the reader - err = reader.Close() - if err != nil { - t.Fatal(err) - } -} - -func CommonTestRangeIteratorSeek(t *testing.T, s store.KVStore) { - - data := []testRow{ - {[]byte("a1"), []byte("val")}, - {[]byte("b1"), []byte("val")}, - {[]byte("c1"), []byte("val")}, - {[]byte("d1"), []byte("val")}, - {[]byte("e1"), []byte("val")}, - } - - err := batchWriteRows(s, data) - if err != nil { - t.Fatal(err) - } - - // open a reader - reader, err := s.Reader() - if err != nil { - t.Fatal(err) - } - - // get an iterator on a central subset of the data - start := []byte("b1") - end := []byte("d1") - iter := reader.RangeIterator(start, end) - - // seek before, at and after every possible key - targets := [][]byte{} - for _, row := range data { - prefix := string(row.key[:1]) - targets = append(targets, []byte(prefix+"0")) - targets = append(targets, []byte(prefix+"1")) - targets = append(targets, []byte(prefix+"2")) - } - for _, target := range targets { - found := []string{} - for iter.Seek(target); iter.Valid(); iter.Next() { - found = append(found, string(iter.Key())) - if len(found) > len(data) { - t.Fatalf("enumerated more than data keys after seeking to %s", - string(target)) - } - } - wanted := []string{} - for _, row := range data { - if bytes.Compare(row.key, start) < 0 || - bytes.Compare(row.key, target) < 0 || - bytes.Compare(row.key, end) >= 0 { - continue - } - wanted = append(wanted, string(row.key)) - } - fs := strings.Join(found, ", ") - ws := strings.Join(wanted, ", ") - if fs != ws { - t.Fatalf("iterating from %s returned [%s] instead of [%s]", - string(target), fs, ws) - } - } - - err = iter.Close() - if err != nil { - t.Fatal(err) - } - - if err != nil { - t.Fatal(err) - } - - // close the reader - err = reader.Close() - if err != nil { - t.Fatal(err) - } -} diff --git a/index/upsidedown/store/test/merge.go b/index/upsidedown/store/test/merge.go deleted file mode 100644 index cdf0dcd35..000000000 --- a/index/upsidedown/store/test/merge.go +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) 2014 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package test - -import ( - "encoding/binary" - "testing" - - store "github.com/blevesearch/bleve_index_api/store" -) - -// test merge behavior - -func encodeUint64(in uint64) []byte { - rv := make([]byte, 8) - binary.LittleEndian.PutUint64(rv, in) - return rv -} - -func CommonTestMerge(t *testing.T, s store.KVStore) { - - testKey := []byte("k1") - - data := []struct { - key []byte - val []byte - }{ - {testKey, encodeUint64(1)}, - {testKey, encodeUint64(1)}, - } - - // open a writer - writer, err := s.Writer() - if err != nil { - t.Fatal(err) - } - - // write the data - batch := writer.NewBatch() - for _, row := range data { - batch.Merge(row.key, row.val) - } - err = writer.ExecuteBatch(batch) - if err != nil { - t.Fatal(err) - } - - // close the writer - err = writer.Close() - if err != nil { - t.Fatal(err) - } - - // open a reader - reader, err := s.Reader() - if err != nil { - t.Fatal(err) - } - - // read key - returnedVal, err := reader.Get(testKey) - if err != nil { - t.Fatal(err) - } - - // check the value - mergedval := binary.LittleEndian.Uint64(returnedVal) - if mergedval != 2 { - t.Errorf("expected 2, got %d", mergedval) - } - - // close the reader - err = reader.Close() - if err != nil { - t.Fatal(err) - } - -} - -// a test merge operator which is just an incrementing counter of uint64 -type TestMergeCounter struct{} - -func (mc *TestMergeCounter) FullMerge(key, existingValue []byte, operands [][]byte) ([]byte, bool) { - var newval uint64 - if len(existingValue) > 0 { - newval = binary.LittleEndian.Uint64(existingValue) - } - - // now process operands - for _, operand := range operands { - next := binary.LittleEndian.Uint64(operand) - newval += next - } - - rv := make([]byte, 8) - binary.LittleEndian.PutUint64(rv, newval) - return rv, true -} - -func (mc *TestMergeCounter) PartialMerge(key, leftOperand, rightOperand []byte) ([]byte, bool) { - left := binary.LittleEndian.Uint64(leftOperand) - right := binary.LittleEndian.Uint64(rightOperand) - rv := make([]byte, 8) - binary.LittleEndian.PutUint64(rv, left+right) - return rv, true -} - -func (mc *TestMergeCounter) Name() string { - return "test_merge_counter" -} diff --git a/index/upsidedown/upsidedown.go b/index/upsidedown/upsidedown.go index 499203bf6..11ae985e4 100644 --- a/index/upsidedown/upsidedown.go +++ b/index/upsidedown/upsidedown.go @@ -28,7 +28,7 @@ import ( "github.com/blevesearch/bleve/document" "github.com/blevesearch/bleve/registry" index "github.com/blevesearch/bleve_index_api" - store "github.com/blevesearch/bleve_index_api/store" + store "github.com/blevesearch/upsidedown_store_api" "github.com/golang/protobuf/proto" ) diff --git a/registry/store.go b/registry/store.go index e74871bcf..02ebd888c 100644 --- a/registry/store.go +++ b/registry/store.go @@ -17,7 +17,7 @@ package registry import ( "fmt" - "github.com/blevesearch/bleve_index_api/store" + "github.com/blevesearch/upsidedown_store_api" ) func RegisterKVStore(name string, constructor KVStoreConstructor) { From 1fcbc4fed12c0015f0163bf3a387659344775df6 Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Fri, 4 Dec 2020 13:26:47 -0500 Subject: [PATCH 13/28] move FieldCache into upsidedown (#1513) previous the FieldCache type was in the index package, but it is only used by upsidedown, so we relocate it there. --- index/upsidedown/field_cache.go | 88 +++++++++++++++++++++++++++++++++ index/upsidedown/upsidedown.go | 4 +- 2 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 index/upsidedown/field_cache.go diff --git a/index/upsidedown/field_cache.go b/index/upsidedown/field_cache.go new file mode 100644 index 000000000..1f68b71dd --- /dev/null +++ b/index/upsidedown/field_cache.go @@ -0,0 +1,88 @@ +// Copyright (c) 2015 Couchbase, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package upsidedown + +import ( + "sync" +) + +type FieldCache struct { + fieldIndexes map[string]uint16 + indexFields []string + lastFieldIndex int + mutex sync.RWMutex +} + +func NewFieldCache() *FieldCache { + return &FieldCache{ + fieldIndexes: make(map[string]uint16), + lastFieldIndex: -1, + } +} + +func (f *FieldCache) AddExisting(field string, index uint16) { + f.mutex.Lock() + f.addLOCKED(field, index) + f.mutex.Unlock() +} + +func (f *FieldCache) addLOCKED(field string, index uint16) uint16 { + f.fieldIndexes[field] = index + if len(f.indexFields) < int(index)+1 { + prevIndexFields := f.indexFields + f.indexFields = make([]string, int(index)+16) + copy(f.indexFields, prevIndexFields) + } + f.indexFields[int(index)] = field + if int(index) > f.lastFieldIndex { + f.lastFieldIndex = int(index) + } + return index +} + +// FieldNamed returns the index of the field, and whether or not it existed +// before this call. if createIfMissing is true, and new field index is assigned +// but the second return value will still be false +func (f *FieldCache) FieldNamed(field string, createIfMissing bool) (uint16, bool) { + f.mutex.RLock() + if index, ok := f.fieldIndexes[field]; ok { + f.mutex.RUnlock() + return index, true + } else if !createIfMissing { + f.mutex.RUnlock() + return 0, false + } + // trade read lock for write lock + f.mutex.RUnlock() + f.mutex.Lock() + // need to check again with write lock + if index, ok := f.fieldIndexes[field]; ok { + f.mutex.Unlock() + return index, true + } + // assign next field id + index := f.addLOCKED(field, uint16(f.lastFieldIndex+1)) + f.mutex.Unlock() + return index, false +} + +func (f *FieldCache) FieldIndexed(index uint16) (field string) { + f.mutex.RLock() + if int(index) < len(f.indexFields) { + field = f.indexFields[int(index)] + } + f.mutex.RUnlock() + return field +} diff --git a/index/upsidedown/upsidedown.go b/index/upsidedown/upsidedown.go index 11ae985e4..6062e97c7 100644 --- a/index/upsidedown/upsidedown.go +++ b/index/upsidedown/upsidedown.go @@ -54,7 +54,7 @@ type UpsideDownCouch struct { storeName string storeConfig map[string]interface{} store store.KVStore - fieldCache *index.FieldCache + fieldCache *FieldCache analysisQueue *index.AnalysisQueue stats *indexStat @@ -74,7 +74,7 @@ type docBackIndexRow struct { func NewUpsideDownCouch(storeName string, storeConfig map[string]interface{}, analysisQueue *index.AnalysisQueue) (index.Index, error) { rv := &UpsideDownCouch{ version: Version, - fieldCache: index.NewFieldCache(), + fieldCache: NewFieldCache(), storeName: storeName, storeConfig: storeConfig, analysisQueue: analysisQueue, From 010cf8f8253d9151ce3925cb0973df40955fd438 Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Fri, 4 Dec 2020 13:27:18 -0500 Subject: [PATCH 14/28] make ErrUnknownIndexType upsidedown specific (#1514) this removes the top-level bleve err ErrUnknownIndexType instead, now the upsidedown specific error is returned. users who actually care and are checking for this error type still can, only now it is defined in the upsidedown package. --- error.go | 2 -- index/upsidedown/upsidedown.go | 4 +++- index_impl.go | 6 ------ index_test.go | 4 ++-- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/error.go b/error.go index 7402dfcf4..7dd21194c 100644 --- a/error.go +++ b/error.go @@ -20,7 +20,6 @@ const ( ErrorIndexPathDoesNotExist ErrorIndexMetaMissing ErrorIndexMetaCorrupt - ErrorUnknownStorageType ErrorIndexClosed ErrorAliasMulti ErrorAliasEmpty @@ -42,7 +41,6 @@ var errorMessages = map[Error]string{ ErrorIndexPathDoesNotExist: "cannot open index, path does not exist", ErrorIndexMetaMissing: "cannot open index, metadata missing", ErrorIndexMetaCorrupt: "cannot open index, metadata corrupt", - ErrorUnknownStorageType: "unknown storage type", ErrorIndexClosed: "index is closed", ErrorAliasMulti: "cannot perform single index operation on multiple index alias", ErrorAliasEmpty: "cannot perform operation on empty alias", diff --git a/index/upsidedown/upsidedown.go b/index/upsidedown/upsidedown.go index 6062e97c7..6f00fb438 100644 --- a/index/upsidedown/upsidedown.go +++ b/index/upsidedown/upsidedown.go @@ -48,6 +48,8 @@ const Version uint8 = 7 var IncompatibleVersion = fmt.Errorf("incompatible version, %d is supported", Version) +var ErrorUnknownStorageType = fmt.Errorf("unknown storage type") + type UpsideDownCouch struct { version uint8 path string @@ -299,7 +301,7 @@ func (udc *UpsideDownCouch) Open() (err error) { // open the kv store storeConstructor := registry.KVStoreConstructorByName(udc.storeName) if storeConstructor == nil { - err = index.ErrorUnknownStorageType + err = ErrorUnknownStorageType return } diff --git a/index_impl.go b/index_impl.go index ee6d25392..75cc07a70 100644 --- a/index_impl.go +++ b/index_impl.go @@ -106,9 +106,6 @@ func newIndexUsing(path string, mapping mapping.IndexMapping, indexType string, } err = rv.i.Open() if err != nil { - if err == index.ErrorUnknownStorageType { - return nil, ErrorUnknownStorageType - } return nil, err } defer func(rv *indexImpl) { @@ -176,9 +173,6 @@ func openIndexUsing(path string, runtimeConfig map[string]interface{}) (rv *inde } err = rv.i.Open() if err != nil { - if err == index.ErrorUnknownStorageType { - return nil, ErrorUnknownStorageType - } return nil, err } defer func(rv *indexImpl) { diff --git a/index_test.go b/index_test.go index e98badd53..2261c1e70 100644 --- a/index_test.go +++ b/index_test.go @@ -280,8 +280,8 @@ func TestIndexOpenMetaMissingOrCorrupt(t *testing.T) { } index, err = Open(tmpIndexPath) - if err != ErrorUnknownStorageType { - t.Fatalf("expected error unknown storage type, got %v", err) + if err == nil { + t.Fatalf("expected error for unknown storage type, got %v", err) } // now intentionally corrupt the metadata From bcacd4862831c278fee57d292a99bfd9b6841dbc Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Fri, 4 Dec 2020 13:27:44 -0500 Subject: [PATCH 15/28] move regexp interface to searcher (#1515) this interface is only used by the searcher package, thus it makes sense to define it there --- search/searcher/search_regexp.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/search/searcher/search_regexp.go b/search/searcher/search_regexp.go index fb7e141c2..ea2a87379 100644 --- a/search/searcher/search_regexp.go +++ b/search/searcher/search_regexp.go @@ -21,6 +21,17 @@ import ( "github.com/blevesearch/bleve/search" ) +// The Regexp interface defines the subset of the regexp.Regexp API +// methods that are used by bleve indexes, allowing callers to pass in +// alternate implementations. +type Regexp interface { + FindStringIndex(s string) (loc []int) + + LiteralPrefix() (prefix string, complete bool) + + String() string +} + // NewRegexpStringSearcher is similar to NewRegexpSearcher, but // additionally optimizes for index readers that handle regexp's. func NewRegexpStringSearcher(indexReader index.IndexReader, pattern string, @@ -66,7 +77,7 @@ func NewRegexpStringSearcher(indexReader index.IndexReader, pattern string, // matching the entire term. The provided regexp SHOULD NOT start with ^ // or end with $ as this can intefere with the implementation. Separately, // matches will be checked to ensure they match the entire term. -func NewRegexpSearcher(indexReader index.IndexReader, pattern index.Regexp, +func NewRegexpSearcher(indexReader index.IndexReader, pattern Regexp, field string, boost float64, options search.SearcherOptions) ( search.Searcher, error) { var candidateTerms []string @@ -89,7 +100,7 @@ func NewRegexpSearcher(indexReader index.IndexReader, pattern index.Regexp, } func findRegexpCandidateTerms(indexReader index.IndexReader, - pattern index.Regexp, field, prefixTerm string) (rv []string, err error) { + pattern Regexp, field, prefixTerm string) (rv []string, err error) { rv = make([]string, 0) var fieldDict index.FieldDict if len(prefixTerm) > 0 { From 66ef9cf5f8b9e6ad3e02c8710c4dab3b24aea69f Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Sun, 6 Dec 2020 09:20:54 -0500 Subject: [PATCH 16/28] remove use of dump methods from index reader (#1516) the dump methods were only ever supposed by upsidedown now, users of this method must type-assert that their reader is from the upsidedown package, where these methods remain, unchanged. --- cmd/bleve/cmd/dump.go | 6 +++++- cmd/bleve/cmd/dumpDoc.go | 6 +++++- cmd/bleve/cmd/dumpFields.go | 6 +++++- http/debug.go | 7 ++++++- index/upsidedown/dump_test.go | 14 +++++++++----- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/cmd/bleve/cmd/dump.go b/cmd/bleve/cmd/dump.go index 1082b4a20..efe60cdf1 100644 --- a/cmd/bleve/cmd/dump.go +++ b/cmd/bleve/cmd/dump.go @@ -37,8 +37,12 @@ var dumpCmd = &cobra.Command{ if err != nil { return fmt.Errorf("error getting index reader: %v", err) } + upsideDownReader, ok := r.(*upsidedown.IndexReader) + if !ok { + return fmt.Errorf("dump is only supported by index type upsidedown") + } - dumpChan := r.DumpAll() + dumpChan := upsideDownReader.DumpAll() for rowOrErr := range dumpChan { switch rowOrErr := rowOrErr.(type) { case error: diff --git a/cmd/bleve/cmd/dumpDoc.go b/cmd/bleve/cmd/dumpDoc.go index 5dbf52e59..86713d7f2 100644 --- a/cmd/bleve/cmd/dumpDoc.go +++ b/cmd/bleve/cmd/dumpDoc.go @@ -39,8 +39,12 @@ var dumpDocCmd = &cobra.Command{ if err != nil { return fmt.Errorf("error getting index reader: %v", err) } + upsideDownReader, ok := r.(*upsidedown.IndexReader) + if !ok { + return fmt.Errorf("dump doc is only supported by index type upsidedown") + } - dumpChan := r.DumpDoc(args[1]) + dumpChan := upsideDownReader.DumpDoc(args[1]) for rowOrErr := range dumpChan { switch rowOrErr := rowOrErr.(type) { case error: diff --git a/cmd/bleve/cmd/dumpFields.go b/cmd/bleve/cmd/dumpFields.go index d0b7a1d31..931e14a2c 100644 --- a/cmd/bleve/cmd/dumpFields.go +++ b/cmd/bleve/cmd/dumpFields.go @@ -35,8 +35,12 @@ var dumpFieldsCmd = &cobra.Command{ if err != nil { return fmt.Errorf("error getting index reader: %v", err) } + upsideDownReader, ok := r.(*upsidedown.IndexReader) + if !ok { + return fmt.Errorf("dump fields is only supported by index type upsidedown") + } - dumpChan := r.DumpFields() + dumpChan := upsideDownReader.DumpFields() for rowOrErr := range dumpChan { switch rowOrErr := rowOrErr.(type) { case error: diff --git a/http/debug.go b/http/debug.go index 0788cfdee..d102f11d6 100644 --- a/http/debug.go +++ b/http/debug.go @@ -67,9 +67,14 @@ func (h *DebugDocumentHandler) ServeHTTP(w http.ResponseWriter, req *http.Reques showError(w, req, fmt.Sprintf("error operning index reader: %v", err), 500) return } + upsideDownReader, ok := internalIndexReader.(*upsidedown.IndexReader) + if !ok { + showError(w, req, fmt.Sprintf("dump is only supported by index type upsidedown"), 500) + return + } var rv []interface{} - rowChan := internalIndexReader.DumpDoc(docID) + rowChan := upsideDownReader.DumpDoc(docID) for row := range rowChan { switch row := row.(type) { case error: diff --git a/index/upsidedown/dump_test.go b/index/upsidedown/dump_test.go index b8b7ea406..b773d1426 100644 --- a/index/upsidedown/dump_test.go +++ b/index/upsidedown/dump_test.go @@ -18,8 +18,8 @@ import ( "testing" "time" - index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/document" ) @@ -96,7 +96,11 @@ func TestDump(t *testing.T) { if err != nil { t.Fatal(err) } - fieldsRows := reader.DumpFields() + upsideDownReader, ok := reader.(*IndexReader) + if !ok { + t.Fatal("dump is only supported by index type upsidedown") + } + fieldsRows := upsideDownReader.DumpFields() for range fieldsRows { fieldsCount++ } @@ -110,7 +114,7 @@ func TestDump(t *testing.T) { // 3 stored fields expectedDocRowCount := int(1 + (2 * (64 / document.DefaultPrecisionStep)) + 3) docRowCount := 0 - docRows := reader.DumpDoc("1") + docRows := upsideDownReader.DumpDoc("1") for range docRows { docRowCount++ } @@ -119,7 +123,7 @@ func TestDump(t *testing.T) { } docRowCount = 0 - docRows = reader.DumpDoc("2") + docRows = upsideDownReader.DumpDoc("2") for range docRows { docRowCount++ } @@ -136,7 +140,7 @@ func TestDump(t *testing.T) { // 16 date term row counts (shared for both docs, same date value) expectedAllRowCount := int(1 + fieldsCount + (2 * expectedDocRowCount) + 2 + 2 + int((2 * (64 / document.DefaultPrecisionStep)))) allRowCount := 0 - allRows := reader.DumpAll() + allRows := upsideDownReader.DumpAll() for range allRows { allRowCount++ } From 0050aac2de03385d392acb0772f8f1c583e4656a Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Wed, 16 Dec 2020 10:03:31 -0500 Subject: [PATCH 17/28] remove remaining blevex imports (#1520) these cause circular dependencies and are easy for applications to do themselves --- config/config_cld2.go | 21 --------------------- config/config_icu.go | 21 --------------------- config/config_kagome.go | 21 --------------------- config/config_libstemmer.go | 36 ------------------------------------ 4 files changed, 99 deletions(-) delete mode 100644 config/config_cld2.go delete mode 100644 config/config_icu.go delete mode 100644 config/config_kagome.go delete mode 100644 config/config_libstemmer.go diff --git a/config/config_cld2.go b/config/config_cld2.go deleted file mode 100644 index 15f74756e..000000000 --- a/config/config_cld2.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2015 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build cld2 full - -package config - -import ( - _ "github.com/blevesearch/blevex/detectlang" -) diff --git a/config/config_icu.go b/config/config_icu.go deleted file mode 100644 index ff5a81d7a..000000000 --- a/config/config_icu.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2015 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build icu full - -package config - -import ( - _ "github.com/blevesearch/blevex/lang/th" -) diff --git a/config/config_kagome.go b/config/config_kagome.go deleted file mode 100644 index ffe692564..000000000 --- a/config/config_kagome.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2015 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build kagome full - -package config - -import ( - _ "github.com/blevesearch/blevex/lang/ja" -) diff --git a/config/config_libstemmer.go b/config/config_libstemmer.go deleted file mode 100644 index e11b6154f..000000000 --- a/config/config_libstemmer.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2015 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build libstemmer full - -package config - -import ( - _ "github.com/blevesearch/blevex/lang/da" - _ "github.com/blevesearch/blevex/lang/de" - _ "github.com/blevesearch/blevex/lang/en" - _ "github.com/blevesearch/blevex/lang/es" - _ "github.com/blevesearch/blevex/lang/fi" - _ "github.com/blevesearch/blevex/lang/fr" - _ "github.com/blevesearch/blevex/lang/hu" - _ "github.com/blevesearch/blevex/lang/it" - _ "github.com/blevesearch/blevex/lang/nl" - _ "github.com/blevesearch/blevex/lang/no" - _ "github.com/blevesearch/blevex/lang/pt" - _ "github.com/blevesearch/blevex/lang/ro" - _ "github.com/blevesearch/blevex/lang/ru" - _ "github.com/blevesearch/blevex/lang/sv" - _ "github.com/blevesearch/blevex/lang/th" - _ "github.com/blevesearch/blevex/lang/tr" -) From 4da47c308ba6003811d23eb7c90c8bacfa038e9c Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Wed, 16 Dec 2020 17:18:45 -0500 Subject: [PATCH 18/28] use the moved indexing options (#1521) * use the moved indexing options * update analysis.TokenFrequency to use options (#1522) * update analysis.TokenFrequency to use options previously it used boolean, and future changes would require additional booleans. using options directly keeps the function signatures cleaner. * update to latest apis --- analysis/benchmark_test.go | 3 +- analysis/freq.go | 4 +- analysis/freq_test.go | 2 +- document/document.go | 2 +- document/field.go | 6 +- document/field_boolean.go | 26 ++------ document/field_composite.go | 24 ++----- document/field_datetime.go | 26 ++------ document/field_geopoint.go | 24 ++----- document/field_numeric.go | 26 ++------ document/field_text.go | 28 ++------- document/indexing_options.go | 66 ------------------- document/indexing_options_test.go | 98 ----------------------------- go.mod | 18 +++--- go.sum | 36 +++++------ index/scorch/field_dict_test.go | 4 +- index/scorch/reader_test.go | 4 +- index/scorch/scorch.go | 2 +- index/scorch/scorch_test.go | 58 ++++++++--------- index/upsidedown/analysis.go | 6 +- index/upsidedown/analysis_test.go | 6 +- index/upsidedown/dump_test.go | 12 ++-- index/upsidedown/field_dict_test.go | 4 +- index/upsidedown/reader_test.go | 4 +- index/upsidedown/upsidedown_test.go | 48 +++++++------- mapping/field.go | 13 ++-- mapping/index.go | 3 +- search/searcher/base_test.go | 2 +- search_test.go | 17 ++--- test/versus_score_test.go | 3 +- 30 files changed, 152 insertions(+), 423 deletions(-) delete mode 100644 document/indexing_options.go delete mode 100644 document/indexing_options_test.go diff --git a/analysis/benchmark_test.go b/analysis/benchmark_test.go index 4ff00e00a..216e423c2 100644 --- a/analysis/benchmark_test.go +++ b/analysis/benchmark_test.go @@ -15,6 +15,7 @@ package analysis_test import ( + index "github.com/blevesearch/bleve_index_api" "testing" "github.com/blevesearch/bleve/analysis" @@ -32,7 +33,7 @@ func BenchmarkAnalysis(b *testing.B) { } ts := analyzer.Analyze(bleveWikiArticle) - freqs := analysis.TokenFrequency(ts, nil, true) + freqs := analysis.TokenFrequency(ts, nil, index.IncludeTermVectors) if len(freqs) != 511 { b.Errorf("expected %d freqs, got %d", 511, len(freqs)) } diff --git a/analysis/freq.go b/analysis/freq.go index 9f44a6a86..ec40bb6f5 100644 --- a/analysis/freq.go +++ b/analysis/freq.go @@ -18,10 +18,10 @@ import ( index "github.com/blevesearch/bleve_index_api" ) -func TokenFrequency(tokens TokenStream, arrayPositions []uint64, includeTermVectors bool) index.TokenFrequencies { +func TokenFrequency(tokens TokenStream, arrayPositions []uint64, options index.FieldIndexingOptions) index.TokenFrequencies { rv := make(map[string]*index.TokenFreq, len(tokens)) - if includeTermVectors { + if options.IncludeTermVectors() { tls := make([]index.TokenLocation, len(tokens)) tlNext := 0 diff --git a/analysis/freq_test.go b/analysis/freq_test.go index 19d2c82d9..724ff4546 100644 --- a/analysis/freq_test.go +++ b/analysis/freq_test.go @@ -54,7 +54,7 @@ func TestTokenFrequency(t *testing.T) { }, } expectedResult["water"].SetFrequency(2) - result := TokenFrequency(tokens, nil, true) + result := TokenFrequency(tokens, nil, index.IncludeTermVectors) if !reflect.DeepEqual(result, expectedResult) { t.Errorf("expected %#v, got %#v", expectedResult, result) } diff --git a/document/document.go b/document/document.go index 98d855966..a0e0fad61 100644 --- a/document/document.go +++ b/document/document.go @@ -110,7 +110,7 @@ func (d *Document) SetID(id string) { } func (d *Document) AddIDField() { - d.AddField(NewTextFieldCustom("_id", nil, []byte(d.ID()), IndexField|StoreField, nil)) + d.AddField(NewTextFieldCustom("_id", nil, []byte(d.ID()), index.IndexField|index.StoreField, nil)) } func (d *Document) VisitFields(visitor index.FieldVisitor) { diff --git a/document/field.go b/document/field.go index c94f5d4d5..eb104e2df 100644 --- a/document/field.go +++ b/document/field.go @@ -28,7 +28,7 @@ type Field interface { // arrays, ArrayPositions returns 2 indices used to resolve "doc2" value in // "doc1", then "field" in "doc2". ArrayPositions() []uint64 - Options() IndexingOptions + Options() index.FieldIndexingOptions Analyze() Value() []byte @@ -40,10 +40,6 @@ type Field interface { Size() int EncodedFieldType() byte - IsIndexed() bool - IsStored() bool - IncludeDocValues() bool - IncludeTermVectors() bool AnalyzedLength() int AnalyzedTokenFrequencies() index.TokenFrequencies } diff --git a/document/field_boolean.go b/document/field_boolean.go index 36bbf8f9e..a588bdf9b 100644 --- a/document/field_boolean.go +++ b/document/field_boolean.go @@ -30,12 +30,12 @@ func init() { reflectStaticSizeBooleanField = int(reflect.TypeOf(f).Size()) } -const DefaultBooleanIndexingOptions = StoreField | IndexField | DocValues +const DefaultBooleanIndexingOptions = index.StoreField | index.IndexField | index.DocValues type BooleanField struct { name string arrayPositions []uint64 - options IndexingOptions + options index.FieldIndexingOptions value []byte numPlainTextBytes uint64 length int @@ -57,7 +57,7 @@ func (b *BooleanField) ArrayPositions() []uint64 { return b.arrayPositions } -func (b *BooleanField) Options() IndexingOptions { +func (b *BooleanField) Options() index.FieldIndexingOptions { return b.options } @@ -72,7 +72,7 @@ func (b *BooleanField) Analyze() { }) b.length = len(tokens) - b.frequencies = analysis.TokenFrequency(tokens, b.arrayPositions, b.options.IncludeTermVectors()) + b.frequencies = analysis.TokenFrequency(tokens, b.arrayPositions, b.options) } func (b *BooleanField) Value() []byte { @@ -98,22 +98,6 @@ func (b *BooleanField) EncodedFieldType() byte { return 'b' } -func (b *BooleanField) IsIndexed() bool { - return b.options.IsIndexed() -} - -func (b *BooleanField) IsStored() bool { - return b.options.IsStored() -} - -func (b *BooleanField) IncludeDocValues() bool { - return b.options.IncludeDocValues() -} - -func (b *BooleanField) IncludeTermVectors() bool { - return b.options.IncludeTermVectors() -} - func (b *BooleanField) AnalyzedLength() int { return b.length } @@ -136,7 +120,7 @@ func NewBooleanField(name string, arrayPositions []uint64, b bool) *BooleanField return NewBooleanFieldWithIndexingOptions(name, arrayPositions, b, DefaultNumericIndexingOptions) } -func NewBooleanFieldWithIndexingOptions(name string, arrayPositions []uint64, b bool, options IndexingOptions) *BooleanField { +func NewBooleanFieldWithIndexingOptions(name string, arrayPositions []uint64, b bool, options index.FieldIndexingOptions) *BooleanField { numPlainTextBytes := 5 v := []byte("F") if b { diff --git a/document/field_composite.go b/document/field_composite.go index e9458dbb3..8517ee4c3 100644 --- a/document/field_composite.go +++ b/document/field_composite.go @@ -28,14 +28,14 @@ func init() { reflectStaticSizeCompositeField = int(reflect.TypeOf(cf).Size()) } -const DefaultCompositeIndexingOptions = IndexField +const DefaultCompositeIndexingOptions = index.IndexField type CompositeField struct { name string includedFields map[string]bool excludedFields map[string]bool defaultInclude bool - options IndexingOptions + options index.FieldIndexingOptions totalLength int compositeFrequencies index.TokenFrequencies } @@ -44,7 +44,7 @@ func NewCompositeField(name string, defaultInclude bool, include []string, exclu return NewCompositeFieldWithIndexingOptions(name, defaultInclude, include, exclude, DefaultCompositeIndexingOptions) } -func NewCompositeFieldWithIndexingOptions(name string, defaultInclude bool, include []string, exclude []string, options IndexingOptions) *CompositeField { +func NewCompositeFieldWithIndexingOptions(name string, defaultInclude bool, include []string, exclude []string, options index.FieldIndexingOptions) *CompositeField { rv := &CompositeField{ name: name, options: options, @@ -87,7 +87,7 @@ func (c *CompositeField) ArrayPositions() []uint64 { return []uint64{} } -func (c *CompositeField) Options() IndexingOptions { +func (c *CompositeField) Options() index.FieldIndexingOptions { return c.options } @@ -126,22 +126,6 @@ func (c *CompositeField) EncodedFieldType() byte { return 'c' } -func (c *CompositeField) IsIndexed() bool { - return c.options.IsIndexed() -} - -func (c *CompositeField) IsStored() bool { - return c.options.IsStored() -} - -func (c *CompositeField) IncludeDocValues() bool { - return c.options.IncludeDocValues() -} - -func (c *CompositeField) IncludeTermVectors() bool { - return c.options.IncludeTermVectors() -} - func (c *CompositeField) AnalyzedLength() int { return c.totalLength } diff --git a/document/field_datetime.go b/document/field_datetime.go index f61d15db9..dbb66a72b 100644 --- a/document/field_datetime.go +++ b/document/field_datetime.go @@ -33,7 +33,7 @@ func init() { reflectStaticSizeDateTimeField = int(reflect.TypeOf(f).Size()) } -const DefaultDateTimeIndexingOptions = StoreField | IndexField | DocValues +const DefaultDateTimeIndexingOptions = index.StoreField | index.IndexField | index.DocValues const DefaultDateTimePrecisionStep uint = 4 var MinTimeRepresentable = time.Unix(0, math.MinInt64) @@ -42,7 +42,7 @@ var MaxTimeRepresentable = time.Unix(0, math.MaxInt64) type DateTimeField struct { name string arrayPositions []uint64 - options IndexingOptions + options index.FieldIndexingOptions value numeric.PrefixCoded numPlainTextBytes uint64 length int @@ -63,7 +63,7 @@ func (n *DateTimeField) ArrayPositions() []uint64 { return n.arrayPositions } -func (n *DateTimeField) Options() IndexingOptions { +func (n *DateTimeField) Options() index.FieldIndexingOptions { return n.options } @@ -71,22 +71,6 @@ func (n *DateTimeField) EncodedFieldType() byte { return 'd' } -func (n *DateTimeField) IsIndexed() bool { - return n.options.IsIndexed() -} - -func (n *DateTimeField) IsStored() bool { - return n.options.IsStored() -} - -func (n *DateTimeField) IncludeDocValues() bool { - return n.options.IncludeDocValues() -} - -func (n *DateTimeField) IncludeTermVectors() bool { - return n.options.IncludeTermVectors() -} - func (n *DateTimeField) AnalyzedLength() int { return n.length } @@ -127,7 +111,7 @@ func (n *DateTimeField) Analyze() { } n.length = len(tokens) - n.frequencies = analysis.TokenFrequency(tokens, n.arrayPositions, n.options.IncludeTermVectors()) + n.frequencies = analysis.TokenFrequency(tokens, n.arrayPositions, n.options) } func (n *DateTimeField) Value() []byte { @@ -164,7 +148,7 @@ func NewDateTimeField(name string, arrayPositions []uint64, dt time.Time) (*Date return NewDateTimeFieldWithIndexingOptions(name, arrayPositions, dt, DefaultDateTimeIndexingOptions) } -func NewDateTimeFieldWithIndexingOptions(name string, arrayPositions []uint64, dt time.Time, options IndexingOptions) (*DateTimeField, error) { +func NewDateTimeFieldWithIndexingOptions(name string, arrayPositions []uint64, dt time.Time, options index.FieldIndexingOptions) (*DateTimeField, error) { if canRepresent(dt) { dtInt64 := dt.UnixNano() prefixCoded := numeric.MustNewPrefixCodedInt64(dtInt64, 0) diff --git a/document/field_geopoint.go b/document/field_geopoint.go index 48e63965b..35375ff4c 100644 --- a/document/field_geopoint.go +++ b/document/field_geopoint.go @@ -37,7 +37,7 @@ var GeoPrecisionStep uint = 9 type GeoPointField struct { name string arrayPositions []uint64 - options IndexingOptions + options index.FieldIndexingOptions value numeric.PrefixCoded numPlainTextBytes uint64 length int @@ -58,7 +58,7 @@ func (n *GeoPointField) ArrayPositions() []uint64 { return n.arrayPositions } -func (n *GeoPointField) Options() IndexingOptions { +func (n *GeoPointField) Options() index.FieldIndexingOptions { return n.options } @@ -66,22 +66,6 @@ func (n *GeoPointField) EncodedFieldType() byte { return 'g' } -func (n *GeoPointField) IsIndexed() bool { - return n.options.IsIndexed() -} - -func (n *GeoPointField) IsStored() bool { - return n.options.IsStored() -} - -func (n *GeoPointField) IncludeDocValues() bool { - return n.options.IncludeDocValues() -} - -func (n *GeoPointField) IncludeTermVectors() bool { - return n.options.IncludeTermVectors() -} - func (n *GeoPointField) AnalyzedLength() int { return n.length } @@ -122,7 +106,7 @@ func (n *GeoPointField) Analyze() { } n.length = len(tokens) - n.frequencies = analysis.TokenFrequency(tokens, n.arrayPositions, n.options.IncludeTermVectors()) + n.frequencies = analysis.TokenFrequency(tokens, n.arrayPositions, n.options) } func (n *GeoPointField) Value() []byte { @@ -167,7 +151,7 @@ func NewGeoPointField(name string, arrayPositions []uint64, lon, lat float64) *G return NewGeoPointFieldWithIndexingOptions(name, arrayPositions, lon, lat, DefaultNumericIndexingOptions) } -func NewGeoPointFieldWithIndexingOptions(name string, arrayPositions []uint64, lon, lat float64, options IndexingOptions) *GeoPointField { +func NewGeoPointFieldWithIndexingOptions(name string, arrayPositions []uint64, lon, lat float64, options index.FieldIndexingOptions) *GeoPointField { mhash := geo.MortonHash(lon, lat) prefixCoded := numeric.MustNewPrefixCodedInt64(int64(mhash), 0) return &GeoPointField{ diff --git a/document/field_numeric.go b/document/field_numeric.go index 994848f41..4d2ceb239 100644 --- a/document/field_numeric.go +++ b/document/field_numeric.go @@ -31,14 +31,14 @@ func init() { reflectStaticSizeNumericField = int(reflect.TypeOf(f).Size()) } -const DefaultNumericIndexingOptions = StoreField | IndexField | DocValues +const DefaultNumericIndexingOptions = index.StoreField | index.IndexField | index.DocValues const DefaultPrecisionStep uint = 4 type NumericField struct { name string arrayPositions []uint64 - options IndexingOptions + options index.FieldIndexingOptions value numeric.PrefixCoded numPlainTextBytes uint64 length int @@ -59,7 +59,7 @@ func (n *NumericField) ArrayPositions() []uint64 { return n.arrayPositions } -func (n *NumericField) Options() IndexingOptions { +func (n *NumericField) Options() index.FieldIndexingOptions { return n.options } @@ -67,22 +67,6 @@ func (n *NumericField) EncodedFieldType() byte { return 'n' } -func (n *NumericField) IsIndexed() bool { - return n.options.IsIndexed() -} - -func (n *NumericField) IsStored() bool { - return n.options.IsStored() -} - -func (n *NumericField) IncludeDocValues() bool { - return n.options.IncludeDocValues() -} - -func (n *NumericField) IncludeTermVectors() bool { - return n.options.IncludeTermVectors() -} - func (n *NumericField) AnalyzedLength() int { return n.length } @@ -123,7 +107,7 @@ func (n *NumericField) Analyze() { } n.length = len(tokens) - n.frequencies = analysis.TokenFrequency(tokens, n.arrayPositions, n.options.IncludeTermVectors()) + n.frequencies = analysis.TokenFrequency(tokens, n.arrayPositions, n.options) } func (n *NumericField) Value() []byte { @@ -160,7 +144,7 @@ func NewNumericField(name string, arrayPositions []uint64, number float64) *Nume return NewNumericFieldWithIndexingOptions(name, arrayPositions, number, DefaultNumericIndexingOptions) } -func NewNumericFieldWithIndexingOptions(name string, arrayPositions []uint64, number float64, options IndexingOptions) *NumericField { +func NewNumericFieldWithIndexingOptions(name string, arrayPositions []uint64, number float64, options index.FieldIndexingOptions) *NumericField { numberInt64 := numeric.Float64ToInt64(number) prefixCoded := numeric.MustNewPrefixCodedInt64(numberInt64, 0) return &NumericField{ diff --git a/document/field_text.go b/document/field_text.go index 1396dc76f..876d5a634 100644 --- a/document/field_text.go +++ b/document/field_text.go @@ -30,12 +30,12 @@ func init() { reflectStaticSizeTextField = int(reflect.TypeOf(f).Size()) } -const DefaultTextIndexingOptions = IndexField | DocValues +const DefaultTextIndexingOptions = index.IndexField | index.DocValues type TextField struct { name string arrayPositions []uint64 - options IndexingOptions + options index.FieldIndexingOptions analyzer *analysis.Analyzer value []byte numPlainTextBytes uint64 @@ -58,7 +58,7 @@ func (t *TextField) ArrayPositions() []uint64 { return t.arrayPositions } -func (t *TextField) Options() IndexingOptions { +func (t *TextField) Options() index.FieldIndexingOptions { return t.options } @@ -66,22 +66,6 @@ func (t *TextField) EncodedFieldType() byte { return 't' } -func (t *TextField) IsIndexed() bool { - return t.options.IsIndexed() -} - -func (t *TextField) IsStored() bool { - return t.options.IsStored() -} - -func (t *TextField) IncludeDocValues() bool { - return t.options.IncludeDocValues() -} - -func (t *TextField) IncludeTermVectors() bool { - return t.options.IncludeTermVectors() -} - func (t *TextField) AnalyzedLength() int { return t.length } @@ -113,7 +97,7 @@ func (t *TextField) Analyze() { } } t.length = len(tokens) // number of tokens in this doc field - t.frequencies = analysis.TokenFrequency(tokens, t.arrayPositions, t.options.IncludeTermVectors()) + t.frequencies = analysis.TokenFrequency(tokens, t.arrayPositions, t.options) } func (t *TextField) Analyzer() *analysis.Analyzer { @@ -136,7 +120,7 @@ func NewTextField(name string, arrayPositions []uint64, value []byte) *TextField return NewTextFieldWithIndexingOptions(name, arrayPositions, value, DefaultTextIndexingOptions) } -func NewTextFieldWithIndexingOptions(name string, arrayPositions []uint64, value []byte, options IndexingOptions) *TextField { +func NewTextFieldWithIndexingOptions(name string, arrayPositions []uint64, value []byte, options index.FieldIndexingOptions) *TextField { return &TextField{ name: name, arrayPositions: arrayPositions, @@ -157,7 +141,7 @@ func NewTextFieldWithAnalyzer(name string, arrayPositions []uint64, value []byte } } -func NewTextFieldCustom(name string, arrayPositions []uint64, value []byte, options IndexingOptions, analyzer *analysis.Analyzer) *TextField { +func NewTextFieldCustom(name string, arrayPositions []uint64, value []byte, options index.FieldIndexingOptions, analyzer *analysis.Analyzer) *TextField { return &TextField{ name: name, arrayPositions: arrayPositions, diff --git a/document/indexing_options.go b/document/indexing_options.go deleted file mode 100644 index 44498a8e9..000000000 --- a/document/indexing_options.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package document - -type IndexingOptions int - -const ( - IndexField IndexingOptions = 1 << iota - StoreField - IncludeTermVectors - DocValues -) - -func (o IndexingOptions) IsIndexed() bool { - return o&IndexField != 0 -} - -func (o IndexingOptions) IsStored() bool { - return o&StoreField != 0 -} - -func (o IndexingOptions) IncludeTermVectors() bool { - return o&IncludeTermVectors != 0 -} - -func (o IndexingOptions) IncludeDocValues() bool { - return o&DocValues != 0 -} - -func (o IndexingOptions) String() string { - rv := "" - if o.IsIndexed() { - rv += "INDEXED" - } - if o.IsStored() { - if rv != "" { - rv += ", " - } - rv += "STORE" - } - if o.IncludeTermVectors() { - if rv != "" { - rv += ", " - } - rv += "TV" - } - if o.IncludeDocValues() { - if rv != "" { - rv += ", " - } - rv += "DV" - } - return rv -} diff --git a/document/indexing_options_test.go b/document/indexing_options_test.go deleted file mode 100644 index d88c41070..000000000 --- a/document/indexing_options_test.go +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) 2014 Couchbase, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package document - -import ( - "testing" -) - -func TestIndexingOptions(t *testing.T) { - tests := []struct { - options IndexingOptions - isIndexed bool - isStored bool - includeTermVectors bool - docValues bool - }{ - { - options: IndexField | StoreField | IncludeTermVectors, - isIndexed: true, - isStored: true, - includeTermVectors: true, - docValues: false, - }, - { - options: IndexField | IncludeTermVectors, - isIndexed: true, - isStored: false, - includeTermVectors: true, - docValues: false, - }, - { - options: StoreField | IncludeTermVectors, - isIndexed: false, - isStored: true, - includeTermVectors: true, - docValues: false, - }, - { - options: IndexField, - isIndexed: true, - isStored: false, - includeTermVectors: false, - docValues: false, - }, - { - options: StoreField, - isIndexed: false, - isStored: true, - includeTermVectors: false, - docValues: false, - }, - { - options: DocValues, - isIndexed: false, - isStored: false, - includeTermVectors: false, - docValues: true, - }, - { - options: IndexField | StoreField | IncludeTermVectors | DocValues, - isIndexed: true, - isStored: true, - includeTermVectors: true, - docValues: true, - }, - } - - for _, test := range tests { - actuallyIndexed := test.options.IsIndexed() - if actuallyIndexed != test.isIndexed { - t.Errorf("expected indexed to be %v, got %v for %d", test.isIndexed, actuallyIndexed, test.options) - } - actuallyStored := test.options.IsStored() - if actuallyStored != test.isStored { - t.Errorf("expected stored to be %v, got %v for %d", test.isStored, actuallyStored, test.options) - } - actuallyIncludeTermVectors := test.options.IncludeTermVectors() - if actuallyIncludeTermVectors != test.includeTermVectors { - t.Errorf("expected includeTermVectors to be %v, got %v for %d", test.includeTermVectors, actuallyIncludeTermVectors, test.options) - } - actuallyDocValues := test.options.IncludeDocValues() - if actuallyDocValues != test.docValues { - t.Errorf("expected docValue to be %v, got %v for %d", test.docValues, actuallyDocValues, test.options) - } - } -} diff --git a/go.mod b/go.mod index 78d75a613..99a89277e 100644 --- a/go.mod +++ b/go.mod @@ -4,29 +4,25 @@ go 1.13 require ( github.com/RoaringBitmap/roaring v0.4.23 - github.com/blevesearch/bleve_index_api v0.0.4 - github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040 - github.com/blevesearch/cld2 v0.0.0-20200327141045-8b5f551d37f5 // indirect + github.com/blevesearch/bleve_index_api v0.0.5 github.com/blevesearch/go-porterstemmer v1.0.3 - github.com/blevesearch/scorch_segment_api v0.0.6 + github.com/blevesearch/scorch_segment_api v0.0.7 github.com/blevesearch/segment v0.9.0 github.com/blevesearch/snowballstem v0.9.0 github.com/blevesearch/upsidedown_store_api v0.0.1 - github.com/blevesearch/zapx/v11 v11.1.5 - github.com/blevesearch/zapx/v12 v12.1.5 - github.com/blevesearch/zapx/v13 v13.1.5 - github.com/blevesearch/zapx/v14 v14.1.5 - github.com/blevesearch/zapx/v15 v15.1.5 + github.com/blevesearch/zapx/v11 v11.1.6 + github.com/blevesearch/zapx/v12 v12.1.6 + github.com/blevesearch/zapx/v13 v13.1.6 + github.com/blevesearch/zapx/v14 v14.1.6 + github.com/blevesearch/zapx/v15 v15.1.6 github.com/couchbase/moss v0.1.0 github.com/couchbase/vellum v1.0.2 github.com/golang/protobuf v1.3.2 - github.com/ikawaha/kagome.ipadic v1.1.2 // indirect github.com/kljensen/snowball v0.6.0 github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563 github.com/spf13/cobra v0.0.5 github.com/steveyen/gtreap v0.1.0 github.com/syndtr/goleveldb v1.0.0 - github.com/tebeka/snowball v0.4.2 // indirect github.com/willf/bitset v1.1.10 go.etcd.io/bbolt v1.3.5 golang.org/x/text v0.3.0 diff --git a/go.sum b/go.sum index 3e3293b68..763ff002f 100644 --- a/go.sum +++ b/go.sum @@ -2,34 +2,30 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/RoaringBitmap/roaring v0.4.23 h1:gpyfd12QohbqhFO4NVDUdoPOCXsyahYRQhINmlHxKeo= github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/blevesearch/bleve_index_api v0.0.4 h1:v+rdWIJ/wmVL81rW0G5cRdIO/Cjbd9NOsmuB0OIbaLs= -github.com/blevesearch/bleve_index_api v0.0.4/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= -github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040 h1:SjYVcfJVZoCfBlg+fkaq2eoZHTf5HaJfaTeTkOtyfHQ= -github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040/go.mod h1:WH+MU2F4T0VmSdaPX+Wu5GYoZBrYWdOZWSjzvYcDmqQ= -github.com/blevesearch/cld2 v0.0.0-20200327141045-8b5f551d37f5 h1:/4ikScMMYMqsRFWJjCyzd3CNWB0lxvqDkqa5nEv6NMc= -github.com/blevesearch/cld2 v0.0.0-20200327141045-8b5f551d37f5/go.mod h1:PN0QNTLs9+j1bKy3d/GB/59wsNBFC4sWLWG3k69lWbc= +github.com/blevesearch/bleve_index_api v0.0.5 h1:LdL97X6ZwbCf1FSo6xe5eqT92MDb4X7s2j1chAKRpuY= +github.com/blevesearch/bleve_index_api v0.0.5/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo= github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M= github.com/blevesearch/mmap-go v1.0.2 h1:JtMHb+FgQCTTYIhtMvimw15dJwu1Y5lrZDMOFXVWPk0= github.com/blevesearch/mmap-go v1.0.2/go.mod h1:ol2qBqYaOUsGdm7aRMRrYGgPvnwLe6Y+7LMvAB5IbSA= -github.com/blevesearch/scorch_segment_api v0.0.6 h1:AL1ZM8rykkd9GQEo4QVPicCyrZmDD1C0DLmKgT2klIQ= -github.com/blevesearch/scorch_segment_api v0.0.6/go.mod h1:65b3su9AXLFeAWQlYHb0qyyPzAzscNmWXMa6qQOMJPo= +github.com/blevesearch/scorch_segment_api v0.0.7 h1:X6eGntic+71Gv77wQnzD2kOWyhEvxQ0x/El6X+NVKaE= +github.com/blevesearch/scorch_segment_api v0.0.7/go.mod h1:gZhO+qjyJ/u0qho9GuhHXtdtT3hpveyA4DfUU9W+kco= github.com/blevesearch/segment v0.9.0 h1:5lG7yBCx98or7gK2cHMKPukPZ/31Kag7nONpoBt22Ac= github.com/blevesearch/segment v0.9.0/go.mod h1:9PfHYUdQCgHktBgvtUOF4x+pc4/l8rdH0u5spnW85UQ= github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s= github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs= github.com/blevesearch/upsidedown_store_api v0.0.1 h1:cf3YQ6c3jvZ/gvHL6k71cshDG+nYTgL5PTWFqYXA3bg= github.com/blevesearch/upsidedown_store_api v0.0.1/go.mod h1:jRZGTYWNqHXvOOjvT0WXHYO5Yin7U/PmTX1nevIY8yo= -github.com/blevesearch/zapx/v11 v11.1.5 h1:junThJcb8Zb9R06FXrSrbGv8w+q0JCeWiCUmBZCzoF0= -github.com/blevesearch/zapx/v11 v11.1.5/go.mod h1:t0iWZlu/G6tiOr2kS4yDQfomnErPOwe7MyTSNfmanZc= -github.com/blevesearch/zapx/v12 v12.1.5 h1:iGVqwKCEvN313f5wxVmgu3G53oIRlzgcStVYmIhzJyg= -github.com/blevesearch/zapx/v12 v12.1.5/go.mod h1:unFlOztl5e37f0shGV/c3O2cwzkQozgoSBwtKz7pYi8= -github.com/blevesearch/zapx/v13 v13.1.5 h1:py2pA1aZhYjmKMngJE13B7eB32zaLz5Ok5117KkIiWA= -github.com/blevesearch/zapx/v13 v13.1.5/go.mod h1:+9llGYb/i+2hl5Sh96AZsiCCfDjMde3zG+MUc8wTvGI= -github.com/blevesearch/zapx/v14 v14.1.5 h1:zDXCsgk0kMQ6oUS8DvNtUuqLvqPZ+5qQE3YBF+hl3lQ= -github.com/blevesearch/zapx/v14 v14.1.5/go.mod h1:SgHVOkbyz7GX53h4mv6jLRWwWW/lfvC+tW8Xz2CiXDw= -github.com/blevesearch/zapx/v15 v15.1.5 h1:YGOuePgbuCM3vS4etn2qQOOxGXr76KFbkO3pFsDELUo= -github.com/blevesearch/zapx/v15 v15.1.5/go.mod h1:0Oh7/luoaUujNBBf5tisBHDwJh0UQ/TFuVH0FUg5XlQ= +github.com/blevesearch/zapx/v11 v11.1.6 h1:8eqdDbWWNX99RS9byGVTiTXrBKfHYdp/XDi5JxWMYrU= +github.com/blevesearch/zapx/v11 v11.1.6/go.mod h1:yKP1ax+HWGb5+Z8SSQ3kRbxJRsJv18tBoap5OWT3nzc= +github.com/blevesearch/zapx/v12 v12.1.6 h1:mce/asG9ov5U3mNiYyLmadJVclDPntd5VLxpTo6Y8bA= +github.com/blevesearch/zapx/v12 v12.1.6/go.mod h1:H/RCE6zfjWofAtniY7qrKFDHB7Kb6piqX3O2s1jtADQ= +github.com/blevesearch/zapx/v13 v13.1.6 h1:aZGnHA1s8JdthJV0voyvgc1/FLz+gqioCf/9MEdRHjc= +github.com/blevesearch/zapx/v13 v13.1.6/go.mod h1:a2NeLQ8RWumX4T+i1FPAUvVPum/QAEi/beubZzcGJsQ= +github.com/blevesearch/zapx/v14 v14.1.6 h1:ldROClIq0ojQEJOAD1FAGOdFc2ciSAJamseZ3WV3r/Y= +github.com/blevesearch/zapx/v14 v14.1.6/go.mod h1:bANjNZhP3TARU6XM89sLAR/wgOPVyPI6zCkeElHoLlM= +github.com/blevesearch/zapx/v15 v15.1.6 h1:afFzPDlyYFJy9K8aWd7ufktJ8G7kViW+t5GQxYEuNf4= +github.com/blevesearch/zapx/v15 v15.1.6/go.mod h1:PUdibSDSmtQMeQX90o9J7zly2RmNJZXet+tfLFgZwng= 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= @@ -60,8 +56,6 @@ github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99/go.mod h1:wJfORR github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ikawaha/kagome.ipadic v1.1.2 h1:pFxZ1PpMpc6ZoBK712YN5cVK0u/ju2DZ+gRIOriJFFs= -github.com/ikawaha/kagome.ipadic v1.1.2/go.mod h1:DPSBbU0czaJhAb/5uKQZHMc9MTVRpDugJfX+HddPHHg= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= @@ -103,8 +97,6 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/tebeka/snowball v0.4.2 h1:ujvgLOr6IHbsvB2Vgz27IcxWqDrNu9/oPhhe74lN/Kc= -github.com/tebeka/snowball v0.4.2/go.mod h1:4IfL14h1lvwZcp1sfXuuc7/7yCsvVffTWxWxCLfFpYg= github.com/tinylib/msgp v1.1.0 h1:9fQd+ICuRIu/ue4vxJZu6/LzxN0HwMds2nq/0cFvxHU= github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= diff --git a/index/scorch/field_dict_test.go b/index/scorch/field_dict_test.go index f88ffe0e1..e2df21d44 100644 --- a/index/scorch/field_dict_test.go +++ b/index/scorch/field_dict_test.go @@ -62,8 +62,8 @@ func TestIndexFieldDict(t *testing.T) { doc = document.NewDocument("2") doc.AddField(document.NewTextFieldWithAnalyzer("name", []uint64{}, []byte("test test test"), testAnalyzer)) - doc.AddField(document.NewTextFieldCustom("desc", []uint64{}, []byte("eat more rice"), document.IndexField|document.IncludeTermVectors, testAnalyzer)) - doc.AddField(document.NewTextFieldCustom("prefix", []uint64{}, []byte("bob cat cats catting dog doggy zoo"), document.IndexField|document.IncludeTermVectors, testAnalyzer)) + doc.AddField(document.NewTextFieldCustom("desc", []uint64{}, []byte("eat more rice"), index.IndexField|index.IncludeTermVectors, testAnalyzer)) + doc.AddField(document.NewTextFieldCustom("prefix", []uint64{}, []byte("bob cat cats catting dog doggy zoo"), index.IndexField|index.IncludeTermVectors, testAnalyzer)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) diff --git a/index/scorch/reader_test.go b/index/scorch/reader_test.go index 754dc17eb..929a6e8a2 100644 --- a/index/scorch/reader_test.go +++ b/index/scorch/reader_test.go @@ -63,7 +63,7 @@ func TestIndexReader(t *testing.T) { doc = document.NewDocument("2") doc.AddField(document.NewTextFieldWithAnalyzer("name", []uint64{}, []byte("test test test"), testAnalyzer)) - doc.AddField(document.NewTextFieldCustom("desc", []uint64{}, []byte("eat more rice"), document.IndexField|document.IncludeTermVectors, testAnalyzer)) + doc.AddField(document.NewTextFieldCustom("desc", []uint64{}, []byte("eat more rice"), index.IndexField|index.IncludeTermVectors, testAnalyzer)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) @@ -258,7 +258,7 @@ func TestIndexDocIdReader(t *testing.T) { doc = document.NewDocument("2") doc.AddField(document.NewTextField("name", []uint64{}, []byte("test test test"))) - doc.AddField(document.NewTextFieldWithIndexingOptions("desc", []uint64{}, []byte("eat more rice"), document.IndexField|document.IncludeTermVectors)) + doc.AddField(document.NewTextFieldWithIndexingOptions("desc", []uint64{}, []byte("eat more rice"), index.IndexField|index.IncludeTermVectors)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) diff --git a/index/scorch/scorch.go b/index/scorch/scorch.go index e719ed878..7295f714e 100644 --- a/index/scorch/scorch.go +++ b/index/scorch/scorch.go @@ -568,7 +568,7 @@ func (s *Scorch) StatsMap() map[string]interface{} { func analyze(d index.Document) { d.VisitFields(func(field index.Field) { - if field.IsIndexed() { + if field.Options().IsIndexed() { field.Analyze() if d.HasComposite() && field.Name() != "_id" { diff --git a/index/scorch/scorch_test.go b/index/scorch/scorch_test.go index a7215307a..ef8ed1e6e 100644 --- a/index/scorch/scorch_test.go +++ b/index/scorch/scorch_test.go @@ -754,7 +754,7 @@ func TestIndexInsertWithStore(t *testing.T) { } doc := document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), document.IndexField|document.StoreField)) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), index.IndexField|index.StoreField)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) @@ -1141,9 +1141,9 @@ func TestIndexInsertUpdateDeleteWithMultipleTypesStored(t *testing.T) { } doc := document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), document.IndexField|document.StoreField)) - doc.AddField(document.NewNumericFieldWithIndexingOptions("age", []uint64{}, 35.99, document.IndexField|document.StoreField)) - df, err := document.NewDateTimeFieldWithIndexingOptions("unixEpoch", []uint64{}, time.Unix(0, 0), document.IndexField|document.StoreField) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), index.IndexField|index.StoreField)) + doc.AddField(document.NewNumericFieldWithIndexingOptions("age", []uint64{}, 35.99, index.IndexField|index.StoreField)) + df, err := document.NewDateTimeFieldWithIndexingOptions("unixEpoch", []uint64{}, time.Unix(0, 0), index.IndexField|index.StoreField) if err != nil { t.Error(err) } @@ -1233,8 +1233,8 @@ func TestIndexInsertUpdateDeleteWithMultipleTypesStored(t *testing.T) { // now update the document, but omit one of the fields doc = document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("testup"), document.IndexField|document.StoreField)) - doc.AddField(document.NewNumericFieldWithIndexingOptions("age", []uint64{}, 36.99, document.IndexField|document.StoreField)) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("testup"), index.IndexField|index.StoreField)) + doc.AddField(document.NewNumericFieldWithIndexingOptions("age", []uint64{}, 36.99, index.IndexField|index.StoreField)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) @@ -1351,9 +1351,9 @@ func TestIndexInsertFields(t *testing.T) { }() doc := document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), document.IndexField|document.StoreField)) - doc.AddField(document.NewNumericFieldWithIndexingOptions("age", []uint64{}, 35.99, document.IndexField|document.StoreField)) - dateField, err := document.NewDateTimeFieldWithIndexingOptions("unixEpoch", []uint64{}, time.Unix(0, 0), document.IndexField|document.StoreField) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), index.IndexField|index.StoreField)) + doc.AddField(document.NewNumericFieldWithIndexingOptions("age", []uint64{}, 35.99, index.IndexField|index.StoreField)) + dateField, err := document.NewDateTimeFieldWithIndexingOptions("unixEpoch", []uint64{}, time.Unix(0, 0), index.IndexField|index.StoreField) if err != nil { t.Error(err) } @@ -1425,9 +1425,9 @@ func TestIndexUpdateComposites(t *testing.T) { }() doc := document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), document.IndexField|document.StoreField)) - doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister"), document.IndexField|document.StoreField)) - doc.AddField(document.NewCompositeFieldWithIndexingOptions("_all", true, nil, nil, document.IndexField)) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), index.IndexField|index.StoreField)) + doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister"), index.IndexField|index.StoreField)) + doc.AddField(document.NewCompositeFieldWithIndexingOptions("_all", true, nil, nil, index.IndexField)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) @@ -1435,9 +1435,9 @@ func TestIndexUpdateComposites(t *testing.T) { // now lets update it doc = document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("testupdated"), document.IndexField|document.StoreField)) - doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("misterupdated"), document.IndexField|document.StoreField)) - doc.AddField(document.NewCompositeFieldWithIndexingOptions("_all", true, nil, nil, document.IndexField)) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("testupdated"), index.IndexField|index.StoreField)) + doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("misterupdated"), index.IndexField|index.StoreField)) + doc.AddField(document.NewCompositeFieldWithIndexingOptions("_all", true, nil, nil, index.IndexField)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) @@ -1508,9 +1508,9 @@ func TestIndexTermReaderCompositeFields(t *testing.T) { }() doc := document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), document.IndexField|document.StoreField|document.IncludeTermVectors)) - doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister"), document.IndexField|document.StoreField|document.IncludeTermVectors)) - doc.AddField(document.NewCompositeFieldWithIndexingOptions("_all", true, nil, nil, document.IndexField|document.IncludeTermVectors)) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), index.IndexField|index.StoreField|index.IncludeTermVectors)) + doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister"), index.IndexField|index.StoreField|index.IncludeTermVectors)) + doc.AddField(document.NewCompositeFieldWithIndexingOptions("_all", true, nil, nil, index.IndexField|index.IncludeTermVectors)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) @@ -1578,8 +1578,8 @@ func TestIndexDocumentVisitFieldTerms(t *testing.T) { }() doc := document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), document.IndexField|document.StoreField|document.IncludeTermVectors)) - doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister"), document.IndexField|document.StoreField|document.IncludeTermVectors)) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), index.IndexField|index.StoreField|index.IncludeTermVectors)) + doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister"), index.IndexField|index.StoreField|index.IncludeTermVectors)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) @@ -1737,7 +1737,7 @@ func TestConcurrentUpdate(t *testing.T) { wg.Add(1) go func(i int) { doc := document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions(strconv.Itoa(i), []uint64{}, []byte(strconv.Itoa(i)), document.StoreField)) + doc.AddField(document.NewTextFieldWithIndexingOptions(strconv.Itoa(i), []uint64{}, []byte(strconv.Itoa(i)), index.StoreField)) err := idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) @@ -1806,7 +1806,7 @@ func TestLargeField(t *testing.T) { } d := document.NewDocument("large") - f := document.NewTextFieldWithIndexingOptions("desc", nil, largeFieldValue, document.IndexField|document.StoreField) + f := document.NewTextFieldWithIndexingOptions("desc", nil, largeFieldValue, index.IndexField|index.StoreField) d.AddField(f) err = idx.Update(d) @@ -1868,8 +1868,8 @@ func TestIndexDocumentVisitFieldTermsWithMultipleDocs(t *testing.T) { }() doc := document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), document.IndexField|document.StoreField|document.IncludeTermVectors)) - doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister"), document.IndexField|document.StoreField|document.IncludeTermVectors)) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), index.IndexField|index.StoreField|index.IncludeTermVectors)) + doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister"), index.IndexField|index.StoreField|index.IncludeTermVectors)) err = idx.Update(doc) if err != nil { @@ -1905,8 +1905,8 @@ func TestIndexDocumentVisitFieldTermsWithMultipleDocs(t *testing.T) { } doc2 := document.NewDocument("2") - doc2.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test2"), document.IndexField|document.StoreField|document.IncludeTermVectors)) - doc2.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister2"), document.IndexField|document.StoreField|document.IncludeTermVectors)) + doc2.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test2"), index.IndexField|index.StoreField|index.IncludeTermVectors)) + doc2.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister2"), index.IndexField|index.StoreField|index.IncludeTermVectors)) err = idx.Update(doc2) if err != nil { t.Errorf("Error updating index: %v", err) @@ -1940,8 +1940,8 @@ func TestIndexDocumentVisitFieldTermsWithMultipleDocs(t *testing.T) { } doc3 := document.NewDocument("3") - doc3.AddField(document.NewTextFieldWithIndexingOptions("name3", []uint64{}, []byte("test3"), document.IndexField|document.StoreField|document.IncludeTermVectors)) - doc3.AddField(document.NewTextFieldWithIndexingOptions("title3", []uint64{}, []byte("mister3"), document.IndexField|document.StoreField|document.IncludeTermVectors)) + doc3.AddField(document.NewTextFieldWithIndexingOptions("name3", []uint64{}, []byte("test3"), index.IndexField|index.StoreField|index.IncludeTermVectors)) + doc3.AddField(document.NewTextFieldWithIndexingOptions("title3", []uint64{}, []byte("mister3"), index.IndexField|index.StoreField|index.IncludeTermVectors)) err = idx.Update(doc3) if err != nil { t.Errorf("Error updating index: %v", err) @@ -2026,7 +2026,7 @@ func TestIndexDocumentVisitFieldTermsWithMultipleFieldOptions(t *testing.T) { // mix of field options, this exercises the run time/ on the fly un inverting of // doc values for custom options enabled field like designation, dept. - options := document.IndexField | document.StoreField | document.IncludeTermVectors + options := index.IndexField | index.StoreField | index.IncludeTermVectors doc := document.NewDocument("1") doc.AddField(document.NewTextField("name", []uint64{}, []byte("test"))) // default doc value persisted doc.AddField(document.NewTextField("title", []uint64{}, []byte("mister"))) // default doc value persisted diff --git a/index/upsidedown/analysis.go b/index/upsidedown/analysis.go index 2b6727e62..ca877c40b 100644 --- a/index/upsidedown/analysis.go +++ b/index/upsidedown/analysis.go @@ -57,7 +57,7 @@ func (udc *UpsideDownCouch) analyze(d index.Document) *AnalysisResult { } fieldNames[fieldIndex] = field.Name() - if field.IsIndexed() { + if field.Options().IsIndexed() { field.Analyze() fieldLength := field.AnalyzedLength() tokenFreqs := field.AnalyzedTokenFrequencies() @@ -69,10 +69,10 @@ func (udc *UpsideDownCouch) analyze(d index.Document) *AnalysisResult { fieldTermFreqs[fieldIndex] = existingFreqs } fieldLengths[fieldIndex] += fieldLength - fieldIncludeTermVectors[fieldIndex] = field.IncludeTermVectors() + fieldIncludeTermVectors[fieldIndex] = field.Options().IncludeTermVectors() } - if storable && field.IsStored() { + if storable && field.Options().IsStored() { rv.Rows, backIndexStoredEntries = udc.storeField(docIDBytes, field, fieldIndex, rv.Rows, backIndexStoredEntries) } } diff --git a/index/upsidedown/analysis_test.go b/index/upsidedown/analysis_test.go index cc3cc5454..473ac935e 100644 --- a/index/upsidedown/analysis_test.go +++ b/index/upsidedown/analysis_test.go @@ -38,11 +38,11 @@ func TestAnalysisBug328(t *testing.T) { } d := document.NewDocument("1") - f := document.NewTextFieldCustom("title", nil, []byte("bleve"), document.IndexField|document.IncludeTermVectors, analyzer) + f := document.NewTextFieldCustom("title", nil, []byte("bleve"), index.IndexField|index.IncludeTermVectors, analyzer) d.AddField(f) - f = document.NewTextFieldCustom("body", nil, []byte("bleve"), document.IndexField|document.IncludeTermVectors, analyzer) + f = document.NewTextFieldCustom("body", nil, []byte("bleve"), index.IndexField|index.IncludeTermVectors, analyzer) d.AddField(f) - cf := document.NewCompositeFieldWithIndexingOptions("_all", true, []string{}, []string{}, document.IndexField|document.IncludeTermVectors) + cf := document.NewCompositeFieldWithIndexingOptions("_all", true, []string{}, []string{}, index.IndexField|index.IncludeTermVectors) d.AddField(cf) rv := idx.(*UpsideDownCouch).analyze(d) diff --git a/index/upsidedown/dump_test.go b/index/upsidedown/dump_test.go index b773d1426..662acd293 100644 --- a/index/upsidedown/dump_test.go +++ b/index/upsidedown/dump_test.go @@ -66,9 +66,9 @@ func TestDump(t *testing.T) { } doc := document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), document.IndexField|document.StoreField)) - doc.AddField(document.NewNumericFieldWithIndexingOptions("age", []uint64{}, 35.99, document.IndexField|document.StoreField)) - dateField, err := document.NewDateTimeFieldWithIndexingOptions("unixEpoch", []uint64{}, time.Unix(0, 0), document.IndexField|document.StoreField) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), index.IndexField|index.StoreField)) + doc.AddField(document.NewNumericFieldWithIndexingOptions("age", []uint64{}, 35.99, index.IndexField|index.StoreField)) + dateField, err := document.NewDateTimeFieldWithIndexingOptions("unixEpoch", []uint64{}, time.Unix(0, 0), index.IndexField|index.StoreField) if err != nil { t.Error(err) } @@ -79,9 +79,9 @@ func TestDump(t *testing.T) { } doc = document.NewDocument("2") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test2"), document.IndexField|document.StoreField)) - doc.AddField(document.NewNumericFieldWithIndexingOptions("age", []uint64{}, 35.99, document.IndexField|document.StoreField)) - dateField, err = document.NewDateTimeFieldWithIndexingOptions("unixEpoch", []uint64{}, time.Unix(0, 0), document.IndexField|document.StoreField) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test2"), index.IndexField|index.StoreField)) + doc.AddField(document.NewNumericFieldWithIndexingOptions("age", []uint64{}, 35.99, index.IndexField|index.StoreField)) + dateField, err = document.NewDateTimeFieldWithIndexingOptions("unixEpoch", []uint64{}, time.Unix(0, 0), index.IndexField|index.StoreField) if err != nil { t.Error(err) } diff --git a/index/upsidedown/field_dict_test.go b/index/upsidedown/field_dict_test.go index 37ac0ea0c..d2170553e 100644 --- a/index/upsidedown/field_dict_test.go +++ b/index/upsidedown/field_dict_test.go @@ -58,8 +58,8 @@ func TestIndexFieldDict(t *testing.T) { doc = document.NewDocument("2") doc.AddField(document.NewTextFieldWithAnalyzer("name", []uint64{}, []byte("test test test"), testAnalyzer)) - doc.AddField(document.NewTextFieldCustom("desc", []uint64{}, []byte("eat more rice"), document.IndexField|document.IncludeTermVectors, testAnalyzer)) - doc.AddField(document.NewTextFieldCustom("prefix", []uint64{}, []byte("bob cat cats catting dog doggy zoo"), document.IndexField|document.IncludeTermVectors, testAnalyzer)) + doc.AddField(document.NewTextFieldCustom("desc", []uint64{}, []byte("eat more rice"), index.IndexField|index.IncludeTermVectors, testAnalyzer)) + doc.AddField(document.NewTextFieldCustom("prefix", []uint64{}, []byte("bob cat cats catting dog doggy zoo"), index.IndexField|index.IncludeTermVectors, testAnalyzer)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) diff --git a/index/upsidedown/reader_test.go b/index/upsidedown/reader_test.go index 5dcf7df7d..8fd52292d 100644 --- a/index/upsidedown/reader_test.go +++ b/index/upsidedown/reader_test.go @@ -58,7 +58,7 @@ func TestIndexReader(t *testing.T) { doc = document.NewDocument("2") doc.AddField(document.NewTextFieldWithAnalyzer("name", []uint64{}, []byte("test test test"), testAnalyzer)) - doc.AddField(document.NewTextFieldCustom("desc", []uint64{}, []byte("eat more rice"), document.IndexField|document.IncludeTermVectors, testAnalyzer)) + doc.AddField(document.NewTextFieldCustom("desc", []uint64{}, []byte("eat more rice"), index.IndexField|index.IncludeTermVectors, testAnalyzer)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) @@ -233,7 +233,7 @@ func TestIndexDocIdReader(t *testing.T) { doc = document.NewDocument("2") doc.AddField(document.NewTextField("name", []uint64{}, []byte("test test test"))) - doc.AddField(document.NewTextFieldWithIndexingOptions("desc", []uint64{}, []byte("eat more rice"), document.IndexField|document.IncludeTermVectors)) + doc.AddField(document.NewTextFieldWithIndexingOptions("desc", []uint64{}, []byte("eat more rice"), index.IndexField|index.IncludeTermVectors)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) diff --git a/index/upsidedown/upsidedown_test.go b/index/upsidedown/upsidedown_test.go index 37c2ce646..b9f859a45 100644 --- a/index/upsidedown/upsidedown_test.go +++ b/index/upsidedown/upsidedown_test.go @@ -511,7 +511,7 @@ func TestIndexInsertWithStore(t *testing.T) { } doc := document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), document.IndexField|document.StoreField)) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), index.IndexField|index.StoreField)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) @@ -810,9 +810,9 @@ func TestIndexInsertUpdateDeleteWithMultipleTypesStored(t *testing.T) { } doc := document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), document.IndexField|document.StoreField)) - doc.AddField(document.NewNumericFieldWithIndexingOptions("age", []uint64{}, 35.99, document.IndexField|document.StoreField)) - df, err := document.NewDateTimeFieldWithIndexingOptions("unixEpoch", []uint64{}, time.Unix(0, 0), document.IndexField|document.StoreField) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), index.IndexField|index.StoreField)) + doc.AddField(document.NewNumericFieldWithIndexingOptions("age", []uint64{}, 35.99, index.IndexField|index.StoreField)) + df, err := document.NewDateTimeFieldWithIndexingOptions("unixEpoch", []uint64{}, time.Unix(0, 0), index.IndexField|index.StoreField) if err != nil { t.Error(err) } @@ -912,8 +912,8 @@ func TestIndexInsertUpdateDeleteWithMultipleTypesStored(t *testing.T) { // now update the document, but omit one of the fields doc = document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("testup"), document.IndexField|document.StoreField)) - doc.AddField(document.NewNumericFieldWithIndexingOptions("age", []uint64{}, 36.99, document.IndexField|document.StoreField)) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("testup"), index.IndexField|index.StoreField)) + doc.AddField(document.NewNumericFieldWithIndexingOptions("age", []uint64{}, 36.99, index.IndexField|index.StoreField)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) @@ -1015,9 +1015,9 @@ func TestIndexInsertFields(t *testing.T) { }() doc := document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), document.IndexField|document.StoreField)) - doc.AddField(document.NewNumericFieldWithIndexingOptions("age", []uint64{}, 35.99, document.IndexField|document.StoreField)) - dateField, err := document.NewDateTimeFieldWithIndexingOptions("unixEpoch", []uint64{}, time.Unix(0, 0), document.IndexField|document.StoreField) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), index.IndexField|index.StoreField)) + doc.AddField(document.NewNumericFieldWithIndexingOptions("age", []uint64{}, 35.99, index.IndexField|index.StoreField)) + dateField, err := document.NewDateTimeFieldWithIndexingOptions("unixEpoch", []uint64{}, time.Unix(0, 0), index.IndexField|index.StoreField) if err != nil { t.Error(err) } @@ -1075,9 +1075,9 @@ func TestIndexUpdateComposites(t *testing.T) { }() doc := document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), document.IndexField|document.StoreField)) - doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister"), document.IndexField|document.StoreField)) - doc.AddField(document.NewCompositeFieldWithIndexingOptions("_all", true, nil, nil, document.IndexField)) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), index.IndexField|index.StoreField)) + doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister"), index.IndexField|index.StoreField)) + doc.AddField(document.NewCompositeFieldWithIndexingOptions("_all", true, nil, nil, index.IndexField)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) @@ -1101,9 +1101,9 @@ func TestIndexUpdateComposites(t *testing.T) { // now lets update it doc = document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("testupdated"), document.IndexField|document.StoreField)) - doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("misterupdated"), document.IndexField|document.StoreField)) - doc.AddField(document.NewCompositeFieldWithIndexingOptions("_all", true, nil, nil, document.IndexField)) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("testupdated"), index.IndexField|index.StoreField)) + doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("misterupdated"), index.IndexField|index.StoreField)) + doc.AddField(document.NewCompositeFieldWithIndexingOptions("_all", true, nil, nil, index.IndexField)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) @@ -1173,8 +1173,8 @@ func TestIndexFieldsMisc(t *testing.T) { }() doc := document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), document.IndexField|document.StoreField)) - doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister"), document.IndexField|document.StoreField)) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), index.IndexField|index.StoreField)) + doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister"), index.IndexField|index.StoreField)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) @@ -1220,9 +1220,9 @@ func TestIndexTermReaderCompositeFields(t *testing.T) { }() doc := document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), document.IndexField|document.StoreField|document.IncludeTermVectors)) - doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister"), document.IndexField|document.StoreField|document.IncludeTermVectors)) - doc.AddField(document.NewCompositeFieldWithIndexingOptions("_all", true, nil, nil, document.IndexField|document.IncludeTermVectors)) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), index.IndexField|index.StoreField|index.IncludeTermVectors)) + doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister"), index.IndexField|index.StoreField|index.IncludeTermVectors)) + doc.AddField(document.NewCompositeFieldWithIndexingOptions("_all", true, nil, nil, index.IndexField|index.IncludeTermVectors)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) @@ -1281,8 +1281,8 @@ func TestIndexDocumentVisitFieldTerms(t *testing.T) { }() doc := document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), document.IndexField|document.StoreField|document.IncludeTermVectors)) - doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister"), document.IndexField|document.StoreField|document.IncludeTermVectors)) + doc.AddField(document.NewTextFieldWithIndexingOptions("name", []uint64{}, []byte("test"), index.IndexField|index.StoreField|index.IncludeTermVectors)) + doc.AddField(document.NewTextFieldWithIndexingOptions("title", []uint64{}, []byte("mister"), index.IndexField|index.StoreField|index.IncludeTermVectors)) err = idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) @@ -1382,7 +1382,7 @@ func TestConcurrentUpdate(t *testing.T) { wg.Add(1) go func(i int) { doc := document.NewDocument("1") - doc.AddField(document.NewTextFieldWithIndexingOptions(strconv.Itoa(i), []uint64{}, []byte(strconv.Itoa(i)), document.StoreField)) + doc.AddField(document.NewTextFieldWithIndexingOptions(strconv.Itoa(i), []uint64{}, []byte(strconv.Itoa(i)), index.StoreField)) err := idx.Update(doc) if err != nil { t.Errorf("Error updating index: %v", err) @@ -1445,7 +1445,7 @@ func TestLargeField(t *testing.T) { t.Logf("large field size: %d", len(largeFieldValue)) d := document.NewDocument("large") - f := document.NewTextFieldWithIndexingOptions("desc", nil, largeFieldValue, document.IndexField|document.StoreField) + f := document.NewTextFieldWithIndexingOptions("desc", nil, largeFieldValue, index.IndexField|index.StoreField) d.AddField(f) err = idx.Update(d) diff --git a/mapping/field.go b/mapping/field.go index 278faa1a9..3abae8932 100644 --- a/mapping/field.go +++ b/mapping/field.go @@ -17,6 +17,7 @@ package mapping import ( "encoding/json" "fmt" + index "github.com/blevesearch/bleve_index_api" "time" "github.com/blevesearch/bleve/analysis" @@ -150,19 +151,19 @@ func NewGeoPointFieldMapping() *FieldMapping { } // Options returns the indexing options for this field. -func (fm *FieldMapping) Options() document.IndexingOptions { - var rv document.IndexingOptions +func (fm *FieldMapping) Options() index.FieldIndexingOptions { + var rv index.FieldIndexingOptions if fm.Store { - rv |= document.StoreField + rv |= index.StoreField } if fm.Index { - rv |= document.IndexField + rv |= index.IndexField } if fm.IncludeTermVectors { - rv |= document.IncludeTermVectors + rv |= index.IncludeTermVectors } if fm.DocValues { - rv |= document.DocValues + rv |= index.DocValues } return rv } diff --git a/mapping/index.go b/mapping/index.go index 319ba949c..1c9cbdfc1 100644 --- a/mapping/index.go +++ b/mapping/index.go @@ -17,6 +17,7 @@ package mapping import ( "encoding/json" "fmt" + index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/bleve/analysis" "github.com/blevesearch/bleve/analysis/analyzer/standard" @@ -327,7 +328,7 @@ func (im *IndexMappingImpl) MapDocument(doc *document.Document, data interface{} // see if the _all field was disabled allMapping := docMapping.documentMappingForPath("_all") if allMapping == nil || allMapping.Enabled { - field := document.NewCompositeFieldWithIndexingOptions("_all", true, []string{}, walkContext.excludedFromAll, document.IndexField|document.IncludeTermVectors) + field := document.NewCompositeFieldWithIndexingOptions("_all", true, []string{}, walkContext.excludedFromAll, index.IndexField|index.IncludeTermVectors) doc.AddField(field) } } diff --git a/search/searcher/base_test.go b/search/searcher/base_test.go index dea685356..1f1e3ab85 100644 --- a/search/searcher/base_test.go +++ b/search/searcher/base_test.go @@ -82,7 +82,7 @@ var testAnalyzer = &analysis.Analyzer{ } // sets up some mock data used in many tests in this package -var twoDocIndexDescIndexingOptions = document.DefaultTextIndexingOptions | document.IncludeTermVectors +var twoDocIndexDescIndexingOptions = document.DefaultTextIndexingOptions | index.IncludeTermVectors var twoDocIndexDocs = []*document.Document{ // must have 4/4 beer diff --git a/search_test.go b/search_test.go index 98623e1a2..9a3fbd9ec 100644 --- a/search_test.go +++ b/search_test.go @@ -17,6 +17,7 @@ package bleve import ( "encoding/json" "fmt" + index "github.com/blevesearch/bleve_index_api" "reflect" "strconv" "strings" @@ -478,7 +479,7 @@ func TestNestedBooleanSearchers(t *testing.T) { doc := document.NewDocument(strconv.Itoa(i)) doc.Fields = []document.Field{ document.NewTextFieldCustom("hostname", []uint64{}, []byte(hostname), - document.IndexField, + index.IndexField, &analysis.Analyzer{ Tokenizer: single.NewSingleTokenTokenizer(), TokenFilters: []analysis.TokenFilter{ @@ -489,12 +490,12 @@ func TestNestedBooleanSearchers(t *testing.T) { } for k, v := range metadata { doc.AddField(document.NewTextFieldWithIndexingOptions( - fmt.Sprintf("metadata.%s", k), []uint64{}, []byte(v), document.IndexField)) + fmt.Sprintf("metadata.%s", k), []uint64{}, []byte(v), index.IndexField)) } doc.CompositeFields = []*document.CompositeField{ document.NewCompositeFieldWithIndexingOptions( "_all", true, []string{"text"}, []string{}, - document.IndexField|document.IncludeTermVectors), + index.IndexField|index.IncludeTermVectors), } if err = batch.IndexAdvanced(doc); err != nil { @@ -645,7 +646,7 @@ func TestNestedBooleanMustNotSearcherUpsidedown(t *testing.T) { doc.CompositeFields = []*document.CompositeField{ document.NewCompositeFieldWithIndexingOptions( "_all", true, []string{"text"}, []string{}, - document.IndexField|document.IncludeTermVectors), + index.IndexField|index.IncludeTermVectors), } if err = batch.IndexAdvanced(doc); err != nil { @@ -781,7 +782,7 @@ func TestMultipleNestedBooleanMustNotSearchersOnScorch(t *testing.T) { doc.CompositeFields = []*document.CompositeField{ document.NewCompositeFieldWithIndexingOptions( "_all", true, []string{"text"}, []string{}, - document.IndexField|document.IncludeTermVectors), + index.IndexField|index.IncludeTermVectors), } if err = batch.IndexAdvanced(doc); err != nil { @@ -826,7 +827,7 @@ func TestMultipleNestedBooleanMustNotSearchersOnScorch(t *testing.T) { doc.CompositeFields = []*document.CompositeField{ document.NewCompositeFieldWithIndexingOptions( "_all", true, []string{"text"}, []string{}, - document.IndexField|document.IncludeTermVectors), + index.IndexField|index.IncludeTermVectors), } if err = batch.IndexAdvanced(doc); err != nil { @@ -850,7 +851,7 @@ func TestMultipleNestedBooleanMustNotSearchersOnScorch(t *testing.T) { doc.CompositeFields = []*document.CompositeField{ document.NewCompositeFieldWithIndexingOptions( "_all", true, []string{"text"}, []string{}, - document.IndexField|document.IncludeTermVectors), + index.IndexField|index.IncludeTermVectors), } if err = batch.IndexAdvanced(doc); err != nil { @@ -1054,7 +1055,7 @@ func TestDisjunctionQueryIncorrectMin(t *testing.T) { doc.CompositeFields = []*document.CompositeField{ document.NewCompositeFieldWithIndexingOptions( "_all", true, []string{"text"}, []string{}, - document.IndexField|document.IncludeTermVectors), + index.IndexField|index.IncludeTermVectors), } if err = batch.IndexAdvanced(doc); err != nil { t.Fatal(err) diff --git a/test/versus_score_test.go b/test/versus_score_test.go index b0cb4afe1..28be3dd77 100644 --- a/test/versus_score_test.go +++ b/test/versus_score_test.go @@ -16,6 +16,7 @@ package test import ( "fmt" + index "github.com/blevesearch/bleve_index_api" "io/ioutil" "os" "strconv" @@ -99,7 +100,7 @@ func disjunctionQueryiOnIndexWithCompositeFields(indexName string, doc.CompositeFields = []*document.CompositeField{ document.NewCompositeFieldWithIndexingOptions( "_all", true, []string{"field1"}, []string{}, - document.IndexField|document.IncludeTermVectors), + index.IndexField|index.IncludeTermVectors), } if err = batch.IndexAdvanced(doc); err != nil { t.Error(err) From 1af4ca29cc1399b4552797b1d65d7540df80a4d3 Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Fri, 18 Dec 2020 11:15:44 -0500 Subject: [PATCH 19/28] update to work with removed items (#1524) * update to work with removed items * update to latest api --- go.mod | 14 +-- go.sum | 28 +++--- index/scorch/scorch_test.go | 146 ++++++++++++++++++++-------- index/scorch/snapshot_index.go | 25 ----- index/upsidedown/index_reader.go | 4 +- index/upsidedown/upsidedown_test.go | 42 ++++++-- 6 files changed, 161 insertions(+), 98 deletions(-) diff --git a/go.mod b/go.mod index 99a89277e..08312500d 100644 --- a/go.mod +++ b/go.mod @@ -4,17 +4,17 @@ go 1.13 require ( github.com/RoaringBitmap/roaring v0.4.23 - github.com/blevesearch/bleve_index_api v0.0.5 + github.com/blevesearch/bleve_index_api v0.0.6 github.com/blevesearch/go-porterstemmer v1.0.3 - github.com/blevesearch/scorch_segment_api v0.0.7 + github.com/blevesearch/scorch_segment_api v0.0.8 github.com/blevesearch/segment v0.9.0 github.com/blevesearch/snowballstem v0.9.0 github.com/blevesearch/upsidedown_store_api v0.0.1 - github.com/blevesearch/zapx/v11 v11.1.6 - github.com/blevesearch/zapx/v12 v12.1.6 - github.com/blevesearch/zapx/v13 v13.1.6 - github.com/blevesearch/zapx/v14 v14.1.6 - github.com/blevesearch/zapx/v15 v15.1.6 + github.com/blevesearch/zapx/v11 v11.1.7 + github.com/blevesearch/zapx/v12 v12.1.7 + github.com/blevesearch/zapx/v13 v13.1.7 + github.com/blevesearch/zapx/v14 v14.1.7 + github.com/blevesearch/zapx/v15 v15.1.7 github.com/couchbase/moss v0.1.0 github.com/couchbase/vellum v1.0.2 github.com/golang/protobuf v1.3.2 diff --git a/go.sum b/go.sum index 763ff002f..e4a6245e2 100644 --- a/go.sum +++ b/go.sum @@ -2,30 +2,30 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/RoaringBitmap/roaring v0.4.23 h1:gpyfd12QohbqhFO4NVDUdoPOCXsyahYRQhINmlHxKeo= github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/blevesearch/bleve_index_api v0.0.5 h1:LdL97X6ZwbCf1FSo6xe5eqT92MDb4X7s2j1chAKRpuY= -github.com/blevesearch/bleve_index_api v0.0.5/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= +github.com/blevesearch/bleve_index_api v0.0.6 h1:/SO0BsZYqFchE8Jo3uzQd2tRjB9GG+A92l478OHs0J4= +github.com/blevesearch/bleve_index_api v0.0.6/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo= github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M= github.com/blevesearch/mmap-go v1.0.2 h1:JtMHb+FgQCTTYIhtMvimw15dJwu1Y5lrZDMOFXVWPk0= github.com/blevesearch/mmap-go v1.0.2/go.mod h1:ol2qBqYaOUsGdm7aRMRrYGgPvnwLe6Y+7LMvAB5IbSA= -github.com/blevesearch/scorch_segment_api v0.0.7 h1:X6eGntic+71Gv77wQnzD2kOWyhEvxQ0x/El6X+NVKaE= -github.com/blevesearch/scorch_segment_api v0.0.7/go.mod h1:gZhO+qjyJ/u0qho9GuhHXtdtT3hpveyA4DfUU9W+kco= +github.com/blevesearch/scorch_segment_api v0.0.8 h1:Pu1Gdsm6Ji/eF/6mDvASE/oxOXlmHWGIuarvW8Mq19I= +github.com/blevesearch/scorch_segment_api v0.0.8/go.mod h1:TSv8hjSTapWb2JzOFza/e0pj69iJqjW//skNdO7wKtA= github.com/blevesearch/segment v0.9.0 h1:5lG7yBCx98or7gK2cHMKPukPZ/31Kag7nONpoBt22Ac= github.com/blevesearch/segment v0.9.0/go.mod h1:9PfHYUdQCgHktBgvtUOF4x+pc4/l8rdH0u5spnW85UQ= github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s= github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs= github.com/blevesearch/upsidedown_store_api v0.0.1 h1:cf3YQ6c3jvZ/gvHL6k71cshDG+nYTgL5PTWFqYXA3bg= github.com/blevesearch/upsidedown_store_api v0.0.1/go.mod h1:jRZGTYWNqHXvOOjvT0WXHYO5Yin7U/PmTX1nevIY8yo= -github.com/blevesearch/zapx/v11 v11.1.6 h1:8eqdDbWWNX99RS9byGVTiTXrBKfHYdp/XDi5JxWMYrU= -github.com/blevesearch/zapx/v11 v11.1.6/go.mod h1:yKP1ax+HWGb5+Z8SSQ3kRbxJRsJv18tBoap5OWT3nzc= -github.com/blevesearch/zapx/v12 v12.1.6 h1:mce/asG9ov5U3mNiYyLmadJVclDPntd5VLxpTo6Y8bA= -github.com/blevesearch/zapx/v12 v12.1.6/go.mod h1:H/RCE6zfjWofAtniY7qrKFDHB7Kb6piqX3O2s1jtADQ= -github.com/blevesearch/zapx/v13 v13.1.6 h1:aZGnHA1s8JdthJV0voyvgc1/FLz+gqioCf/9MEdRHjc= -github.com/blevesearch/zapx/v13 v13.1.6/go.mod h1:a2NeLQ8RWumX4T+i1FPAUvVPum/QAEi/beubZzcGJsQ= -github.com/blevesearch/zapx/v14 v14.1.6 h1:ldROClIq0ojQEJOAD1FAGOdFc2ciSAJamseZ3WV3r/Y= -github.com/blevesearch/zapx/v14 v14.1.6/go.mod h1:bANjNZhP3TARU6XM89sLAR/wgOPVyPI6zCkeElHoLlM= -github.com/blevesearch/zapx/v15 v15.1.6 h1:afFzPDlyYFJy9K8aWd7ufktJ8G7kViW+t5GQxYEuNf4= -github.com/blevesearch/zapx/v15 v15.1.6/go.mod h1:PUdibSDSmtQMeQX90o9J7zly2RmNJZXet+tfLFgZwng= +github.com/blevesearch/zapx/v11 v11.1.7 h1:C8uGUh2h2xV/gnKsKpOx2MsTwYNwvmF8kOtXZX6Y41A= +github.com/blevesearch/zapx/v11 v11.1.7/go.mod h1:Q1xcy9nqgHv6OK4eYB0dshz3AHcNF0Bjy1O30PiRSFg= +github.com/blevesearch/zapx/v12 v12.1.7 h1:v00j2bDIuNUBtwE1t3eAqkz/A0ulZiaRU9p1BIpaHFc= +github.com/blevesearch/zapx/v12 v12.1.7/go.mod h1:Ul1X/7u8bKCQcWulvQFfskQmoKN/0WES/RVYXRBBBCc= +github.com/blevesearch/zapx/v13 v13.1.7 h1:LUuPjZLoMtJcTUbIHopCqZayQvXr5+Yfj0GJofByYYM= +github.com/blevesearch/zapx/v13 v13.1.7/go.mod h1:v4f+OOMI2kidBNxOnnWUVYhekCcMAj83BwV1NsaKUac= +github.com/blevesearch/zapx/v14 v14.1.7 h1:MXNNoR+gFl4+3kBU4aS36X7jDPX+qW4mYqjJOpSsa+k= +github.com/blevesearch/zapx/v14 v14.1.7/go.mod h1:apL2HuP6COJVPCtEhKa4u70fVOW8WLx8otcjn38xIpw= +github.com/blevesearch/zapx/v15 v15.1.7 h1:cSCV+fGtN4TIv+YkEqQigcy2UHT3cq+jLL8htGAXhT0= +github.com/blevesearch/zapx/v15 v15.1.7/go.mod h1:dO2Mp8wt/hMl6IEKc0i8BG2SXKPnPKwOPQKEkax6mes= 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= diff --git a/index/scorch/scorch_test.go b/index/scorch/scorch_test.go index ef8ed1e6e..4fd915550 100644 --- a/index/scorch/scorch_test.go +++ b/index/scorch/scorch_test.go @@ -1548,7 +1548,7 @@ func TestIndexTermReaderCompositeFields(t *testing.T) { } } -func TestIndexDocumentVisitFieldTerms(t *testing.T) { +func TestIndexDocValueReader(t *testing.T) { cfg := CreateConfig("TestIndexDocumentVisitFieldTerms") err := InitTest(cfg) if err != nil { @@ -1596,29 +1596,34 @@ func TestIndexDocumentVisitFieldTerms(t *testing.T) { } }() - fieldTerms := make(index.FieldTerms) + actualFieldTerms := make(fieldTerms) internalID, err := indexReader.InternalID("1") if err != nil { t.Fatal(err) } - err = indexReader.DocumentVisitFieldTerms(internalID, []string{"name", "title"}, func(field string, term []byte) { - fieldTerms[field] = append(fieldTerms[field], string(term)) + dvr, err := indexReader.DocValueReader([]string{"name", "title"}) + if err != nil { + t.Error(err) + } + + err = dvr.VisitDocValues(internalID, func(field string, term []byte) { + actualFieldTerms[field] = append(actualFieldTerms[field], string(term)) }) if err != nil { t.Error(err) } - expectedFieldTerms := index.FieldTerms{ + expectedFieldTerms := fieldTerms{ "name": []string{"test"}, "title": []string{"mister"}, } - if !reflect.DeepEqual(fieldTerms, expectedFieldTerms) { - t.Errorf("expected field terms: %#v, got: %#v", expectedFieldTerms, fieldTerms) + if !reflect.DeepEqual(actualFieldTerms, expectedFieldTerms) { + t.Errorf("expected field terms: %#v, got: %#v", expectedFieldTerms, actualFieldTerms) } } -func TestFieldTermsConcurrent(t *testing.T) { +func TestDocValueReaderConcurrent(t *testing.T) { cfg := CreateConfig("TestFieldTermsConcurrent") // setting path to empty string disables persistence/merging @@ -1689,9 +1694,11 @@ func TestFieldTermsConcurrent(t *testing.T) { if err != nil { t.Fatal(err) } - err = r.DocumentVisitFieldTerms(docNumber, - []string{fmt.Sprintf("f%d", rand.Intn(100))}, - func(field string, term []byte) {}) + dvr, err := r.DocValueReader([]string{fmt.Sprintf("f%d", rand.Intn(100))}) + if err != nil { + t.Fatal(err) + } + err = dvr.VisitDocValues(docNumber, func(field string, term []byte) {}) if err != nil { t.Fatal(err) } @@ -1838,7 +1845,7 @@ Mechanism[edit] This section needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. (July 2013) There are three characteristics of liquids which are relevant to the discussion of a BLEVE:`) -func TestIndexDocumentVisitFieldTermsWithMultipleDocs(t *testing.T) { +func TestIndexDocValueReaderWithMultipleDocs(t *testing.T) { cfg := CreateConfig("TestIndexDocumentVisitFieldTermsWithMultipleDocs") err := InitTest(cfg) if err != nil { @@ -1881,23 +1888,29 @@ func TestIndexDocumentVisitFieldTermsWithMultipleDocs(t *testing.T) { t.Error(err) } - fieldTerms := make(index.FieldTerms) + actualFieldTerms := make(fieldTerms) docNumber, err := indexReader.InternalID("1") if err != nil { t.Fatal(err) } - err = indexReader.DocumentVisitFieldTerms(docNumber, []string{"name", "title"}, func(field string, term []byte) { - fieldTerms[field] = append(fieldTerms[field], string(term)) + + dvr, err := indexReader.DocValueReader([]string{"name", "title"}) + if err != nil { + t.Fatal(err) + } + + err = dvr.VisitDocValues(docNumber, func(field string, term []byte) { + actualFieldTerms[field] = append(actualFieldTerms[field], string(term)) }) if err != nil { t.Error(err) } - expectedFieldTerms := index.FieldTerms{ + expectedFieldTerms := fieldTerms{ "name": []string{"test"}, "title": []string{"mister"}, } - if !reflect.DeepEqual(fieldTerms, expectedFieldTerms) { - t.Errorf("expected field terms: %#v, got: %#v", expectedFieldTerms, fieldTerms) + if !reflect.DeepEqual(actualFieldTerms, expectedFieldTerms) { + t.Errorf("expected field terms: %#v, got: %#v", expectedFieldTerms, actualFieldTerms) } err = indexReader.Close() if err != nil { @@ -1916,23 +1929,29 @@ func TestIndexDocumentVisitFieldTermsWithMultipleDocs(t *testing.T) { t.Error(err) } - fieldTerms = make(index.FieldTerms) + actualFieldTerms = make(fieldTerms) docNumber, err = indexReader.InternalID("2") if err != nil { t.Fatal(err) } - err = indexReader.DocumentVisitFieldTerms(docNumber, []string{"name", "title"}, func(field string, term []byte) { - fieldTerms[field] = append(fieldTerms[field], string(term)) + + dvr, err = indexReader.DocValueReader([]string{"name", "title"}) + if err != nil { + t.Fatal(err) + } + + err = dvr.VisitDocValues(docNumber, func(field string, term []byte) { + actualFieldTerms[field] = append(actualFieldTerms[field], string(term)) }) if err != nil { t.Error(err) } - expectedFieldTerms = index.FieldTerms{ + expectedFieldTerms = fieldTerms{ "name": []string{"test2"}, "title": []string{"mister2"}, } - if !reflect.DeepEqual(fieldTerms, expectedFieldTerms) { - t.Errorf("expected field terms: %#v, got: %#v", expectedFieldTerms, fieldTerms) + if !reflect.DeepEqual(actualFieldTerms, expectedFieldTerms) { + t.Errorf("expected field terms: %#v, got: %#v", expectedFieldTerms, actualFieldTerms) } err = indexReader.Close() if err != nil { @@ -1951,42 +1970,54 @@ func TestIndexDocumentVisitFieldTermsWithMultipleDocs(t *testing.T) { t.Error(err) } - fieldTerms = make(index.FieldTerms) + actualFieldTerms = make(fieldTerms) docNumber, err = indexReader.InternalID("3") if err != nil { t.Fatal(err) } - err = indexReader.DocumentVisitFieldTerms(docNumber, []string{"name3", "title3"}, func(field string, term []byte) { - fieldTerms[field] = append(fieldTerms[field], string(term)) + + dvr, err = indexReader.DocValueReader([]string{"name3", "title3"}) + if err != nil { + t.Fatal(err) + } + + err = dvr.VisitDocValues(docNumber, func(field string, term []byte) { + actualFieldTerms[field] = append(actualFieldTerms[field], string(term)) }) if err != nil { t.Error(err) } - expectedFieldTerms = index.FieldTerms{ + expectedFieldTerms = fieldTerms{ "name3": []string{"test3"}, "title3": []string{"mister3"}, } - if !reflect.DeepEqual(fieldTerms, expectedFieldTerms) { - t.Errorf("expected field terms: %#v, got: %#v", expectedFieldTerms, fieldTerms) + if !reflect.DeepEqual(actualFieldTerms, expectedFieldTerms) { + t.Errorf("expected field terms: %#v, got: %#v", expectedFieldTerms, actualFieldTerms) } - fieldTerms = make(index.FieldTerms) + actualFieldTerms = make(fieldTerms) docNumber, err = indexReader.InternalID("1") if err != nil { t.Fatal(err) } - err = indexReader.DocumentVisitFieldTerms(docNumber, []string{"name", "title"}, func(field string, term []byte) { - fieldTerms[field] = append(fieldTerms[field], string(term)) + + dvr, err = indexReader.DocValueReader([]string{"name", "title"}) + if err != nil { + t.Fatal(err) + } + + err = dvr.VisitDocValues(docNumber, func(field string, term []byte) { + actualFieldTerms[field] = append(actualFieldTerms[field], string(term)) }) if err != nil { t.Error(err) } - expectedFieldTerms = index.FieldTerms{ + expectedFieldTerms = fieldTerms{ "name": []string{"test"}, "title": []string{"mister"}, } - if !reflect.DeepEqual(fieldTerms, expectedFieldTerms) { - t.Errorf("expected field terms: %#v, got: %#v", expectedFieldTerms, fieldTerms) + if !reflect.DeepEqual(actualFieldTerms, expectedFieldTerms) { + t.Errorf("expected field terms: %#v, got: %#v", expectedFieldTerms, actualFieldTerms) } err = indexReader.Close() if err != nil { @@ -1995,7 +2026,7 @@ func TestIndexDocumentVisitFieldTermsWithMultipleDocs(t *testing.T) { } -func TestIndexDocumentVisitFieldTermsWithMultipleFieldOptions(t *testing.T) { +func TestIndexDocValueReaderWithMultipleFieldOptions(t *testing.T) { cfg := CreateConfig("TestIndexDocumentVisitFieldTermsWithMultipleFieldOptions") err := InitTest(cfg) if err != nil { @@ -2043,24 +2074,30 @@ func TestIndexDocumentVisitFieldTermsWithMultipleFieldOptions(t *testing.T) { t.Error(err) } - fieldTerms := make(index.FieldTerms) + actualFieldTerms := make(fieldTerms) docNumber, err := indexReader.InternalID("1") if err != nil { t.Fatal(err) } - err = indexReader.DocumentVisitFieldTerms(docNumber, []string{"name", "designation", "dept"}, func(field string, term []byte) { - fieldTerms[field] = append(fieldTerms[field], string(term)) + + dvr, err := indexReader.DocValueReader([]string{"name", "designation", "dept"}) + if err != nil { + t.Fatal(err) + } + + err = dvr.VisitDocValues(docNumber, func(field string, term []byte) { + actualFieldTerms[field] = append(actualFieldTerms[field], string(term)) }) if err != nil { t.Error(err) } - expectedFieldTerms := index.FieldTerms{ + expectedFieldTerms := fieldTerms{ "name": []string{"test"}, "designation": []string{"engineer"}, "dept": []string{"bleve"}, } - if !reflect.DeepEqual(fieldTerms, expectedFieldTerms) { - t.Errorf("expected field terms: %#v, got: %#v", expectedFieldTerms, fieldTerms) + if !reflect.DeepEqual(actualFieldTerms, expectedFieldTerms) { + t.Errorf("expected field terms: %#v, got: %#v", expectedFieldTerms, actualFieldTerms) } err = indexReader.Close() if err != nil { @@ -2474,3 +2511,26 @@ func TestIndexSeekBackwardsStats(t *testing.T) { idx.(*Scorch).stats.TotTermSearchersFinished) } } + +// fieldTerms contains the terms used by a document, keyed by field +type fieldTerms map[string][]string + +// FieldsNotYetCached returns a list of fields not yet cached out of a larger list of fields +func (f fieldTerms) FieldsNotYetCached(fields []string) []string { + rv := make([]string, 0, len(fields)) + for _, field := range fields { + if _, ok := f[field]; !ok { + rv = append(rv, field) + } + } + return rv +} + +// Merge will combine two fieldTerms +// it assumes that the terms lists are complete (thus do not need to be merged) +// field terms from the other list always replace the ones in the receiver +func (f fieldTerms) Merge(other fieldTerms) { + for field, terms := range other { + f[field] = terms + } +} \ No newline at end of file diff --git a/index/scorch/snapshot_index.go b/index/scorch/snapshot_index.go index 9e10c6ef7..77abb7b7c 100644 --- a/index/scorch/snapshot_index.go +++ b/index/scorch/snapshot_index.go @@ -597,31 +597,6 @@ func docInternalToNumber(in index.IndexInternalID) (uint64, error) { return binary.BigEndian.Uint64(in), nil } -func (i *IndexSnapshot) DocumentVisitFieldTerms(id index.IndexInternalID, - fields []string, visitor index.DocumentFieldTermVisitor) error { - _, err := i.documentVisitFieldTerms(id, fields, visitor, nil) - return err -} - -func (i *IndexSnapshot) documentVisitFieldTerms(id index.IndexInternalID, - fields []string, visitor index.DocumentFieldTermVisitor, - dvs segment.DocVisitState) (segment.DocVisitState, error) { - docNum, err := docInternalToNumber(id) - if err != nil { - return nil, err - } - - segmentIndex, localDocNum := i.segmentIndexAndLocalDocNumFromGlobal(docNum) - if segmentIndex >= len(i.segment) { - return nil, nil - } - - _, dvs, err = i.documentVisitFieldTermsOnSegment( - segmentIndex, localDocNum, fields, nil, visitor, dvs) - - return dvs, err -} - func (i *IndexSnapshot) documentVisitFieldTermsOnSegment( segmentIndex int, localDocNum uint64, fields []string, cFields []string, visitor index.DocumentFieldTermVisitor, dvs segment.DocVisitState) ( diff --git a/index/upsidedown/index_reader.go b/index/upsidedown/index_reader.go index 23ad24207..a6c1669b7 100644 --- a/index/upsidedown/index_reader.go +++ b/index/upsidedown/index_reader.go @@ -109,7 +109,7 @@ func (i *IndexReader) Document(id string) (doc index.Document, err error) { return rvd, nil } -func (i *IndexReader) DocumentVisitFieldTerms(id index.IndexInternalID, fields []string, visitor index.DocumentFieldTermVisitor) error { +func (i *IndexReader) documentVisitFieldTerms(id index.IndexInternalID, fields []string, visitor index.DocumentFieldTermVisitor) error { fieldsMap := make(map[uint16]string, len(fields)) for _, f := range fields { id, ok := i.index.fieldCache.FieldNamed(f, false) @@ -221,5 +221,5 @@ type DocValueReader struct { func (dvr *DocValueReader) VisitDocValues(id index.IndexInternalID, visitor index.DocumentFieldTermVisitor) error { - return dvr.i.DocumentVisitFieldTerms(id, dvr.fields, visitor) + return dvr.i.documentVisitFieldTerms(id, dvr.fields, visitor) } diff --git a/index/upsidedown/upsidedown_test.go b/index/upsidedown/upsidedown_test.go index b9f859a45..f2a829273 100644 --- a/index/upsidedown/upsidedown_test.go +++ b/index/upsidedown/upsidedown_test.go @@ -1256,7 +1256,7 @@ func TestIndexTermReaderCompositeFields(t *testing.T) { } } -func TestIndexDocumentVisitFieldTerms(t *testing.T) { +func TestIndexDocValueReader(t *testing.T) { defer func() { err := DestroyTest() if err != nil { @@ -1299,20 +1299,25 @@ func TestIndexDocumentVisitFieldTerms(t *testing.T) { } }() - fieldTerms := make(index.FieldTerms) + actualFieldTerms := make(fieldTerms) - err = indexReader.DocumentVisitFieldTerms(index.IndexInternalID("1"), []string{"name", "title"}, func(field string, term []byte) { - fieldTerms[field] = append(fieldTerms[field], string(term)) + dvr, err := indexReader.DocValueReader([]string{"name", "title"}) + if err != nil { + t.Error(err) + } + + err = dvr.VisitDocValues(index.IndexInternalID("1"), func(field string, term []byte) { + actualFieldTerms[field] = append(actualFieldTerms[field], string(term)) }) if err != nil { t.Error(err) } - expectedFieldTerms := index.FieldTerms{ + expectedFieldTerms := fieldTerms{ "name": []string{"test"}, "title": []string{"mister"}, } - if !reflect.DeepEqual(fieldTerms, expectedFieldTerms) { - t.Errorf("expected field terms: %#v, got: %#v", expectedFieldTerms, fieldTerms) + if !reflect.DeepEqual(actualFieldTerms, expectedFieldTerms) { + t.Errorf("expected field terms: %#v, got: %#v", expectedFieldTerms, actualFieldTerms) } } @@ -1498,3 +1503,26 @@ func TestIndexBatchPersistedCallbackWithErrorUpsideDown(t *testing.T) { } } + +// fieldTerms contains the terms used by a document, keyed by field +type fieldTerms map[string][]string + +// FieldsNotYetCached returns a list of fields not yet cached out of a larger list of fields +func (f fieldTerms) FieldsNotYetCached(fields []string) []string { + rv := make([]string, 0, len(fields)) + for _, field := range fields { + if _, ok := f[field]; !ok { + rv = append(rv, field) + } + } + return rv +} + +// Merge will combine two fieldTerms +// it assumes that the terms lists are complete (thus do not need to be merged) +// field terms from the other list always replace the ones in the receiver +func (f fieldTerms) Merge(other fieldTerms) { + for field, terms := range other { + f[field] = terms + } +} \ No newline at end of file From 3f652167550b68cf5d9fe7861523a005ddeac722 Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Fri, 18 Dec 2020 11:24:31 -0500 Subject: [PATCH 20/28] do not type assert on document or field (#1525) instead use the interface exposed by index api --- document/field_text.go | 4 + http/doc_get.go | 30 ++--- index_impl.go | 12 +- index_test.go | 116 ++++++++---------- mapping/mapping_test.go | 5 +- .../highlighter/simple/highlighter_simple.go | 3 +- 6 files changed, 79 insertions(+), 91 deletions(-) diff --git a/document/field_text.go b/document/field_text.go index 876d5a634..b2f8a0103 100644 --- a/document/field_text.go +++ b/document/field_text.go @@ -108,6 +108,10 @@ func (t *TextField) Value() []byte { return t.value } +func (t *TextField) Text() string { + return string(t.value) +} + func (t *TextField) GoString() string { return fmt.Sprintf("&document.TextField{Name:%s, Options: %s, Analyzer: %v, Value: %s, ArrayPositions: %v}", t.name, t.options, t.analyzer, t.value, t.arrayPositions) } diff --git a/http/doc_get.go b/http/doc_get.go index f9bc93837..6115433cd 100644 --- a/http/doc_get.go +++ b/http/doc_get.go @@ -16,10 +16,9 @@ package http import ( "fmt" + index "github.com/blevesearch/bleve_index_api" "net/http" "time" - - "github.com/blevesearch/bleve/document" ) type DocGetHandler struct { @@ -43,8 +42,8 @@ func (h *DocGetHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { if indexName == "" { indexName = h.defaultIndexName } - index := IndexByName(indexName) - if index == nil { + idx := IndexByName(indexName) + if idx == nil { showError(w, req, fmt.Sprintf("no such index '%s'", indexName), 404) return } @@ -59,21 +58,15 @@ func (h *DocGetHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - docInt, err := index.Document(docID) + doc, err := idx.Document(docID) if err != nil { showError(w, req, fmt.Sprintf("error deleting document '%s': %v", docID, err), 500) return } - if docInt == nil { + if doc == nil { showError(w, req, fmt.Sprintf("no such document '%s'", docID), 404) return } - doc, ok := docInt.(*document.Document) - if !ok { - showError(w, req, fmt.Sprintf("unexpected document type: %T", doc), 500) - return - - } rv := struct { ID string `json:"id"` @@ -82,17 +75,18 @@ func (h *DocGetHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { ID: docID, Fields: map[string]interface{}{}, } - for _, field := range doc.Fields { + + doc.VisitFields(func(field index.Field) { var newval interface{} switch field := field.(type) { - case *document.TextField: - newval = string(field.Value()) - case *document.NumericField: + case index.TextField: + newval = field.Text() + case index.NumericField: n, err := field.Number() if err == nil { newval = n } - case *document.DateTimeField: + case index.DateTimeField: d, err := field.DateTime() if err == nil { newval = d.Format(time.RFC3339Nano) @@ -112,7 +106,7 @@ func (h *DocGetHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { } else { rv.Fields[field.Name()] = newval } - } + }) mustEncode(w, rv) } diff --git a/index_impl.go b/index_impl.go index 75cc07a70..497329622 100644 --- a/index_impl.go +++ b/index_impl.go @@ -609,24 +609,24 @@ func LoadAndHighlightFields(hit *search.DocumentMatch, req *SearchRequest, if f == "*" || docF.Name() == f { var value interface{} switch docF := docF.(type) { - case *document.TextField: - value = string(docF.Value()) - case *document.NumericField: + case index.TextField: + value = docF.Text() + case index.NumericField: num, err := docF.Number() if err == nil { value = num } - case *document.DateTimeField: + case index.DateTimeField: datetime, err := docF.DateTime() if err == nil { value = datetime.Format(time.RFC3339) } - case *document.BooleanField: + case index.BooleanField: boolean, err := docF.Boolean() if err == nil { value = boolean } - case *document.GeoPointField: + case index.GeoPointField: lon, err := docF.Lon() if err == nil { lat, err := docF.Lat() diff --git a/index_test.go b/index_test.go index 2261c1e70..23e9d62dd 100644 --- a/index_test.go +++ b/index_test.go @@ -67,7 +67,7 @@ func TestCrud(t *testing.T) { tmpIndexPath := createTmpIndexPath(t) defer cleanupTmpIndexPath(t, tmpIndexPath) - index, err := New(tmpIndexPath, NewIndexMapping()) + idx, err := New(tmpIndexPath, NewIndexMapping()) if err != nil { t.Fatal(err) } @@ -76,7 +76,7 @@ func TestCrud(t *testing.T) { "name": "marty", "desc": "gophercon india", } - err = index.Index("a", doca) + err = idx.Index("a", doca) if err != nil { t.Error(err) } @@ -85,12 +85,12 @@ func TestCrud(t *testing.T) { "name": "jasper", "desc": "clojure", } - err = index.Index("y", docy) + err = idx.Index("y", docy) if err != nil { t.Error(err) } - err = index.Delete("y") + err = idx.Delete("y") if err != nil { t.Error(err) } @@ -99,12 +99,12 @@ func TestCrud(t *testing.T) { "name": "rose", "desc": "googler", } - err = index.Index("x", docx) + err = idx.Index("x", docx) if err != nil { t.Error(err) } - err = index.SetInternal([]byte("status"), []byte("pending")) + err = idx.SetInternal([]byte("status"), []byte("pending")) if err != nil { t.Error(err) } @@ -113,7 +113,7 @@ func TestCrud(t *testing.T) { "name": "steve", "desc": "cbft master", } - batch := index.NewBatch() + batch := idx.NewBatch() err = batch.Index("b", docb) if err != nil { t.Error(err) @@ -121,18 +121,18 @@ func TestCrud(t *testing.T) { batch.Delete("x") batch.SetInternal([]byte("batchi"), []byte("batchv")) batch.DeleteInternal([]byte("status")) - err = index.Batch(batch) + err = idx.Batch(batch) if err != nil { t.Error(err) } - val, err := index.GetInternal([]byte("batchi")) + val, err := idx.GetInternal([]byte("batchi")) if err != nil { t.Error(err) } if string(val) != "batchv" { t.Errorf("expected 'batchv', got '%s'", val) } - val, err = index.GetInternal([]byte("status")) + val, err = idx.GetInternal([]byte("status")) if err != nil { t.Error(err) } @@ -140,19 +140,19 @@ func TestCrud(t *testing.T) { t.Errorf("expected nil, got '%s'", val) } - err = index.SetInternal([]byte("seqno"), []byte("7")) + err = idx.SetInternal([]byte("seqno"), []byte("7")) if err != nil { t.Error(err) } - err = index.SetInternal([]byte("status"), []byte("ready")) + err = idx.SetInternal([]byte("status"), []byte("ready")) if err != nil { t.Error(err) } - err = index.DeleteInternal([]byte("status")) + err = idx.DeleteInternal([]byte("status")) if err != nil { t.Error(err) } - val, err = index.GetInternal([]byte("status")) + val, err = idx.GetInternal([]byte("status")) if err != nil { t.Error(err) } @@ -160,7 +160,7 @@ func TestCrud(t *testing.T) { t.Errorf("expected nil, got '%s'", val) } - val, err = index.GetInternal([]byte("seqno")) + val, err = idx.GetInternal([]byte("seqno")) if err != nil { t.Error(err) } @@ -169,23 +169,23 @@ func TestCrud(t *testing.T) { } // close the index, open it again, and try some more things - err = index.Close() + err = idx.Close() if err != nil { t.Fatal(err) } - index, err = Open(tmpIndexPath) + idx, err = Open(tmpIndexPath) if err != nil { t.Fatal(err) } defer func() { - err := index.Close() + err := idx.Close() if err != nil { t.Fatal(err) } }() - count, err := index.DocCount() + count, err := idx.DocCount() if err != nil { t.Fatal(err) } @@ -193,25 +193,21 @@ func TestCrud(t *testing.T) { t.Errorf("expected doc count 2, got %d", count) } - docInt, err := index.Document("a") + doc, err := idx.Document("a") if err != nil { t.Fatal(err) } - doc := docInt.(*document.Document) - if doc == nil { - t.Errorf("expected doc not nil, got nil") - } foundNameField := false - for _, field := range doc.Fields { + doc.VisitFields(func(field index.Field) { if field.Name() == "name" && string(field.Value()) == "marty" { foundNameField = true } - } + }) if !foundNameField { t.Errorf("expected to find field named 'name' with value 'marty'") } - fields, err := index.Fields() + fields, err := idx.Fields() if err != nil { t.Fatal(err) } @@ -857,13 +853,13 @@ func TestDocumentFieldArrayPositions(t *testing.T) { tmpIndexPath := createTmpIndexPath(t) defer cleanupTmpIndexPath(t, tmpIndexPath) - index, err := New(tmpIndexPath, NewIndexMapping()) + idx, err := New(tmpIndexPath, NewIndexMapping()) if err != nil { t.Fatal(err) } // index a document with an array of strings - err = index.Index("k", struct { + err = idx.Index("k", struct { Messages []string }{ Messages: []string{ @@ -878,18 +874,17 @@ func TestDocumentFieldArrayPositions(t *testing.T) { } // load the document - docInt, err := index.Document("k") + doc, err := idx.Document("k") if err != nil { t.Fatal(err) } - doc := docInt.(*document.Document) - for _, f := range doc.Fields { + doc.VisitFields(func(f index.Field) { if reflect.DeepEqual(f.Value(), []byte("first")) { ap := f.ArrayPositions() if len(ap) < 1 { t.Errorf("expected an array position, got none") - continue + return } if ap[0] != 0 { t.Errorf("expected 'first' in array position 0, got %d", ap[0]) @@ -899,7 +894,7 @@ func TestDocumentFieldArrayPositions(t *testing.T) { ap := f.ArrayPositions() if len(ap) < 1 { t.Errorf("expected an array position, got none") - continue + return } if ap[0] != 1 { t.Errorf("expected 'second' in array position 1, got %d", ap[0]) @@ -909,7 +904,7 @@ func TestDocumentFieldArrayPositions(t *testing.T) { ap := f.ArrayPositions() if len(ap) < 1 { t.Errorf("expected an array position, got none") - continue + return } if ap[0] != 2 { t.Errorf("expected 'third' in array position 2, got %d", ap[0]) @@ -919,16 +914,16 @@ func TestDocumentFieldArrayPositions(t *testing.T) { ap := f.ArrayPositions() if len(ap) < 1 { t.Errorf("expected an array position, got none") - continue + return } if ap[0] != 3 { t.Errorf("expected 'last' in array position 3, got %d", ap[0]) } } - } + }) // now index a document in the same field with a single string - err = index.Index("k2", struct { + err = idx.Index("k2", struct { Messages string }{ Messages: "only", @@ -938,23 +933,22 @@ func TestDocumentFieldArrayPositions(t *testing.T) { } // load the document - docInt, err = index.Document("k2") + doc, err = idx.Document("k2") if err != nil { t.Fatal(err) } - doc = docInt.(*document.Document) - for _, f := range doc.Fields { + doc.VisitFields(func(f index.Field) { if reflect.DeepEqual(f.Value(), []byte("only")) { ap := f.ArrayPositions() if len(ap) != 0 { t.Errorf("expected no array positions, got %d", len(ap)) - continue + return } } - } + }) - err = index.Close() + err = idx.Close() if err != nil { t.Fatal(err) } @@ -1835,7 +1829,7 @@ func TestBatchMerge(t *testing.T) { tmpIndexPath := createTmpIndexPath(t) defer cleanupTmpIndexPath(t, tmpIndexPath) - index, err := New(tmpIndexPath, NewIndexMapping()) + idx, err := New(tmpIndexPath, NewIndexMapping()) if err != nil { t.Fatal(err) } @@ -1845,7 +1839,7 @@ func TestBatchMerge(t *testing.T) { "nation": "india", } - batchA := index.NewBatch() + batchA := idx.NewBatch() err = batchA.Index("a", doca) if err != nil { t.Error(err) @@ -1857,7 +1851,7 @@ func TestBatchMerge(t *testing.T) { "desc": "gophercon MV", } - batchB := index.NewBatch() + batchB := idx.NewBatch() err = batchB.Index("b", docb) if err != nil { t.Error(err) @@ -1870,7 +1864,7 @@ func TestBatchMerge(t *testing.T) { "country": "usa", } - batchC := index.NewBatch() + batchC := idx.NewBatch() err = batchC.Index("c", docC) if err != nil { t.Error(err) @@ -1892,29 +1886,29 @@ func TestBatchMerge(t *testing.T) { t.Errorf("expected batch size 6, got %d", batchA.Size()) } - err = index.Batch(batchA) + err = idx.Batch(batchA) if err != nil { t.Fatal(err) } // close the index, open it again, and try some more things - err = index.Close() + err = idx.Close() if err != nil { t.Fatal(err) } - index, err = Open(tmpIndexPath) + idx, err = Open(tmpIndexPath) if err != nil { t.Fatal(err) } defer func() { - err := index.Close() + err := idx.Close() if err != nil { t.Fatal(err) } }() - count, err := index.DocCount() + count, err := idx.DocCount() if err != nil { t.Fatal(err) } @@ -1922,16 +1916,12 @@ func TestBatchMerge(t *testing.T) { t.Errorf("expected doc count 2, got %d", count) } - docInt, err := index.Document("c") + doc, err := idx.Document("c") if err != nil { t.Fatal(err) } - doc := docInt.(*document.Document) - if doc == nil { - t.Errorf("expected doc not nil, got nil") - } - val, err := index.GetInternal([]byte("batchkB")) + val, err := idx.GetInternal([]byte("batchkB")) if err != nil { t.Fatal(err) } @@ -1939,7 +1929,7 @@ func TestBatchMerge(t *testing.T) { t.Errorf("expected val: batchvBNew , got %s", val) } - val, err = index.GetInternal([]byte("batchkA")) + val, err = idx.GetInternal([]byte("batchkA")) if err != nil { t.Fatal(err) } @@ -1948,16 +1938,16 @@ func TestBatchMerge(t *testing.T) { } foundNameField := false - for _, field := range doc.Fields { + doc.VisitFields(func(field index.Field) { if field.Name() == "name" && string(field.Value()) == "blahblah" { foundNameField = true } - } + }) if !foundNameField { t.Errorf("expected to find field named 'name' with value 'blahblah'") } - fields, err := index.Fields() + fields, err := idx.Fields() if err != nil { t.Fatal(err) } diff --git a/mapping/mapping_test.go b/mapping/mapping_test.go index 1c9ced58a..6f208aaa6 100644 --- a/mapping/mapping_test.go +++ b/mapping/mapping_test.go @@ -17,6 +17,7 @@ package mapping import ( "encoding/json" "fmt" + index "github.com/blevesearch/bleve_index_api" "reflect" "strconv" "testing" @@ -969,7 +970,7 @@ func TestMappingForGeo(t *testing.T) { for _, f := range doc.Fields { if f.Name() == "location" { foundGeo = true - geoF, ok := f.(*document.GeoPointField) + geoF, ok := f.(index.GeoPointField) if !ok { t.Errorf("expected a geopoint field!") } @@ -1136,7 +1137,7 @@ func TestMappingPointerToTimeBug1152(t *testing.T) { if len(doc.Fields) != 1 { t.Fatalf("expected 1 field, got: %d", len(doc.Fields)) } - if _, ok := doc.Fields[0].(*document.DateTimeField); !ok { + if _, ok := doc.Fields[0].(index.DateTimeField); !ok { t.Fatalf("expected field to be type *document.DateTimeField, got %T", doc.Fields[0]) } } diff --git a/search/highlight/highlighter/simple/highlighter_simple.go b/search/highlight/highlighter/simple/highlighter_simple.go index 14cc235fd..0a0c89611 100644 --- a/search/highlight/highlighter/simple/highlighter_simple.go +++ b/search/highlight/highlighter/simple/highlighter_simple.go @@ -19,7 +19,6 @@ import ( "fmt" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/document" "github.com/blevesearch/bleve/registry" "github.com/blevesearch/bleve/search" "github.com/blevesearch/bleve/search/highlight" @@ -84,7 +83,7 @@ func (s *Highlighter) BestFragmentsInField(dm *search.DocumentMatch, doc index.D heap.Init(&fq) doc.VisitFields(func(f index.Field) { if f.Name() == field { - _, ok := f.(*document.TextField) + _, ok := f.(index.TextField) if ok { termLocationsSameArrayPosition := make(highlight.TermLocations, 0) for _, otl := range orderedTermLocations { From a6e5e07a317cbd1394795f388f165bb96ef0a2c4 Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Tue, 22 Dec 2020 10:27:33 -0500 Subject: [PATCH 21/28] update for latest renaming (#1527) * update for latest renaming * update to latest apis --- go.mod | 14 +++++++------- go.sum | 28 ++++++++++++++-------------- index/scorch/snapshot_index.go | 8 ++++---- index/scorch/snapshot_segment.go | 6 +++--- index/upsidedown/index_reader.go | 4 ++-- search/collector/search_test.go | 4 ++-- search/collector/topn.go | 2 +- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/go.mod b/go.mod index 08312500d..a5a959cda 100644 --- a/go.mod +++ b/go.mod @@ -4,17 +4,17 @@ go 1.13 require ( github.com/RoaringBitmap/roaring v0.4.23 - github.com/blevesearch/bleve_index_api v0.0.6 + github.com/blevesearch/bleve_index_api v0.0.7 github.com/blevesearch/go-porterstemmer v1.0.3 - github.com/blevesearch/scorch_segment_api v0.0.8 + github.com/blevesearch/scorch_segment_api v0.0.9 github.com/blevesearch/segment v0.9.0 github.com/blevesearch/snowballstem v0.9.0 github.com/blevesearch/upsidedown_store_api v0.0.1 - github.com/blevesearch/zapx/v11 v11.1.7 - github.com/blevesearch/zapx/v12 v12.1.7 - github.com/blevesearch/zapx/v13 v13.1.7 - github.com/blevesearch/zapx/v14 v14.1.7 - github.com/blevesearch/zapx/v15 v15.1.7 + github.com/blevesearch/zapx/v11 v11.1.8 + github.com/blevesearch/zapx/v12 v12.1.8 + github.com/blevesearch/zapx/v13 v13.1.8 + github.com/blevesearch/zapx/v14 v14.1.8 + github.com/blevesearch/zapx/v15 v15.1.8 github.com/couchbase/moss v0.1.0 github.com/couchbase/vellum v1.0.2 github.com/golang/protobuf v1.3.2 diff --git a/go.sum b/go.sum index e4a6245e2..6f6db29b4 100644 --- a/go.sum +++ b/go.sum @@ -2,30 +2,30 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/RoaringBitmap/roaring v0.4.23 h1:gpyfd12QohbqhFO4NVDUdoPOCXsyahYRQhINmlHxKeo= github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/blevesearch/bleve_index_api v0.0.6 h1:/SO0BsZYqFchE8Jo3uzQd2tRjB9GG+A92l478OHs0J4= -github.com/blevesearch/bleve_index_api v0.0.6/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= +github.com/blevesearch/bleve_index_api v0.0.7 h1:nUotd9VuZcAwXgLQddTFvzQm+xe7DAW7OGGeIIdYYUo= +github.com/blevesearch/bleve_index_api v0.0.7/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo= github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M= github.com/blevesearch/mmap-go v1.0.2 h1:JtMHb+FgQCTTYIhtMvimw15dJwu1Y5lrZDMOFXVWPk0= github.com/blevesearch/mmap-go v1.0.2/go.mod h1:ol2qBqYaOUsGdm7aRMRrYGgPvnwLe6Y+7LMvAB5IbSA= -github.com/blevesearch/scorch_segment_api v0.0.8 h1:Pu1Gdsm6Ji/eF/6mDvASE/oxOXlmHWGIuarvW8Mq19I= -github.com/blevesearch/scorch_segment_api v0.0.8/go.mod h1:TSv8hjSTapWb2JzOFza/e0pj69iJqjW//skNdO7wKtA= +github.com/blevesearch/scorch_segment_api v0.0.9 h1:y644WH0LPJKE7tKwXQvpTwQEA/NXRzTockN2ZmPdvl4= +github.com/blevesearch/scorch_segment_api v0.0.9/go.mod h1:Q9ra2/ntKs6fRAeU09ZLq8v1cy40udWyjidBNnliL/4= github.com/blevesearch/segment v0.9.0 h1:5lG7yBCx98or7gK2cHMKPukPZ/31Kag7nONpoBt22Ac= github.com/blevesearch/segment v0.9.0/go.mod h1:9PfHYUdQCgHktBgvtUOF4x+pc4/l8rdH0u5spnW85UQ= github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s= github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs= github.com/blevesearch/upsidedown_store_api v0.0.1 h1:cf3YQ6c3jvZ/gvHL6k71cshDG+nYTgL5PTWFqYXA3bg= github.com/blevesearch/upsidedown_store_api v0.0.1/go.mod h1:jRZGTYWNqHXvOOjvT0WXHYO5Yin7U/PmTX1nevIY8yo= -github.com/blevesearch/zapx/v11 v11.1.7 h1:C8uGUh2h2xV/gnKsKpOx2MsTwYNwvmF8kOtXZX6Y41A= -github.com/blevesearch/zapx/v11 v11.1.7/go.mod h1:Q1xcy9nqgHv6OK4eYB0dshz3AHcNF0Bjy1O30PiRSFg= -github.com/blevesearch/zapx/v12 v12.1.7 h1:v00j2bDIuNUBtwE1t3eAqkz/A0ulZiaRU9p1BIpaHFc= -github.com/blevesearch/zapx/v12 v12.1.7/go.mod h1:Ul1X/7u8bKCQcWulvQFfskQmoKN/0WES/RVYXRBBBCc= -github.com/blevesearch/zapx/v13 v13.1.7 h1:LUuPjZLoMtJcTUbIHopCqZayQvXr5+Yfj0GJofByYYM= -github.com/blevesearch/zapx/v13 v13.1.7/go.mod h1:v4f+OOMI2kidBNxOnnWUVYhekCcMAj83BwV1NsaKUac= -github.com/blevesearch/zapx/v14 v14.1.7 h1:MXNNoR+gFl4+3kBU4aS36X7jDPX+qW4mYqjJOpSsa+k= -github.com/blevesearch/zapx/v14 v14.1.7/go.mod h1:apL2HuP6COJVPCtEhKa4u70fVOW8WLx8otcjn38xIpw= -github.com/blevesearch/zapx/v15 v15.1.7 h1:cSCV+fGtN4TIv+YkEqQigcy2UHT3cq+jLL8htGAXhT0= -github.com/blevesearch/zapx/v15 v15.1.7/go.mod h1:dO2Mp8wt/hMl6IEKc0i8BG2SXKPnPKwOPQKEkax6mes= +github.com/blevesearch/zapx/v11 v11.1.8 h1:uA36bjc0av4cUcXbr6w4Mi8m8WQlwujVvXHc2F1HA+s= +github.com/blevesearch/zapx/v11 v11.1.8/go.mod h1:HJQL7quXE1J3mAiVS2PKfaWuFfPwDwkcfuvDjyQa6is= +github.com/blevesearch/zapx/v12 v12.1.8 h1:Yc6rb+0nC2FK5ys4GA38F5YZaC+PDgprQs/5wJhAMqY= +github.com/blevesearch/zapx/v12 v12.1.8/go.mod h1:PoWabiXyIfHRPKNajaE1tTvSgTmC26ItbYgWLHZn2os= +github.com/blevesearch/zapx/v13 v13.1.8 h1:JlXK+vEf4Me1suMqcbQBMvyItOl3KkhRiJMvJTIwrtU= +github.com/blevesearch/zapx/v13 v13.1.8/go.mod h1:8vbSJa01u68VSIbnTZL7H4Lg7h/AQT6TML8YevZ6/po= +github.com/blevesearch/zapx/v14 v14.1.8 h1:xKVikccwhRt9U0Le8PZZGCmn6eysgDC69MbwZIEvYHk= +github.com/blevesearch/zapx/v14 v14.1.8/go.mod h1:06oW0afqsolh3fo8SptOoiZ7gjYKsyjwFOS1L8X688g= +github.com/blevesearch/zapx/v15 v15.1.8 h1:im/NqM2E1GHJSNGTVo9JgY2Ert5Zl8IVsdjGYEBIv70= +github.com/blevesearch/zapx/v15 v15.1.8/go.mod h1:fLZWqgJS6R7Z92HkmBhbZGRK/IrrqZ+aXVWfSxzkbRs= 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= diff --git a/index/scorch/snapshot_index.go b/index/scorch/snapshot_index.go index 77abb7b7c..f4347d508 100644 --- a/index/scorch/snapshot_index.go +++ b/index/scorch/snapshot_index.go @@ -599,13 +599,13 @@ func docInternalToNumber(in index.IndexInternalID) (uint64, error) { func (i *IndexSnapshot) documentVisitFieldTermsOnSegment( segmentIndex int, localDocNum uint64, fields []string, cFields []string, - visitor index.DocumentFieldTermVisitor, dvs segment.DocVisitState) ( + visitor index.DocValueVisitor, dvs segment.DocVisitState) ( cFieldsOut []string, dvsOut segment.DocVisitState, err error) { ss := i.segment[segmentIndex] var vFields []string // fields that are visitable via the segment - ssv, ssvOk := ss.segment.(segment.DocumentFieldTermVisitable) + ssv, ssvOk := ss.segment.(segment.DocValueVisitable) if ssvOk && ssv != nil { vFields, err = ssv.VisitableDocValueFields() if err != nil { @@ -636,7 +636,7 @@ func (i *IndexSnapshot) documentVisitFieldTermsOnSegment( } if ssvOk && ssv != nil && len(vFields) > 0 { - dvs, err = ssv.VisitDocumentFieldTerms(localDocNum, fields, visitor, dvs) + dvs, err = ssv.VisitDocValues(localDocNum, fields, visitor, dvs) if err != nil { return nil, nil, err } @@ -671,7 +671,7 @@ type DocValueReader struct { } func (dvr *DocValueReader) VisitDocValues(id index.IndexInternalID, - visitor index.DocumentFieldTermVisitor) (err error) { + visitor index.DocValueVisitor) (err error) { docNum, err := docInternalToNumber(id) if err != nil { return err diff --git a/index/scorch/snapshot_segment.go b/index/scorch/snapshot_segment.go index 749580e63..e585541eb 100644 --- a/index/scorch/snapshot_segment.go +++ b/index/scorch/snapshot_segment.go @@ -62,8 +62,8 @@ func (s *SegmentSnapshot) Close() error { return s.segment.Close() } -func (s *SegmentSnapshot) VisitDocument(num uint64, visitor segment.DocumentFieldValueVisitor) error { - return s.segment.VisitDocument(num, visitor) +func (s *SegmentSnapshot) VisitDocument(num uint64, visitor segment.StoredFieldValueVisitor) error { + return s.segment.VisitStoredFields(num, visitor) } func (s *SegmentSnapshot) DocID(num uint64) ([]byte, error) { @@ -253,7 +253,7 @@ func (c *cachedDocs) updateSizeLOCKED() { } func (c *cachedDocs) visitDoc(localDocNum uint64, - fields []string, visitor index.DocumentFieldTermVisitor) { + fields []string, visitor index.DocValueVisitor) { c.m.Lock() for _, field := range fields { diff --git a/index/upsidedown/index_reader.go b/index/upsidedown/index_reader.go index a6c1669b7..ea1fd65ca 100644 --- a/index/upsidedown/index_reader.go +++ b/index/upsidedown/index_reader.go @@ -109,7 +109,7 @@ func (i *IndexReader) Document(id string) (doc index.Document, err error) { return rvd, nil } -func (i *IndexReader) documentVisitFieldTerms(id index.IndexInternalID, fields []string, visitor index.DocumentFieldTermVisitor) error { +func (i *IndexReader) documentVisitFieldTerms(id index.IndexInternalID, fields []string, visitor index.DocValueVisitor) error { fieldsMap := make(map[uint16]string, len(fields)) for _, f := range fields { id, ok := i.index.fieldCache.FieldNamed(f, false) @@ -220,6 +220,6 @@ type DocValueReader struct { } func (dvr *DocValueReader) VisitDocValues(id index.IndexInternalID, - visitor index.DocumentFieldTermVisitor) error { + visitor index.DocValueVisitor) error { return dvr.i.documentVisitFieldTerms(id, dvr.fields, visitor) } diff --git a/search/collector/search_test.go b/search/collector/search_test.go index 4b9bd9ca3..3c484d284 100644 --- a/search/collector/search_test.go +++ b/search/collector/search_test.go @@ -121,7 +121,7 @@ func (sr *stubReader) Document(id string) (index.Document, error) { return nil, nil } -func (sr *stubReader) DocumentVisitFieldTerms(id index.IndexInternalID, fields []string, visitor index.DocumentFieldTermVisitor) error { +func (sr *stubReader) DocumentVisitFieldTerms(id index.IndexInternalID, fields []string, visitor index.DocValueVisitor) error { return nil } @@ -170,6 +170,6 @@ type DocValueReader struct { fields []string } -func (dvr *DocValueReader) VisitDocValues(id index.IndexInternalID, visitor index.DocumentFieldTermVisitor) error { +func (dvr *DocValueReader) VisitDocValues(id index.IndexInternalID, visitor index.DocValueVisitor) error { return dvr.i.DocumentVisitFieldTerms(id, dvr.fields, visitor) } diff --git a/search/collector/topn.go b/search/collector/topn.go index 57fca0c29..16e6659fc 100644 --- a/search/collector/topn.go +++ b/search/collector/topn.go @@ -68,7 +68,7 @@ type TopNCollector struct { cachedDesc []bool lowestMatchOutsideResults *search.DocumentMatch - updateFieldVisitor index.DocumentFieldTermVisitor + updateFieldVisitor index.DocValueVisitor dvReader index.DocValueReader searchAfter *search.DocumentMatch } From 44887afa59a366a13dd41249515fe51b1fa451c0 Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Tue, 22 Dec 2020 10:28:19 -0500 Subject: [PATCH 22/28] switch default index to scorch with latest zap (#1528) one example required updating as it's custom sort contained a tie (both fields with age 0). upsidedown always returned the results in a particular order, which was not guaranteed by scorch. to address this, the exmaple has been updated to include the doc id as an additional sort criteria (ensuring the original order expected is kept by scorch) --- config.go | 7 ++----- examples_test.go | 1 + index.go | 3 ++- index/scorch/segment_plugin.go | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/config.go b/config.go index 43c551470..2eae641ab 100644 --- a/config.go +++ b/config.go @@ -20,14 +20,11 @@ import ( "log" "time" + "github.com/blevesearch/bleve/index/scorch" "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" - "github.com/blevesearch/bleve/index/upsidedown" "github.com/blevesearch/bleve/registry" "github.com/blevesearch/bleve/search/highlight/highlighter/html" index "github.com/blevesearch/bleve_index_api" - - // force import of scorch so its accessible by default - _ "github.com/blevesearch/bleve/index/scorch" ) var bleveExpVar = expvar.NewMap("bleve") @@ -79,7 +76,7 @@ func init() { Config.DefaultMemKVStore = gtreap.Name // default index - Config.DefaultIndexType = upsidedown.Name + Config.DefaultIndexType = scorch.Name bootDuration := time.Since(bootStart) bleveExpVar.Add("bootDuration", int64(bootDuration)) diff --git a/examples_test.go b/examples_test.go index 3290f2431..3a629c301 100644 --- a/examples_test.go +++ b/examples_test.go @@ -449,6 +449,7 @@ func ExampleSearchRequest_SortByCustom() { Field: "Age", Missing: search.SortFieldMissingFirst, }, + &search.SortDocID{}, }) searchResults, err := exampleIndex.Search(searchRequest) if err != nil { diff --git a/index.go b/index.go index 9cc753ea6..e5d686c5e 100644 --- a/index.go +++ b/index.go @@ -16,6 +16,7 @@ package bleve import ( "context" + "github.com/blevesearch/bleve/index/upsidedown" "github.com/blevesearch/bleve/document" "github.com/blevesearch/bleve/mapping" @@ -261,7 +262,7 @@ func New(path string, mapping mapping.IndexMapping) (Index, error) { // The provided mapping will be used for all // Index/Search operations. func NewMemOnly(mapping mapping.IndexMapping) (Index, error) { - return newIndexUsing("", mapping, Config.DefaultIndexType, Config.DefaultMemKVStore, nil) + return newIndexUsing("", mapping, upsidedown.Name, Config.DefaultMemKVStore, nil) } // NewUsing creates index at the specified path, diff --git a/index/scorch/segment_plugin.go b/index/scorch/segment_plugin.go index 94b4cee40..99c3b9c89 100644 --- a/index/scorch/segment_plugin.go +++ b/index/scorch/segment_plugin.go @@ -71,11 +71,11 @@ var defaultSegmentPlugin SegmentPlugin func init() { ResetSegmentPlugins() - RegisterSegmentPlugin(&zapv15.ZapPlugin{}, false) + RegisterSegmentPlugin(&zapv15.ZapPlugin{}, true) RegisterSegmentPlugin(&zapv14.ZapPlugin{}, false) RegisterSegmentPlugin(&zapv13.ZapPlugin{}, false) RegisterSegmentPlugin(&zapv12.ZapPlugin{}, false) - RegisterSegmentPlugin(&zapv11.ZapPlugin{}, true) + RegisterSegmentPlugin(&zapv11.ZapPlugin{}, false) } func ResetSegmentPlugins() { From 3f670ba6fdd4fc33073fae9d254b1fc1dd62eaec Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Thu, 31 Dec 2020 14:44:23 -0500 Subject: [PATCH 23/28] update to release candidate apis (#1531) --- go.mod | 14 +++++++------- go.sum | 28 ++++++++++++++-------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/go.mod b/go.mod index a5a959cda..b7a00c43a 100644 --- a/go.mod +++ b/go.mod @@ -4,17 +4,17 @@ go 1.13 require ( github.com/RoaringBitmap/roaring v0.4.23 - github.com/blevesearch/bleve_index_api v0.0.7 + github.com/blevesearch/bleve_index_api v0.0.8 github.com/blevesearch/go-porterstemmer v1.0.3 - github.com/blevesearch/scorch_segment_api v0.0.9 + github.com/blevesearch/scorch_segment_api v0.0.10 github.com/blevesearch/segment v0.9.0 github.com/blevesearch/snowballstem v0.9.0 github.com/blevesearch/upsidedown_store_api v0.0.1 - github.com/blevesearch/zapx/v11 v11.1.8 - github.com/blevesearch/zapx/v12 v12.1.8 - github.com/blevesearch/zapx/v13 v13.1.8 - github.com/blevesearch/zapx/v14 v14.1.8 - github.com/blevesearch/zapx/v15 v15.1.8 + github.com/blevesearch/zapx/v11 v11.1.9 + github.com/blevesearch/zapx/v12 v12.1.9 + github.com/blevesearch/zapx/v13 v13.1.9 + github.com/blevesearch/zapx/v14 v14.1.9 + github.com/blevesearch/zapx/v15 v15.1.9 github.com/couchbase/moss v0.1.0 github.com/couchbase/vellum v1.0.2 github.com/golang/protobuf v1.3.2 diff --git a/go.sum b/go.sum index 6f6db29b4..e78fc6ea4 100644 --- a/go.sum +++ b/go.sum @@ -2,30 +2,30 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/RoaringBitmap/roaring v0.4.23 h1:gpyfd12QohbqhFO4NVDUdoPOCXsyahYRQhINmlHxKeo= github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/blevesearch/bleve_index_api v0.0.7 h1:nUotd9VuZcAwXgLQddTFvzQm+xe7DAW7OGGeIIdYYUo= -github.com/blevesearch/bleve_index_api v0.0.7/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= +github.com/blevesearch/bleve_index_api v0.0.8 h1:X6kPt4vI4Ohk0GFYVuDOD/QeoF9ioM+RGYh7LHRHcvI= +github.com/blevesearch/bleve_index_api v0.0.8/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo= github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M= github.com/blevesearch/mmap-go v1.0.2 h1:JtMHb+FgQCTTYIhtMvimw15dJwu1Y5lrZDMOFXVWPk0= github.com/blevesearch/mmap-go v1.0.2/go.mod h1:ol2qBqYaOUsGdm7aRMRrYGgPvnwLe6Y+7LMvAB5IbSA= -github.com/blevesearch/scorch_segment_api v0.0.9 h1:y644WH0LPJKE7tKwXQvpTwQEA/NXRzTockN2ZmPdvl4= -github.com/blevesearch/scorch_segment_api v0.0.9/go.mod h1:Q9ra2/ntKs6fRAeU09ZLq8v1cy40udWyjidBNnliL/4= +github.com/blevesearch/scorch_segment_api v0.0.10 h1:38iFTfouGKXkNo/Lk1f2pr3JDdYvfCwo8BS2setHlf0= +github.com/blevesearch/scorch_segment_api v0.0.10/go.mod h1:YQapb/hcXg1fqEsUdJlTDoec8DuUHblsiIWNBwa8Wts= github.com/blevesearch/segment v0.9.0 h1:5lG7yBCx98or7gK2cHMKPukPZ/31Kag7nONpoBt22Ac= github.com/blevesearch/segment v0.9.0/go.mod h1:9PfHYUdQCgHktBgvtUOF4x+pc4/l8rdH0u5spnW85UQ= github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s= github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs= github.com/blevesearch/upsidedown_store_api v0.0.1 h1:cf3YQ6c3jvZ/gvHL6k71cshDG+nYTgL5PTWFqYXA3bg= github.com/blevesearch/upsidedown_store_api v0.0.1/go.mod h1:jRZGTYWNqHXvOOjvT0WXHYO5Yin7U/PmTX1nevIY8yo= -github.com/blevesearch/zapx/v11 v11.1.8 h1:uA36bjc0av4cUcXbr6w4Mi8m8WQlwujVvXHc2F1HA+s= -github.com/blevesearch/zapx/v11 v11.1.8/go.mod h1:HJQL7quXE1J3mAiVS2PKfaWuFfPwDwkcfuvDjyQa6is= -github.com/blevesearch/zapx/v12 v12.1.8 h1:Yc6rb+0nC2FK5ys4GA38F5YZaC+PDgprQs/5wJhAMqY= -github.com/blevesearch/zapx/v12 v12.1.8/go.mod h1:PoWabiXyIfHRPKNajaE1tTvSgTmC26ItbYgWLHZn2os= -github.com/blevesearch/zapx/v13 v13.1.8 h1:JlXK+vEf4Me1suMqcbQBMvyItOl3KkhRiJMvJTIwrtU= -github.com/blevesearch/zapx/v13 v13.1.8/go.mod h1:8vbSJa01u68VSIbnTZL7H4Lg7h/AQT6TML8YevZ6/po= -github.com/blevesearch/zapx/v14 v14.1.8 h1:xKVikccwhRt9U0Le8PZZGCmn6eysgDC69MbwZIEvYHk= -github.com/blevesearch/zapx/v14 v14.1.8/go.mod h1:06oW0afqsolh3fo8SptOoiZ7gjYKsyjwFOS1L8X688g= -github.com/blevesearch/zapx/v15 v15.1.8 h1:im/NqM2E1GHJSNGTVo9JgY2Ert5Zl8IVsdjGYEBIv70= -github.com/blevesearch/zapx/v15 v15.1.8/go.mod h1:fLZWqgJS6R7Z92HkmBhbZGRK/IrrqZ+aXVWfSxzkbRs= +github.com/blevesearch/zapx/v11 v11.1.9 h1:r+6tGcOzZGrv8qghfatrODYjRnPHdwOikLRWNCvd6Rc= +github.com/blevesearch/zapx/v11 v11.1.9/go.mod h1:9M/SGfBNfJIdYADHnuvesp4WeyFJqcNhr0pQbhT/fCg= +github.com/blevesearch/zapx/v12 v12.1.9 h1:pY4sxMni/nEwpIV98LVSI3nc7nf54QJSjNzIGOkhUHY= +github.com/blevesearch/zapx/v12 v12.1.9/go.mod h1:w2WU/Xx7WbkzKWnOqrJSM008Y60yXfNHehrICaug9QE= +github.com/blevesearch/zapx/v13 v13.1.9 h1:pAHJT4936h3OOV1hSGZx7Be4R5Duhbmu/RUQJ++59YM= +github.com/blevesearch/zapx/v13 v13.1.9/go.mod h1:nBCZXgM4vxT2JZGiPYGiOhUuqDsfEzwtB5sxhhR7XUA= +github.com/blevesearch/zapx/v14 v14.1.9 h1:p3bm1neo7Q1B9FfMUOGZh+Oyelo9eV7SotjOgRkqu+s= +github.com/blevesearch/zapx/v14 v14.1.9/go.mod h1:olLFutauzLgxrZbpozEuAl3+Ok6vvdFDc1qdk9XSIqw= +github.com/blevesearch/zapx/v15 v15.1.9 h1:Uqd10QRx/3MqrBv5p1NMVdeleaByH0O8OHc16HFMGZk= +github.com/blevesearch/zapx/v15 v15.1.9/go.mod h1:F98bkaqOw7qm1cZV2DNXRYOAuznUP+7Ksz3q0If0c4A= 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= From d464b266ba4a4e3dd931bf5b72ea1e0e0ef13b8f Mon Sep 17 00:00:00 2001 From: Sreekanth Sivasankaran Date: Fri, 1 Jan 2021 01:29:02 +0530 Subject: [PATCH 24/28] Adding configurable freq/norm processing (#1526) * Adding configurable freq/norm processing Useful for use cases where score relevancy isn't needed for the search requests. A special frequency value of zero/0 is used for skipping the freq/norm. * update to work with removed items (#1524) * update to work with removed items * update to latest api * do not type assert on document or field (#1525) instead use the interface exposed by index api * update for latest renaming (#1527) * update for latest renaming * update to latest apis * switch default index to scorch with latest zap (#1528) one example required updating as it's custom sort contained a tie (both fields with age 0). upsidedown always returned the results in a particular order, which was not guaranteed by scorch. to address this, the exmaple has been updated to include the doc id as an additional sort criteria (ensuring the original order expected is kept by scorch) * update to release candidate apis (#1531) Co-authored-by: Marty Schoch --- analysis/freq.go | 23 +++++++++++++---------- mapping/field.go | 17 ++++++++++++++++- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/analysis/freq.go b/analysis/freq.go index ec40bb6f5..a0fd1a416 100644 --- a/analysis/freq.go +++ b/analysis/freq.go @@ -36,14 +36,16 @@ func TokenFrequency(tokens TokenStream, arrayPositions []uint64, options index.F curr, ok := rv[string(token.Term)] if ok { curr.Locations = append(curr.Locations, &tls[tlNext]) - curr.SetFrequency(curr.Frequency() + 1) } else { - tf := &index.TokenFreq{ + curr = &index.TokenFreq{ Term: token.Term, Locations: []*index.TokenLocation{&tls[tlNext]}, } - tf.SetFrequency(1) - rv[string(token.Term)] = tf + rv[string(token.Term)] = curr + } + + if !options.SkipFreqNorm() { + curr.SetFrequency(curr.Frequency() + 1) } tlNext++ @@ -51,14 +53,15 @@ func TokenFrequency(tokens TokenStream, arrayPositions []uint64, options index.F } else { for _, token := range tokens { curr, exists := rv[string(token.Term)] - if exists { - curr.SetFrequency(curr.Frequency() + 1) - } else { - tf := &index.TokenFreq{ + if !exists { + curr = &index.TokenFreq{ Term: token.Term, } - tf.SetFrequency(1) - rv[string(token.Term)] = tf + rv[string(token.Term)] = curr + } + + if !options.SkipFreqNorm() { + curr.SetFrequency(curr.Frequency() + 1) } } } diff --git a/mapping/field.go b/mapping/field.go index 3abae8932..edfb8af0d 100644 --- a/mapping/field.go +++ b/mapping/field.go @@ -17,9 +17,10 @@ package mapping import ( "encoding/json" "fmt" - index "github.com/blevesearch/bleve_index_api" "time" + index "github.com/blevesearch/bleve_index_api" + "github.com/blevesearch/bleve/analysis" "github.com/blevesearch/bleve/document" "github.com/blevesearch/bleve/geo" @@ -60,6 +61,12 @@ type FieldMapping struct { // DocValues, if true makes the index uninverting possible for this field // It is useful for faceting and sorting queries. DocValues bool `json:"docvalues,omitempty"` + + // SkipFreqNorm, if true, avoids the indexing of frequency and norm values + // of the tokens for this field. This option would be useful for saving + // the processing of freq/norm details when the default score based relevancy + // isn't needed. + SkipFreqNorm bool `json:"skip_freq_norm,omitempty"` } // NewTextFieldMapping returns a default field mapping for text @@ -165,6 +172,9 @@ func (fm *FieldMapping) Options() index.FieldIndexingOptions { if fm.DocValues { rv |= index.DocValues } + if fm.SkipFreqNorm { + rv |= index.SkipFreqNorm + } return rv } @@ -331,6 +341,11 @@ func (fm *FieldMapping) UnmarshalJSON(data []byte) error { if err != nil { return err } + case "skip_freq_norm": + err := json.Unmarshal(v, &fm.SkipFreqNorm) + if err != nil { + return err + } default: invalidKeys = append(invalidKeys, k) } From 4f3ee06a212e556c0171e6936a4c6912e9790cfb Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Tue, 5 Jan 2021 11:54:51 -0500 Subject: [PATCH 25/28] restore correct copyright header (#1532) it appears that while moving files around I mistakenly changed a copyright header, which was not my intention --- index/scorch/int.go | 15 ++++++++++----- index/scorch/int_test.go | 15 ++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/index/scorch/int.go b/index/scorch/int.go index fc5cedfc8..4fa6d7f71 100644 --- a/index/scorch/int.go +++ b/index/scorch/int.go @@ -1,16 +1,21 @@ -// Copyright (c) 2020 Couchbase, Inc. +// Copyright 2014 The Cockroach Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. + +// This code originated from: +// https://github.com/cockroachdb/cockroach/blob/2dd65dde5d90c157f4b93f92502ca1063b904e1d/pkg/util/encoding/encoding.go + +// Modified to not use pkg/errors package scorch diff --git a/index/scorch/int_test.go b/index/scorch/int_test.go index 85dfcb370..2a469a175 100644 --- a/index/scorch/int_test.go +++ b/index/scorch/int_test.go @@ -1,16 +1,21 @@ -// Copyright (c) 2020 Couchbase, Inc. +// Copyright 2014 The Cockroach Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. + +// This code originated from: +// https://github.com/cockroachdb/cockroach/blob/2dd65dde5d90c157f4b93f92502ca1063b904e1d/pkg/util/encoding/encoding_test.go + +// Modified to only test the parts we borrowed package scorch From 8e14fc9c6a2b94a1e1a9467027b92c9c2d458839 Mon Sep 17 00:00:00 2001 From: Mario de Frutos Dieguez Date: Wed, 6 Jan 2021 18:43:13 +0100 Subject: [PATCH 26/28] MatchOperator should be that type instead of int (#1410) Right now `MatchOperator` constants are ints and when you're trying to assign them to a variable you get an int. If you try to use those variables as operator you get the following error: ``` cannot use operator (type int) as type MatchQueryOperator in argument to q.SetOperator ``` So, to fix this problem we just need to create `MatchOperator` constants --- search/query/match.go | 4 ++-- search/query/query_test.go | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/search/query/match.go b/search/query/match.go index 270709a65..079e085e6 100644 --- a/search/query/match.go +++ b/search/query/match.go @@ -37,9 +37,9 @@ type MatchQueryOperator int const ( // Document must satisfy AT LEAST ONE of term searches. - MatchQueryOperatorOr = 0 + MatchQueryOperatorOr = MatchQueryOperator(0) // Document must satisfy ALL of term searches. - MatchQueryOperatorAnd = 1 + MatchQueryOperatorAnd = MatchQueryOperator(1) ) func (o MatchQueryOperator) MarshalJSON() ([]byte, error) { diff --git a/search/query/query_test.go b/search/query/query_test.go index 42d05f336..717c4b811 100644 --- a/search/query/query_test.go +++ b/search/query/query_test.go @@ -83,6 +83,16 @@ func TestParseQuery(t *testing.T) { return q }(), }, + { + input: []byte(`{"match":"beer","field":"desc","operator":"and"}`), + output: func() Query { + operator := MatchQueryOperatorAnd + q := NewMatchQuery("beer") + q.SetOperator(operator) + q.SetField("desc") + return q + }(), + }, { input: []byte(`{"match":"beer","field":"desc","operator":"or"}`), output: func() Query { @@ -92,6 +102,16 @@ func TestParseQuery(t *testing.T) { return q }(), }, + { + input: []byte(`{"match":"beer","field":"desc","operator":"or"}`), + output: func() Query { + operator := MatchQueryOperatorOr + q := NewMatchQuery("beer") + q.SetOperator(operator) + q.SetField("desc") + return q + }(), + }, { input: []byte(`{"match":"beer","field":"desc","operator":"does not exist"}`), output: nil, From eedb7678d2a6f8809a65743641d76242658b54d8 Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Tue, 12 Jan 2021 14:41:38 -0500 Subject: [PATCH 27/28] update to v1 apis and zapx versions (#1537) * update to v1 apis and zapx versions * update to v1.0.1 upsidedown_store_api * make sort integration tests more precise the upsidedown implementation would break tie sort order in a predictable way, and some tests inadvertely relied on this behavior. these tests have been adjusted to use a more specific sort order, breaking all ties, such that the expected results no longer depend on implementation details. --- go.mod | 16 ++++++++-------- go.sum | 32 ++++++++++++++++---------------- test/tests/sort/searches.json | 8 ++++---- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/go.mod b/go.mod index b7a00c43a..10504cc08 100644 --- a/go.mod +++ b/go.mod @@ -4,17 +4,17 @@ go 1.13 require ( github.com/RoaringBitmap/roaring v0.4.23 - github.com/blevesearch/bleve_index_api v0.0.8 + github.com/blevesearch/bleve_index_api v1.0.0 github.com/blevesearch/go-porterstemmer v1.0.3 - github.com/blevesearch/scorch_segment_api v0.0.10 + github.com/blevesearch/scorch_segment_api v1.0.0 github.com/blevesearch/segment v0.9.0 github.com/blevesearch/snowballstem v0.9.0 - github.com/blevesearch/upsidedown_store_api v0.0.1 - github.com/blevesearch/zapx/v11 v11.1.9 - github.com/blevesearch/zapx/v12 v12.1.9 - github.com/blevesearch/zapx/v13 v13.1.9 - github.com/blevesearch/zapx/v14 v14.1.9 - github.com/blevesearch/zapx/v15 v15.1.9 + github.com/blevesearch/upsidedown_store_api v1.0.1 + github.com/blevesearch/zapx/v11 v11.1.10 + github.com/blevesearch/zapx/v12 v12.1.10 + github.com/blevesearch/zapx/v13 v13.1.10 + github.com/blevesearch/zapx/v14 v14.1.10 + github.com/blevesearch/zapx/v15 v15.1.10 github.com/couchbase/moss v0.1.0 github.com/couchbase/vellum v1.0.2 github.com/golang/protobuf v1.3.2 diff --git a/go.sum b/go.sum index e78fc6ea4..f411283ba 100644 --- a/go.sum +++ b/go.sum @@ -2,30 +2,30 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/RoaringBitmap/roaring v0.4.23 h1:gpyfd12QohbqhFO4NVDUdoPOCXsyahYRQhINmlHxKeo= github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/blevesearch/bleve_index_api v0.0.8 h1:X6kPt4vI4Ohk0GFYVuDOD/QeoF9ioM+RGYh7LHRHcvI= -github.com/blevesearch/bleve_index_api v0.0.8/go.mod h1:yq9YIbuvEQdUB0h+UiLbpDdLLnvcD5ZkqO0LS1wuSvY= +github.com/blevesearch/bleve_index_api v1.0.0 h1:Ds3XeuTxjXCkG6pgIwWDRyooJKNIuOKemnN0N0IkhTU= +github.com/blevesearch/bleve_index_api v1.0.0/go.mod h1:fiwKS0xLEm+gBRgv5mumf0dhgFr2mDgZah1pqv1c1M4= github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo= github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M= github.com/blevesearch/mmap-go v1.0.2 h1:JtMHb+FgQCTTYIhtMvimw15dJwu1Y5lrZDMOFXVWPk0= github.com/blevesearch/mmap-go v1.0.2/go.mod h1:ol2qBqYaOUsGdm7aRMRrYGgPvnwLe6Y+7LMvAB5IbSA= -github.com/blevesearch/scorch_segment_api v0.0.10 h1:38iFTfouGKXkNo/Lk1f2pr3JDdYvfCwo8BS2setHlf0= -github.com/blevesearch/scorch_segment_api v0.0.10/go.mod h1:YQapb/hcXg1fqEsUdJlTDoec8DuUHblsiIWNBwa8Wts= +github.com/blevesearch/scorch_segment_api v1.0.0 h1:BUkCPWDg2gimTEyVDXf85I2buqqt4lh28uaVMiJsIYk= +github.com/blevesearch/scorch_segment_api v1.0.0/go.mod h1:KgRYmlfYC27NeM6cXOHx8LBgq7jn0atpV8mVWoBKBng= github.com/blevesearch/segment v0.9.0 h1:5lG7yBCx98or7gK2cHMKPukPZ/31Kag7nONpoBt22Ac= github.com/blevesearch/segment v0.9.0/go.mod h1:9PfHYUdQCgHktBgvtUOF4x+pc4/l8rdH0u5spnW85UQ= github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s= github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs= -github.com/blevesearch/upsidedown_store_api v0.0.1 h1:cf3YQ6c3jvZ/gvHL6k71cshDG+nYTgL5PTWFqYXA3bg= -github.com/blevesearch/upsidedown_store_api v0.0.1/go.mod h1:jRZGTYWNqHXvOOjvT0WXHYO5Yin7U/PmTX1nevIY8yo= -github.com/blevesearch/zapx/v11 v11.1.9 h1:r+6tGcOzZGrv8qghfatrODYjRnPHdwOikLRWNCvd6Rc= -github.com/blevesearch/zapx/v11 v11.1.9/go.mod h1:9M/SGfBNfJIdYADHnuvesp4WeyFJqcNhr0pQbhT/fCg= -github.com/blevesearch/zapx/v12 v12.1.9 h1:pY4sxMni/nEwpIV98LVSI3nc7nf54QJSjNzIGOkhUHY= -github.com/blevesearch/zapx/v12 v12.1.9/go.mod h1:w2WU/Xx7WbkzKWnOqrJSM008Y60yXfNHehrICaug9QE= -github.com/blevesearch/zapx/v13 v13.1.9 h1:pAHJT4936h3OOV1hSGZx7Be4R5Duhbmu/RUQJ++59YM= -github.com/blevesearch/zapx/v13 v13.1.9/go.mod h1:nBCZXgM4vxT2JZGiPYGiOhUuqDsfEzwtB5sxhhR7XUA= -github.com/blevesearch/zapx/v14 v14.1.9 h1:p3bm1neo7Q1B9FfMUOGZh+Oyelo9eV7SotjOgRkqu+s= -github.com/blevesearch/zapx/v14 v14.1.9/go.mod h1:olLFutauzLgxrZbpozEuAl3+Ok6vvdFDc1qdk9XSIqw= -github.com/blevesearch/zapx/v15 v15.1.9 h1:Uqd10QRx/3MqrBv5p1NMVdeleaByH0O8OHc16HFMGZk= -github.com/blevesearch/zapx/v15 v15.1.9/go.mod h1:F98bkaqOw7qm1cZV2DNXRYOAuznUP+7Ksz3q0If0c4A= +github.com/blevesearch/upsidedown_store_api v1.0.1 h1:1SYRwyoFLwG3sj0ed89RLtM15amfX2pXlYbFOnF8zNU= +github.com/blevesearch/upsidedown_store_api v1.0.1/go.mod h1:MQDVGpHZrpe3Uy26zJBf/a8h0FZY6xJbthIMm8myH2Q= +github.com/blevesearch/zapx/v11 v11.1.10 h1:8Eo3rXiHsVSP9Sk+4StrrwLrj9vyulhMVPmxTf8ZuDg= +github.com/blevesearch/zapx/v11 v11.1.10/go.mod h1:DTjbcBqrr/Uo82UBilDC8lEew42gN/OcIyiTNFtSijc= +github.com/blevesearch/zapx/v12 v12.1.10 h1:sqR+/0Z4dSTovApRqLA1HnilMtQer7a4UvPrNmPzlTM= +github.com/blevesearch/zapx/v12 v12.1.10/go.mod h1:14NmKnPrnKAIyiEJM566k/Jk+FQpuiflT5d3uaaK3MI= +github.com/blevesearch/zapx/v13 v13.1.10 h1:zCneEVRJDXwtDfSwh+33Dxguliv192vCK283zdGH4Sw= +github.com/blevesearch/zapx/v13 v13.1.10/go.mod h1:YsVY6YGpTEAlJOMjdL7EsdBLvjWd8kPa2gwJDNpqLJo= +github.com/blevesearch/zapx/v14 v14.1.10 h1:nD0vw2jxKogJFfA5WyoS4wNwZlVby3Aq8aW7CZi6YIw= +github.com/blevesearch/zapx/v14 v14.1.10/go.mod h1:hsULl5eJSxs5NEfBsmeT9qrqdCP+/ecpVZKt60M4V64= +github.com/blevesearch/zapx/v15 v15.1.10 h1:kZR3b9jO9l6s2B5UHI+1N1llLzJ4nYikkXQTMrDl1vQ= +github.com/blevesearch/zapx/v15 v15.1.10/go.mod h1:4ypq25bwtSQKzwEF1UERyIhmGTbMT3brY/n4NC5gRnM= 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= diff --git a/test/tests/sort/searches.json b/test/tests/sort/searches.json index 6d34b25c0..7f7e8e208 100644 --- a/test/tests/sort/searches.json +++ b/test/tests/sort/searches.json @@ -102,14 +102,14 @@ } }, { - "comment": "sort by age, ascending", + "comment": "sort by age, ascending, _id, ascending", "search": { "from": 0, "size": 10, "query": { "match_all":{} }, - "sort": ["age"] + "sort": ["age", "_id"] }, "result": { "total_hits": 6, @@ -136,14 +136,14 @@ } }, { - "comment": "sort by age, descending", + "comment": "sort by age, descending, _id, ascending", "search": { "from": 0, "size": 10, "query": { "match_all":{} }, - "sort": ["-age"] + "sort": ["-age", "_id"] }, "result": { "total_hits": 6, From e843f84bf563f4563e9cdfb9f77c34d7dd09faea Mon Sep 17 00:00:00 2001 From: Marty Schoch Date: Tue, 12 Jan 2021 15:38:43 -0500 Subject: [PATCH 28/28] declare module v2 and update internal refs (#1538) --- analysis/analyzer/custom/custom.go | 4 +- analysis/analyzer/keyword/keyword.go | 6 +- analysis/analyzer/simple/simple.go | 8 +- analysis/analyzer/standard/standard.go | 10 +- analysis/analyzer/web/web.go | 10 +- analysis/benchmark_test.go | 6 +- analysis/char/asciifolding/asciifolding.go | 4 +- analysis/char/html/html.go | 6 +- analysis/char/regexp/regexp.go | 4 +- .../zerowidthnonjoiner/zerowidthnonjoiner.go | 6 +- analysis/datetime/flexible/flexible.go | 4 +- analysis/datetime/flexible/flexible_test.go | 2 +- analysis/datetime/optional/optional.go | 6 +- analysis/lang/ar/analyzer_ar.go | 10 +- analysis/lang/ar/analyzer_ar_test.go | 4 +- analysis/lang/ar/arabic_normalize.go | 4 +- analysis/lang/ar/arabic_normalize_test.go | 2 +- analysis/lang/ar/stemmer_ar.go | 4 +- analysis/lang/ar/stemmer_ar_test.go | 2 +- analysis/lang/ar/stop_filter_ar.go | 6 +- analysis/lang/ar/stop_words_ar.go | 4 +- analysis/lang/bg/stop_filter_bg.go | 6 +- analysis/lang/bg/stop_words_bg.go | 4 +- analysis/lang/ca/articles_ca.go | 4 +- analysis/lang/ca/elision_ca.go | 6 +- analysis/lang/ca/elision_ca_test.go | 4 +- analysis/lang/ca/stop_filter_ca.go | 6 +- analysis/lang/ca/stop_words_ca.go | 4 +- analysis/lang/cjk/analyzer_cjk.go | 8 +- analysis/lang/cjk/analyzer_cjk_test.go | 4 +- analysis/lang/cjk/cjk_bigram.go | 4 +- analysis/lang/cjk/cjk_bigram_test.go | 2 +- analysis/lang/cjk/cjk_width.go | 4 +- analysis/lang/cjk/cjk_width_test.go | 2 +- analysis/lang/ckb/analyzer_ckb.go | 8 +- analysis/lang/ckb/analyzer_ckb_test.go | 4 +- analysis/lang/ckb/sorani_normalize.go | 4 +- analysis/lang/ckb/sorani_normalize_test.go | 2 +- analysis/lang/ckb/sorani_stemmer_filter.go | 4 +- .../lang/ckb/sorani_stemmer_filter_test.go | 4 +- analysis/lang/ckb/stop_filter_ckb.go | 6 +- analysis/lang/ckb/stop_words_ckb.go | 4 +- analysis/lang/cs/stop_filter_cs.go | 6 +- analysis/lang/cs/stop_words_cs.go | 4 +- analysis/lang/da/analyzer_da.go | 8 +- analysis/lang/da/analyzer_da_test.go | 4 +- analysis/lang/da/stemmer_da.go | 4 +- analysis/lang/da/stop_filter_da.go | 6 +- analysis/lang/da/stop_words_da.go | 4 +- analysis/lang/de/analyzer_de.go | 8 +- analysis/lang/de/analyzer_de_test.go | 4 +- analysis/lang/de/german_normalize.go | 4 +- analysis/lang/de/german_normalize_test.go | 2 +- analysis/lang/de/light_stemmer_de.go | 4 +- analysis/lang/de/stemmer_de_snowball.go | 4 +- analysis/lang/de/stemmer_de_test.go | 4 +- analysis/lang/de/stop_filter_de.go | 6 +- analysis/lang/de/stop_words_de.go | 4 +- analysis/lang/el/stop_filter_el.go | 6 +- analysis/lang/el/stop_words_el.go | 4 +- analysis/lang/en/analyzer_en.go | 10 +- analysis/lang/en/analyzer_en_test.go | 4 +- analysis/lang/en/possessive_filter_en.go | 4 +- analysis/lang/en/possessive_filter_en_test.go | 4 +- analysis/lang/en/stemmer_en_snowball.go | 4 +- analysis/lang/en/stemmer_en_test.go | 4 +- analysis/lang/en/stop_filter_en.go | 6 +- analysis/lang/en/stop_words_en.go | 4 +- analysis/lang/es/analyzer_es.go | 8 +- analysis/lang/es/analyzer_es_test.go | 4 +- analysis/lang/es/light_stemmer_es.go | 4 +- analysis/lang/es/stemmer_es_snowball.go | 4 +- analysis/lang/es/stemmer_es_snowball_test.go | 4 +- analysis/lang/es/stop_filter_es.go | 6 +- analysis/lang/es/stop_words_es.go | 4 +- analysis/lang/eu/stop_filter_eu.go | 6 +- analysis/lang/eu/stop_words_eu.go | 4 +- analysis/lang/fa/analyzer_fa.go | 12 +- analysis/lang/fa/analyzer_fa_test.go | 4 +- analysis/lang/fa/persian_normalize.go | 4 +- analysis/lang/fa/persian_normalize_test.go | 2 +- analysis/lang/fa/stop_filter_fa.go | 6 +- analysis/lang/fa/stop_words_fa.go | 4 +- analysis/lang/fi/analyzer_fi.go | 8 +- analysis/lang/fi/analyzer_fi_test.go | 4 +- analysis/lang/fi/stemmer_fi.go | 4 +- analysis/lang/fi/stop_filter_fi.go | 6 +- analysis/lang/fi/stop_words_fi.go | 4 +- analysis/lang/fr/analyzer_fr.go | 8 +- analysis/lang/fr/analyzer_fr_test.go | 4 +- analysis/lang/fr/articles_fr.go | 4 +- analysis/lang/fr/elision_fr.go | 6 +- analysis/lang/fr/elision_fr_test.go | 4 +- analysis/lang/fr/light_stemmer_fr.go | 4 +- analysis/lang/fr/light_stemmer_fr_test.go | 4 +- analysis/lang/fr/minimal_stemmer_fr.go | 4 +- analysis/lang/fr/minimal_stemmer_fr_test.go | 4 +- analysis/lang/fr/stemmer_fr_snowball.go | 4 +- analysis/lang/fr/stemmer_fr_snowball_test.go | 4 +- analysis/lang/fr/stop_filter_fr.go | 6 +- analysis/lang/fr/stop_words_fr.go | 4 +- analysis/lang/ga/articles_ga.go | 4 +- analysis/lang/ga/elision_ga.go | 6 +- analysis/lang/ga/elision_ga_test.go | 4 +- analysis/lang/ga/stop_filter_ga.go | 6 +- analysis/lang/ga/stop_words_ga.go | 4 +- analysis/lang/gl/stop_filter_gl.go | 6 +- analysis/lang/gl/stop_words_gl.go | 4 +- analysis/lang/hi/analyzer_hi.go | 10 +- analysis/lang/hi/analyzer_hi_test.go | 4 +- analysis/lang/hi/hindi_normalize.go | 4 +- analysis/lang/hi/hindi_normalize_test.go | 2 +- analysis/lang/hi/hindi_stemmer_filter.go | 4 +- analysis/lang/hi/hindi_stemmer_filter_test.go | 2 +- analysis/lang/hi/stop_filter_hi.go | 6 +- analysis/lang/hi/stop_words_hi.go | 4 +- analysis/lang/hu/analyzer_hu.go | 8 +- analysis/lang/hu/analyzer_hu_test.go | 4 +- analysis/lang/hu/stemmer_hu.go | 4 +- analysis/lang/hu/stop_filter_hu.go | 6 +- analysis/lang/hu/stop_words_hu.go | 4 +- analysis/lang/hy/stop_filter_hy.go | 6 +- analysis/lang/hy/stop_words_hy.go | 4 +- analysis/lang/id/stop_filter_id.go | 6 +- analysis/lang/id/stop_words_id.go | 4 +- analysis/lang/in/indic_normalize.go | 4 +- analysis/lang/in/indic_normalize_test.go | 2 +- analysis/lang/in/scripts.go | 2 +- analysis/lang/it/analyzer_it.go | 8 +- analysis/lang/it/analyzer_it_test.go | 4 +- analysis/lang/it/articles_it.go | 4 +- analysis/lang/it/elision_it.go | 6 +- analysis/lang/it/elision_it_test.go | 4 +- analysis/lang/it/light_stemmer_it.go | 4 +- analysis/lang/it/light_stemmer_it_test.go | 4 +- analysis/lang/it/stemmer_it_snowball.go | 4 +- analysis/lang/it/stemmer_it_snowball_test.go | 4 +- analysis/lang/it/stop_filter_it.go | 6 +- analysis/lang/it/stop_words_it.go | 4 +- analysis/lang/nl/analyzer_nl.go | 8 +- analysis/lang/nl/analyzer_nl_test.go | 4 +- analysis/lang/nl/stemmer_nl.go | 4 +- analysis/lang/nl/stop_filter_nl.go | 6 +- analysis/lang/nl/stop_words_nl.go | 4 +- analysis/lang/no/analyzer_no.go | 8 +- analysis/lang/no/analyzer_no_test.go | 4 +- analysis/lang/no/stemmer_no.go | 4 +- analysis/lang/no/stop_filter_no.go | 6 +- analysis/lang/no/stop_words_no.go | 4 +- analysis/lang/pt/analyzer_pt.go | 8 +- analysis/lang/pt/analyzer_pt_test.go | 4 +- analysis/lang/pt/light_stemmer_pt.go | 4 +- analysis/lang/pt/light_stemmer_pt_test.go | 4 +- analysis/lang/pt/stop_filter_pt.go | 6 +- analysis/lang/pt/stop_words_pt.go | 4 +- analysis/lang/ro/analyzer_ro.go | 8 +- analysis/lang/ro/analyzer_ro_test.go | 4 +- analysis/lang/ro/stemmer_ro.go | 4 +- analysis/lang/ro/stop_filter_ro.go | 6 +- analysis/lang/ro/stop_words_ro.go | 4 +- analysis/lang/ru/analyzer_ru.go | 8 +- analysis/lang/ru/analyzer_ru_test.go | 4 +- analysis/lang/ru/stemmer_ru.go | 4 +- analysis/lang/ru/stemmer_ru_test.go | 4 +- analysis/lang/ru/stop_filter_ru.go | 6 +- analysis/lang/ru/stop_words_ru.go | 4 +- analysis/lang/sv/analyzer_sv.go | 8 +- analysis/lang/sv/analyzer_sv_test.go | 4 +- analysis/lang/sv/stemmer_sv.go | 4 +- analysis/lang/sv/stop_filter_sv.go | 6 +- analysis/lang/sv/stop_words_sv.go | 4 +- analysis/lang/tr/analyzer_tr.go | 10 +- analysis/lang/tr/analyzer_tr_test.go | 4 +- analysis/lang/tr/stemmer_tr.go | 4 +- analysis/lang/tr/stop_filter_tr.go | 6 +- analysis/lang/tr/stop_words_tr.go | 4 +- analysis/token/apostrophe/apostrophe.go | 4 +- analysis/token/apostrophe/apostrophe_test.go | 2 +- analysis/token/camelcase/camelcase.go | 4 +- analysis/token/camelcase/camelcase_test.go | 2 +- analysis/token/camelcase/parser.go | 2 +- analysis/token/compound/dict.go | 4 +- analysis/token/compound/dict_test.go | 6 +- analysis/token/edgengram/edgengram.go | 4 +- analysis/token/edgengram/edgengram_test.go | 2 +- analysis/token/elision/elision.go | 4 +- analysis/token/elision/elision_test.go | 6 +- analysis/token/keyword/keyword.go | 4 +- analysis/token/keyword/keyword_test.go | 2 +- analysis/token/length/length.go | 4 +- analysis/token/length/length_test.go | 2 +- analysis/token/lowercase/lowercase.go | 4 +- analysis/token/lowercase/lowercase_test.go | 2 +- analysis/token/ngram/ngram.go | 4 +- analysis/token/ngram/ngram_test.go | 2 +- analysis/token/porter/porter.go | 4 +- analysis/token/porter/porter_test.go | 2 +- analysis/token/reverse/reverse.go | 4 +- analysis/token/reverse/reverse_test.go | 2 +- analysis/token/shingle/shingle.go | 4 +- analysis/token/shingle/shingle_test.go | 2 +- analysis/token/snowball/snowball.go | 4 +- analysis/token/snowball/snowball_test.go | 2 +- analysis/token/stop/stop.go | 4 +- analysis/token/stop/stop_test.go | 6 +- analysis/token/truncate/truncate.go | 4 +- analysis/token/truncate/truncate_test.go | 2 +- analysis/token/unicodenorm/unicodenorm.go | 4 +- .../token/unicodenorm/unicodenorm_test.go | 2 +- analysis/token/unique/unique.go | 4 +- analysis/token/unique/unique_test.go | 2 +- analysis/tokenizer/character/character.go | 2 +- .../tokenizer/character/character_test.go | 2 +- analysis/tokenizer/exception/exception.go | 4 +- .../tokenizer/exception/exception_test.go | 6 +- analysis/tokenizer/letter/letter.go | 6 +- analysis/tokenizer/regexp/regexp.go | 4 +- analysis/tokenizer/regexp/regexp_test.go | 2 +- analysis/tokenizer/single/single.go | 4 +- analysis/tokenizer/single/single_test.go | 2 +- analysis/tokenizer/unicode/unicode.go | 4 +- analysis/tokenizer/unicode/unicode_test.go | 2 +- analysis/tokenizer/web/web.go | 8 +- analysis/tokenizer/web/web_test.go | 4 +- analysis/tokenizer/whitespace/whitespace.go | 6 +- .../tokenizer/whitespace/whitespace_test.go | 4 +- analysis/tokenmap/custom.go | 4 +- builder.go | 6 +- cmd/bleve/cmd/check.go | 2 +- cmd/bleve/cmd/create.go | 4 +- cmd/bleve/cmd/dump.go | 2 +- cmd/bleve/cmd/dumpDoc.go | 2 +- cmd/bleve/cmd/dumpFields.go | 2 +- cmd/bleve/cmd/query.go | 4 +- cmd/bleve/cmd/registry.go | 2 +- cmd/bleve/cmd/root.go | 2 +- cmd/bleve/cmd/scorch.go | 2 +- cmd/bleve/cmd/scorch/ascii.go | 2 +- cmd/bleve/cmd/scorch/root.go | 2 +- cmd/bleve/gendocs.go | 2 +- cmd/bleve/main.go | 4 +- config.go | 8 +- config/config.go | 148 +++++++++--------- config_disk.go | 2 +- document/document.go | 2 +- document/field_boolean.go | 4 +- document/field_composite.go | 2 +- document/field_datetime.go | 6 +- document/field_geopoint.go | 8 +- document/field_numeric.go | 6 +- document/field_text.go | 4 +- examples_test.go | 6 +- geo/geo.go | 2 +- go.mod | 2 +- http/debug.go | 2 +- http/index_create.go | 2 +- http/index_get.go | 2 +- http/registry.go | 2 +- http/search.go | 4 +- index.go | 8 +- index/scorch/builder_test.go | 2 +- index/scorch/event_test.go | 2 +- index/scorch/field_dict_test.go | 2 +- index/scorch/merge.go | 2 +- index/scorch/merge_test.go | 2 +- index/scorch/reader_test.go | 2 +- index/scorch/rollback_test.go | 2 +- index/scorch/scorch.go | 2 +- index/scorch/scorch_test.go | 14 +- index/scorch/snapshot_index.go | 2 +- index/scorch/snapshot_index_doc.go | 2 +- index/scorch/snapshot_index_tfr.go | 2 +- index/scorch/snapshot_segment.go | 2 +- index/upsidedown/analysis_test.go | 8 +- index/upsidedown/benchmark_boltdb_test.go | 2 +- index/upsidedown/benchmark_common_test.go | 6 +- index/upsidedown/benchmark_gtreap_test.go | 2 +- index/upsidedown/benchmark_null_test.go | 2 +- index/upsidedown/dump_test.go | 4 +- index/upsidedown/field_dict_test.go | 4 +- index/upsidedown/index_reader.go | 2 +- index/upsidedown/reader.go | 2 +- index/upsidedown/reader_test.go | 4 +- index/upsidedown/row.go | 2 +- index/upsidedown/store/boltdb/store.go | 2 +- index/upsidedown/store/goleveldb/store.go | 2 +- index/upsidedown/store/gtreap/store.go | 2 +- .../upsidedown/store/metrics/metrics_test.go | 2 +- index/upsidedown/store/metrics/store.go | 2 +- index/upsidedown/store/metrics/store_test.go | 2 +- index/upsidedown/store/moss/lower.go | 2 +- index/upsidedown/store/moss/store.go | 2 +- index/upsidedown/store/null/null.go | 2 +- index/upsidedown/upsidedown.go | 4 +- index/upsidedown/upsidedown_test.go | 14 +- index_alias_impl.go | 4 +- index_alias_impl_test.go | 8 +- index_impl.go | 16 +- index_meta.go | 2 +- index_test.go | 20 +-- mapping.go | 2 +- mapping/document.go | 2 +- mapping/field.go | 6 +- mapping/index.go | 18 +-- mapping/mapping.go | 4 +- mapping/mapping_test.go | 6 +- query.go | 2 +- registry/analyzer.go | 2 +- registry/char_filter.go | 2 +- registry/datetime_parser.go | 2 +- registry/fragment_formatter.go | 2 +- registry/fragmenter.go | 2 +- registry/highlighter.go | 2 +- registry/registry.go | 4 +- registry/token_filter.go | 2 +- registry/token_maps.go | 2 +- registry/tokenizer.go | 2 +- search.go | 16 +- search/collector/bench_test.go | 2 +- search/collector/heap.go | 2 +- search/collector/list.go | 2 +- search/collector/search_test.go | 2 +- search/collector/slice.go | 2 +- search/collector/topn.go | 4 +- search/collector/topn_test.go | 2 +- search/explanation.go | 2 +- search/facet/facet_builder_datetime.go | 6 +- search/facet/facet_builder_numeric.go | 6 +- search/facet/facet_builder_numeric_test.go | 2 +- search/facet/facet_builder_terms.go | 4 +- search/facets_builder.go | 2 +- search/highlight/format/ansi/ansi.go | 4 +- search/highlight/format/html/html.go | 4 +- search/highlight/format/html/html_test.go | 4 +- search/highlight/fragmenter/simple/simple.go | 4 +- .../fragmenter/simple/simple_test.go | 2 +- search/highlight/highlighter.go | 2 +- search/highlight/highlighter/ansi/ansi.go | 10 +- search/highlight/highlighter/html/html.go | 10 +- .../simple/fragment_scorer_simple.go | 4 +- .../simple/fragment_scorer_simple_test.go | 4 +- .../highlighter/simple/highlighter_simple.go | 6 +- .../simple/highlighter_simple_test.go | 8 +- search/highlight/term_locations.go | 2 +- search/highlight/term_locations_test.go | 2 +- search/query/bool_field.go | 6 +- search/query/boolean.go | 6 +- search/query/conjunction.go | 6 +- search/query/date_range.go | 12 +- search/query/disjunction.go | 6 +- search/query/docid.go | 6 +- search/query/fuzzy.go | 6 +- search/query/geo_boundingbox.go | 8 +- search/query/geo_boundingpolygon.go | 8 +- search/query/geo_distance.go | 8 +- search/query/match.go | 4 +- search/query/match_all.go | 6 +- search/query/match_none.go | 6 +- search/query/match_phrase.go | 6 +- search/query/match_phrase_test.go | 2 +- search/query/multi_phrase.go | 6 +- search/query/numeric_range.go | 6 +- search/query/phrase.go | 6 +- search/query/prefix.go | 6 +- search/query/query.go | 4 +- search/query/query_string.go | 4 +- search/query/query_string_parser_test.go | 2 +- search/query/query_test.go | 2 +- search/query/regexp.go | 6 +- search/query/term.go | 6 +- search/query/term_range.go | 6 +- search/query/wildcard.go | 6 +- search/scorer/scorer_conjunction.go | 4 +- search/scorer/scorer_constant.go | 4 +- search/scorer/scorer_constant_test.go | 2 +- search/scorer/scorer_disjunction.go | 4 +- search/scorer/scorer_term.go | 4 +- search/scorer/scorer_term_test.go | 2 +- search/search.go | 2 +- search/searcher/base_test.go | 12 +- search/searcher/ordered_searchers_list.go | 2 +- search/searcher/search_boolean.go | 6 +- search/searcher/search_boolean_test.go | 2 +- search/searcher/search_conjunction.go | 6 +- search/searcher/search_conjunction_test.go | 4 +- search/searcher/search_disjunction.go | 2 +- search/searcher/search_disjunction_heap.go | 6 +- search/searcher/search_disjunction_slice.go | 6 +- search/searcher/search_disjunction_test.go | 2 +- search/searcher/search_docid.go | 6 +- search/searcher/search_docid_test.go | 8 +- search/searcher/search_filter.go | 4 +- search/searcher/search_fuzzy.go | 2 +- search/searcher/search_fuzzy_test.go | 2 +- search/searcher/search_geoboundingbox.go | 8 +- search/searcher/search_geoboundingbox_test.go | 12 +- search/searcher/search_geopointdistance.go | 6 +- .../searcher/search_geopointdistance_test.go | 4 +- search/searcher/search_geopolygon.go | 6 +- search/searcher/search_geopolygon_test.go | 10 +- search/searcher/search_match_all.go | 6 +- search/searcher/search_match_all_test.go | 2 +- search/searcher/search_match_none.go | 4 +- search/searcher/search_match_none_test.go | 2 +- search/searcher/search_multi_term.go | 2 +- search/searcher/search_numeric_range.go | 4 +- search/searcher/search_numeric_range_test.go | 2 +- search/searcher/search_phrase.go | 4 +- search/searcher/search_phrase_test.go | 2 +- search/searcher/search_regexp.go | 2 +- search/searcher/search_regexp_test.go | 2 +- search/searcher/search_term.go | 6 +- search/searcher/search_term_prefix.go | 2 +- search/searcher/search_term_range.go | 2 +- search/searcher/search_term_range_test.go | 4 +- search/searcher/search_term_test.go | 8 +- search/sort.go | 4 +- search_test.go | 36 ++--- test/integration.go | 2 +- test/integration_test.go | 6 +- test/versus_score_test.go | 12 +- test/versus_test.go | 12 +- 422 files changed, 1032 insertions(+), 1032 deletions(-) diff --git a/analysis/analyzer/custom/custom.go b/analysis/analyzer/custom/custom.go index bcd4d42db..70e7a2699 100644 --- a/analysis/analyzer/custom/custom.go +++ b/analysis/analyzer/custom/custom.go @@ -17,8 +17,8 @@ package custom import ( "fmt" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "custom" diff --git a/analysis/analyzer/keyword/keyword.go b/analysis/analyzer/keyword/keyword.go index 2a6c1aff7..473c29471 100644 --- a/analysis/analyzer/keyword/keyword.go +++ b/analysis/analyzer/keyword/keyword.go @@ -15,9 +15,9 @@ package keyword import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/tokenizer/single" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/single" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "keyword" diff --git a/analysis/analyzer/simple/simple.go b/analysis/analyzer/simple/simple.go index f8cf95066..46a715c2b 100644 --- a/analysis/analyzer/simple/simple.go +++ b/analysis/analyzer/simple/simple.go @@ -15,10 +15,10 @@ package simple import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/letter" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/letter" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "simple" diff --git a/analysis/analyzer/standard/standard.go b/analysis/analyzer/standard/standard.go index 74ea564ea..80a481be0 100644 --- a/analysis/analyzer/standard/standard.go +++ b/analysis/analyzer/standard/standard.go @@ -15,11 +15,11 @@ package standard import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/lang/en" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/lang/en" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "standard" diff --git a/analysis/analyzer/web/web.go b/analysis/analyzer/web/web.go index 3d597ba03..5d4145bd1 100644 --- a/analysis/analyzer/web/web.go +++ b/analysis/analyzer/web/web.go @@ -15,11 +15,11 @@ package web import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/lang/en" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/web" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/lang/en" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/web" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "web" diff --git a/analysis/benchmark_test.go b/analysis/benchmark_test.go index 216e423c2..c5b6647aa 100644 --- a/analysis/benchmark_test.go +++ b/analysis/benchmark_test.go @@ -18,9 +18,9 @@ import ( index "github.com/blevesearch/bleve_index_api" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/analyzer/standard" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/analyzer/standard" + "github.com/blevesearch/bleve/v2/registry" ) func BenchmarkAnalysis(b *testing.B) { diff --git a/analysis/char/asciifolding/asciifolding.go b/analysis/char/asciifolding/asciifolding.go index facce07e1..4b422aed8 100644 --- a/analysis/char/asciifolding/asciifolding.go +++ b/analysis/char/asciifolding/asciifolding.go @@ -18,8 +18,8 @@ package asciifolding import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "asciifolding" diff --git a/analysis/char/html/html.go b/analysis/char/html/html.go index a16677b06..922edef3e 100644 --- a/analysis/char/html/html.go +++ b/analysis/char/html/html.go @@ -17,9 +17,9 @@ package html import ( "regexp" - "github.com/blevesearch/bleve/analysis" - regexpCharFilter "github.com/blevesearch/bleve/analysis/char/regexp" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + regexpCharFilter "github.com/blevesearch/bleve/v2/analysis/char/regexp" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "html" diff --git a/analysis/char/regexp/regexp.go b/analysis/char/regexp/regexp.go index fc344b312..b645322d5 100644 --- a/analysis/char/regexp/regexp.go +++ b/analysis/char/regexp/regexp.go @@ -18,8 +18,8 @@ import ( "fmt" "regexp" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "regexp" diff --git a/analysis/char/zerowidthnonjoiner/zerowidthnonjoiner.go b/analysis/char/zerowidthnonjoiner/zerowidthnonjoiner.go index 8d160d7ac..991f90918 100644 --- a/analysis/char/zerowidthnonjoiner/zerowidthnonjoiner.go +++ b/analysis/char/zerowidthnonjoiner/zerowidthnonjoiner.go @@ -17,9 +17,9 @@ package zerowidthnonjoiner import ( "regexp" - "github.com/blevesearch/bleve/analysis" - regexpCharFilter "github.com/blevesearch/bleve/analysis/char/regexp" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + regexpCharFilter "github.com/blevesearch/bleve/v2/analysis/char/regexp" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "zero_width_spaces" diff --git a/analysis/datetime/flexible/flexible.go b/analysis/datetime/flexible/flexible.go index cd549f55f..0eba074cd 100644 --- a/analysis/datetime/flexible/flexible.go +++ b/analysis/datetime/flexible/flexible.go @@ -18,8 +18,8 @@ import ( "fmt" "time" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "flexiblego" diff --git a/analysis/datetime/flexible/flexible_test.go b/analysis/datetime/flexible/flexible_test.go index 644d91eb0..e4d1d5dc1 100644 --- a/analysis/datetime/flexible/flexible_test.go +++ b/analysis/datetime/flexible/flexible_test.go @@ -19,7 +19,7 @@ import ( "testing" "time" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestFlexibleDateTimeParser(t *testing.T) { diff --git a/analysis/datetime/optional/optional.go b/analysis/datetime/optional/optional.go index 4b98de666..196aa25cb 100644 --- a/analysis/datetime/optional/optional.go +++ b/analysis/datetime/optional/optional.go @@ -17,9 +17,9 @@ package optional import ( "time" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/datetime/flexible" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/datetime/flexible" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "dateTimeOptional" diff --git a/analysis/lang/ar/analyzer_ar.go b/analysis/lang/ar/analyzer_ar.go index 29132a697..e6f1f8f30 100644 --- a/analysis/lang/ar/analyzer_ar.go +++ b/analysis/lang/ar/analyzer_ar.go @@ -15,12 +15,12 @@ package ar import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/token/unicodenorm" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/token/unicodenorm" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" ) const AnalyzerName = "ar" diff --git a/analysis/lang/ar/analyzer_ar_test.go b/analysis/lang/ar/analyzer_ar_test.go index 13b66e2a3..437d69fd9 100644 --- a/analysis/lang/ar/analyzer_ar_test.go +++ b/analysis/lang/ar/analyzer_ar_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestArabicAnalyzer(t *testing.T) { diff --git a/analysis/lang/ar/arabic_normalize.go b/analysis/lang/ar/arabic_normalize.go index 50829397d..8fdb89904 100644 --- a/analysis/lang/ar/arabic_normalize.go +++ b/analysis/lang/ar/arabic_normalize.go @@ -17,8 +17,8 @@ package ar import ( "bytes" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const NormalizeName = "normalize_ar" diff --git a/analysis/lang/ar/arabic_normalize_test.go b/analysis/lang/ar/arabic_normalize_test.go index 9a313acdf..e3f472ee9 100644 --- a/analysis/lang/ar/arabic_normalize_test.go +++ b/analysis/lang/ar/arabic_normalize_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestArabicNormalizeFilter(t *testing.T) { diff --git a/analysis/lang/ar/stemmer_ar.go b/analysis/lang/ar/stemmer_ar.go index 5165cf06c..d4540e1dd 100644 --- a/analysis/lang/ar/stemmer_ar.go +++ b/analysis/lang/ar/stemmer_ar.go @@ -17,8 +17,8 @@ package ar import ( "bytes" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StemmerName = "stemmer_ar" diff --git a/analysis/lang/ar/stemmer_ar_test.go b/analysis/lang/ar/stemmer_ar_test.go index ff8f89c0b..dfc1e82ca 100644 --- a/analysis/lang/ar/stemmer_ar_test.go +++ b/analysis/lang/ar/stemmer_ar_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestArabicStemmerFilter(t *testing.T) { diff --git a/analysis/lang/ar/stop_filter_ar.go b/analysis/lang/ar/stop_filter_ar.go index cb532e605..d8af36022 100644 --- a/analysis/lang/ar/stop_filter_ar.go +++ b/analysis/lang/ar/stop_filter_ar.go @@ -15,9 +15,9 @@ package ar import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/ar/stop_words_ar.go b/analysis/lang/ar/stop_words_ar.go index 09e9a5997..2d1bd56d6 100644 --- a/analysis/lang/ar/stop_words_ar.go +++ b/analysis/lang/ar/stop_words_ar.go @@ -1,8 +1,8 @@ package ar import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_ar" diff --git a/analysis/lang/bg/stop_filter_bg.go b/analysis/lang/bg/stop_filter_bg.go index 821210c92..97bbabe14 100644 --- a/analysis/lang/bg/stop_filter_bg.go +++ b/analysis/lang/bg/stop_filter_bg.go @@ -15,9 +15,9 @@ package bg import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/bg/stop_words_bg.go b/analysis/lang/bg/stop_words_bg.go index a063ed9ab..0bddc22ce 100644 --- a/analysis/lang/bg/stop_words_bg.go +++ b/analysis/lang/bg/stop_words_bg.go @@ -1,8 +1,8 @@ package bg import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_bg" diff --git a/analysis/lang/ca/articles_ca.go b/analysis/lang/ca/articles_ca.go index 7d52cb165..09308f39f 100644 --- a/analysis/lang/ca/articles_ca.go +++ b/analysis/lang/ca/articles_ca.go @@ -1,8 +1,8 @@ package ca import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const ArticlesName = "articles_ca" diff --git a/analysis/lang/ca/elision_ca.go b/analysis/lang/ca/elision_ca.go index 201da0c78..46ee3c622 100644 --- a/analysis/lang/ca/elision_ca.go +++ b/analysis/lang/ca/elision_ca.go @@ -17,9 +17,9 @@ package ca import ( "fmt" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/elision" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/elision" + "github.com/blevesearch/bleve/v2/registry" ) const ElisionName = "elision_ca" diff --git a/analysis/lang/ca/elision_ca_test.go b/analysis/lang/ca/elision_ca_test.go index 79a1be4ce..2a9d6a581 100644 --- a/analysis/lang/ca/elision_ca_test.go +++ b/analysis/lang/ca/elision_ca_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestFrenchElision(t *testing.T) { diff --git a/analysis/lang/ca/stop_filter_ca.go b/analysis/lang/ca/stop_filter_ca.go index 99f72da0f..2864a4267 100644 --- a/analysis/lang/ca/stop_filter_ca.go +++ b/analysis/lang/ca/stop_filter_ca.go @@ -15,9 +15,9 @@ package ca import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/ca/stop_words_ca.go b/analysis/lang/ca/stop_words_ca.go index d88dfc316..93621df1f 100644 --- a/analysis/lang/ca/stop_words_ca.go +++ b/analysis/lang/ca/stop_words_ca.go @@ -1,8 +1,8 @@ package ca import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_ca" diff --git a/analysis/lang/cjk/analyzer_cjk.go b/analysis/lang/cjk/analyzer_cjk.go index 5ea0661c2..d7c1142cf 100644 --- a/analysis/lang/cjk/analyzer_cjk.go +++ b/analysis/lang/cjk/analyzer_cjk.go @@ -15,11 +15,11 @@ package cjk import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" ) const AnalyzerName = "cjk" diff --git a/analysis/lang/cjk/analyzer_cjk_test.go b/analysis/lang/cjk/analyzer_cjk_test.go index b402ed783..afd895788 100644 --- a/analysis/lang/cjk/analyzer_cjk_test.go +++ b/analysis/lang/cjk/analyzer_cjk_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestCJKAnalyzer(t *testing.T) { diff --git a/analysis/lang/cjk/cjk_bigram.go b/analysis/lang/cjk/cjk_bigram.go index 8851e0c0f..fcb80151d 100644 --- a/analysis/lang/cjk/cjk_bigram.go +++ b/analysis/lang/cjk/cjk_bigram.go @@ -19,8 +19,8 @@ import ( "container/ring" "unicode/utf8" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const BigramName = "cjk_bigram" diff --git a/analysis/lang/cjk/cjk_bigram_test.go b/analysis/lang/cjk/cjk_bigram_test.go index 9f5eff08f..d1b5d0008 100644 --- a/analysis/lang/cjk/cjk_bigram_test.go +++ b/analysis/lang/cjk/cjk_bigram_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestCJKBigramFilter(t *testing.T) { diff --git a/analysis/lang/cjk/cjk_width.go b/analysis/lang/cjk/cjk_width.go index 7191ea533..d5b15e74c 100644 --- a/analysis/lang/cjk/cjk_width.go +++ b/analysis/lang/cjk/cjk_width.go @@ -18,8 +18,8 @@ import ( "bytes" "unicode/utf8" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const WidthName = "cjk_width" diff --git a/analysis/lang/cjk/cjk_width_test.go b/analysis/lang/cjk/cjk_width_test.go index c0d4e2902..5533ae22f 100644 --- a/analysis/lang/cjk/cjk_width_test.go +++ b/analysis/lang/cjk/cjk_width_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestCJKWidthFilter(t *testing.T) { diff --git a/analysis/lang/ckb/analyzer_ckb.go b/analysis/lang/ckb/analyzer_ckb.go index da3d804e0..a71b0f82a 100644 --- a/analysis/lang/ckb/analyzer_ckb.go +++ b/analysis/lang/ckb/analyzer_ckb.go @@ -15,10 +15,10 @@ package ckb import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/registry" ) const AnalyzerName = "ckb" diff --git a/analysis/lang/ckb/analyzer_ckb_test.go b/analysis/lang/ckb/analyzer_ckb_test.go index 666a30129..9e6adab8e 100644 --- a/analysis/lang/ckb/analyzer_ckb_test.go +++ b/analysis/lang/ckb/analyzer_ckb_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestSoraniAnalyzer(t *testing.T) { diff --git a/analysis/lang/ckb/sorani_normalize.go b/analysis/lang/ckb/sorani_normalize.go index f64cedf53..a1d6d7378 100644 --- a/analysis/lang/ckb/sorani_normalize.go +++ b/analysis/lang/ckb/sorani_normalize.go @@ -18,8 +18,8 @@ import ( "bytes" "unicode" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const NormalizeName = "normalize_ckb" diff --git a/analysis/lang/ckb/sorani_normalize_test.go b/analysis/lang/ckb/sorani_normalize_test.go index fe10a5cb2..0fb0fcd60 100644 --- a/analysis/lang/ckb/sorani_normalize_test.go +++ b/analysis/lang/ckb/sorani_normalize_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestSoraniNormalizeFilter(t *testing.T) { diff --git a/analysis/lang/ckb/sorani_stemmer_filter.go b/analysis/lang/ckb/sorani_stemmer_filter.go index 41787314c..c96b0a1b3 100644 --- a/analysis/lang/ckb/sorani_stemmer_filter.go +++ b/analysis/lang/ckb/sorani_stemmer_filter.go @@ -18,8 +18,8 @@ import ( "bytes" "unicode/utf8" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StemmerName = "stemmer_ckb" diff --git a/analysis/lang/ckb/sorani_stemmer_filter_test.go b/analysis/lang/ckb/sorani_stemmer_filter_test.go index e6dd7b177..c0d847c47 100644 --- a/analysis/lang/ckb/sorani_stemmer_filter_test.go +++ b/analysis/lang/ckb/sorani_stemmer_filter_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/tokenizer/single" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/single" ) func TestSoraniStemmerFilter(t *testing.T) { diff --git a/analysis/lang/ckb/stop_filter_ckb.go b/analysis/lang/ckb/stop_filter_ckb.go index a6ea259f3..7584935db 100644 --- a/analysis/lang/ckb/stop_filter_ckb.go +++ b/analysis/lang/ckb/stop_filter_ckb.go @@ -15,9 +15,9 @@ package ckb import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/ckb/stop_words_ckb.go b/analysis/lang/ckb/stop_words_ckb.go index 707a3b167..e82b6a586 100644 --- a/analysis/lang/ckb/stop_words_ckb.go +++ b/analysis/lang/ckb/stop_words_ckb.go @@ -1,8 +1,8 @@ package ckb import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_ckb" diff --git a/analysis/lang/cs/stop_filter_cs.go b/analysis/lang/cs/stop_filter_cs.go index 2267cea73..b63b7a040 100644 --- a/analysis/lang/cs/stop_filter_cs.go +++ b/analysis/lang/cs/stop_filter_cs.go @@ -15,9 +15,9 @@ package cs import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/cs/stop_words_cs.go b/analysis/lang/cs/stop_words_cs.go index 71f9c43ed..ad8ce9099 100644 --- a/analysis/lang/cs/stop_words_cs.go +++ b/analysis/lang/cs/stop_words_cs.go @@ -1,8 +1,8 @@ package cs import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_cs" diff --git a/analysis/lang/da/analyzer_da.go b/analysis/lang/da/analyzer_da.go index dca141779..5ee8428f3 100644 --- a/analysis/lang/da/analyzer_da.go +++ b/analysis/lang/da/analyzer_da.go @@ -15,10 +15,10 @@ package da import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/registry" ) const AnalyzerName = "da" diff --git a/analysis/lang/da/analyzer_da_test.go b/analysis/lang/da/analyzer_da_test.go index d6a1c51a4..e22f32567 100644 --- a/analysis/lang/da/analyzer_da_test.go +++ b/analysis/lang/da/analyzer_da_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestDanishAnalyzer(t *testing.T) { diff --git a/analysis/lang/da/stemmer_da.go b/analysis/lang/da/stemmer_da.go index e40e623ab..ce09f33b7 100644 --- a/analysis/lang/da/stemmer_da.go +++ b/analysis/lang/da/stemmer_da.go @@ -15,8 +15,8 @@ package da import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" "github.com/blevesearch/snowballstem" "github.com/blevesearch/snowballstem/danish" diff --git a/analysis/lang/da/stop_filter_da.go b/analysis/lang/da/stop_filter_da.go index a146d0b43..e315491af 100644 --- a/analysis/lang/da/stop_filter_da.go +++ b/analysis/lang/da/stop_filter_da.go @@ -15,9 +15,9 @@ package da import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/da/stop_words_da.go b/analysis/lang/da/stop_words_da.go index 63a407a0c..39c5f6a03 100644 --- a/analysis/lang/da/stop_words_da.go +++ b/analysis/lang/da/stop_words_da.go @@ -1,8 +1,8 @@ package da import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_da" diff --git a/analysis/lang/de/analyzer_de.go b/analysis/lang/de/analyzer_de.go index dcf4e8e93..632ab8dfa 100644 --- a/analysis/lang/de/analyzer_de.go +++ b/analysis/lang/de/analyzer_de.go @@ -15,10 +15,10 @@ package de import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/registry" ) const AnalyzerName = "de" diff --git a/analysis/lang/de/analyzer_de_test.go b/analysis/lang/de/analyzer_de_test.go index 18e2683b3..f404ded94 100644 --- a/analysis/lang/de/analyzer_de_test.go +++ b/analysis/lang/de/analyzer_de_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestGermanAnalyzer(t *testing.T) { diff --git a/analysis/lang/de/german_normalize.go b/analysis/lang/de/german_normalize.go index 370efcbec..84688f137 100644 --- a/analysis/lang/de/german_normalize.go +++ b/analysis/lang/de/german_normalize.go @@ -17,8 +17,8 @@ package de import ( "bytes" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const NormalizeName = "normalize_de" diff --git a/analysis/lang/de/german_normalize_test.go b/analysis/lang/de/german_normalize_test.go index b95a7190e..81a60f5cc 100644 --- a/analysis/lang/de/german_normalize_test.go +++ b/analysis/lang/de/german_normalize_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestGermanNormalizeFilter(t *testing.T) { diff --git a/analysis/lang/de/light_stemmer_de.go b/analysis/lang/de/light_stemmer_de.go index c1a093c5d..48bcf274d 100644 --- a/analysis/lang/de/light_stemmer_de.go +++ b/analysis/lang/de/light_stemmer_de.go @@ -17,8 +17,8 @@ package de import ( "bytes" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const LightStemmerName = "stemmer_de_light" diff --git a/analysis/lang/de/stemmer_de_snowball.go b/analysis/lang/de/stemmer_de_snowball.go index efda0660b..35afdd96b 100644 --- a/analysis/lang/de/stemmer_de_snowball.go +++ b/analysis/lang/de/stemmer_de_snowball.go @@ -15,8 +15,8 @@ package de import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" "github.com/blevesearch/snowballstem" "github.com/blevesearch/snowballstem/german" diff --git a/analysis/lang/de/stemmer_de_test.go b/analysis/lang/de/stemmer_de_test.go index a319f7273..5810ec447 100644 --- a/analysis/lang/de/stemmer_de_test.go +++ b/analysis/lang/de/stemmer_de_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestSnowballGermanStemmer(t *testing.T) { diff --git a/analysis/lang/de/stop_filter_de.go b/analysis/lang/de/stop_filter_de.go index bcc423f00..b97d1a185 100644 --- a/analysis/lang/de/stop_filter_de.go +++ b/analysis/lang/de/stop_filter_de.go @@ -15,9 +15,9 @@ package de import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/de/stop_words_de.go b/analysis/lang/de/stop_words_de.go index b71c8f70b..83ea0b557 100644 --- a/analysis/lang/de/stop_words_de.go +++ b/analysis/lang/de/stop_words_de.go @@ -1,8 +1,8 @@ package de import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_de" diff --git a/analysis/lang/el/stop_filter_el.go b/analysis/lang/el/stop_filter_el.go index 652b8cb73..17bfd9f27 100644 --- a/analysis/lang/el/stop_filter_el.go +++ b/analysis/lang/el/stop_filter_el.go @@ -15,9 +15,9 @@ package el import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/el/stop_words_el.go b/analysis/lang/el/stop_words_el.go index 10755d280..1e8455631 100644 --- a/analysis/lang/el/stop_words_el.go +++ b/analysis/lang/el/stop_words_el.go @@ -1,8 +1,8 @@ package el import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_el" diff --git a/analysis/lang/en/analyzer_en.go b/analysis/lang/en/analyzer_en.go index 8402785f2..7a4ae5866 100644 --- a/analysis/lang/en/analyzer_en.go +++ b/analysis/lang/en/analyzer_en.go @@ -22,12 +22,12 @@ package en import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/token/porter" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/token/porter" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" ) const AnalyzerName = "en" diff --git a/analysis/lang/en/analyzer_en_test.go b/analysis/lang/en/analyzer_en_test.go index 09ab7f251..6db7c3000 100644 --- a/analysis/lang/en/analyzer_en_test.go +++ b/analysis/lang/en/analyzer_en_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestEnglishAnalyzer(t *testing.T) { diff --git a/analysis/lang/en/possessive_filter_en.go b/analysis/lang/en/possessive_filter_en.go index 2c06efd67..79c2489e2 100644 --- a/analysis/lang/en/possessive_filter_en.go +++ b/analysis/lang/en/possessive_filter_en.go @@ -17,8 +17,8 @@ package en import ( "unicode/utf8" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) // PossessiveName is the name PossessiveFilter is registered as diff --git a/analysis/lang/en/possessive_filter_en_test.go b/analysis/lang/en/possessive_filter_en_test.go index 9a19a13d7..c45cfc942 100644 --- a/analysis/lang/en/possessive_filter_en_test.go +++ b/analysis/lang/en/possessive_filter_en_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestEnglishPossessiveFilter(t *testing.T) { diff --git a/analysis/lang/en/stemmer_en_snowball.go b/analysis/lang/en/stemmer_en_snowball.go index 225bb0664..ab30b8b19 100644 --- a/analysis/lang/en/stemmer_en_snowball.go +++ b/analysis/lang/en/stemmer_en_snowball.go @@ -15,8 +15,8 @@ package en import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" "github.com/blevesearch/snowballstem" "github.com/blevesearch/snowballstem/english" diff --git a/analysis/lang/en/stemmer_en_test.go b/analysis/lang/en/stemmer_en_test.go index bc5016d07..7435d9895 100644 --- a/analysis/lang/en/stemmer_en_test.go +++ b/analysis/lang/en/stemmer_en_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestSnowballEnglishStemmer(t *testing.T) { diff --git a/analysis/lang/en/stop_filter_en.go b/analysis/lang/en/stop_filter_en.go index bfdb2c972..a3f91d226 100644 --- a/analysis/lang/en/stop_filter_en.go +++ b/analysis/lang/en/stop_filter_en.go @@ -15,9 +15,9 @@ package en import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/en/stop_words_en.go b/analysis/lang/en/stop_words_en.go index 6423cf2cb..9b6ca86a7 100644 --- a/analysis/lang/en/stop_words_en.go +++ b/analysis/lang/en/stop_words_en.go @@ -1,8 +1,8 @@ package en import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_en" diff --git a/analysis/lang/es/analyzer_es.go b/analysis/lang/es/analyzer_es.go index 8a3156a11..a260aae69 100644 --- a/analysis/lang/es/analyzer_es.go +++ b/analysis/lang/es/analyzer_es.go @@ -15,11 +15,11 @@ package es import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" ) const AnalyzerName = "es" diff --git a/analysis/lang/es/analyzer_es_test.go b/analysis/lang/es/analyzer_es_test.go index bb21c6766..ad3b1f650 100644 --- a/analysis/lang/es/analyzer_es_test.go +++ b/analysis/lang/es/analyzer_es_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestSpanishAnalyzer(t *testing.T) { diff --git a/analysis/lang/es/light_stemmer_es.go b/analysis/lang/es/light_stemmer_es.go index 1dafdf91f..c1b4749ea 100644 --- a/analysis/lang/es/light_stemmer_es.go +++ b/analysis/lang/es/light_stemmer_es.go @@ -17,8 +17,8 @@ package es import ( "bytes" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const LightStemmerName = "stemmer_es_light" diff --git a/analysis/lang/es/stemmer_es_snowball.go b/analysis/lang/es/stemmer_es_snowball.go index 9ee768a9d..883392856 100644 --- a/analysis/lang/es/stemmer_es_snowball.go +++ b/analysis/lang/es/stemmer_es_snowball.go @@ -15,8 +15,8 @@ package es import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" "github.com/blevesearch/snowballstem" "github.com/blevesearch/snowballstem/spanish" diff --git a/analysis/lang/es/stemmer_es_snowball_test.go b/analysis/lang/es/stemmer_es_snowball_test.go index d976fc821..053186584 100644 --- a/analysis/lang/es/stemmer_es_snowball_test.go +++ b/analysis/lang/es/stemmer_es_snowball_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestSnowballSpanishStemmer(t *testing.T) { diff --git a/analysis/lang/es/stop_filter_es.go b/analysis/lang/es/stop_filter_es.go index df3d44342..5c6639414 100644 --- a/analysis/lang/es/stop_filter_es.go +++ b/analysis/lang/es/stop_filter_es.go @@ -14,9 +14,9 @@ package es import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, diff --git a/analysis/lang/es/stop_words_es.go b/analysis/lang/es/stop_words_es.go index b699daf4f..0f1e51d93 100644 --- a/analysis/lang/es/stop_words_es.go +++ b/analysis/lang/es/stop_words_es.go @@ -1,8 +1,8 @@ package es import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_es" diff --git a/analysis/lang/eu/stop_filter_eu.go b/analysis/lang/eu/stop_filter_eu.go index 31521317c..03eb549b2 100644 --- a/analysis/lang/eu/stop_filter_eu.go +++ b/analysis/lang/eu/stop_filter_eu.go @@ -15,9 +15,9 @@ package eu import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/eu/stop_words_eu.go b/analysis/lang/eu/stop_words_eu.go index dcb3f7b39..7a24efc9b 100644 --- a/analysis/lang/eu/stop_words_eu.go +++ b/analysis/lang/eu/stop_words_eu.go @@ -1,8 +1,8 @@ package eu import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_eu" diff --git a/analysis/lang/fa/analyzer_fa.go b/analysis/lang/fa/analyzer_fa.go index d76dc0a5f..8dcf9d514 100644 --- a/analysis/lang/fa/analyzer_fa.go +++ b/analysis/lang/fa/analyzer_fa.go @@ -15,13 +15,13 @@ package fa import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" - "github.com/blevesearch/bleve/analysis/char/zerowidthnonjoiner" - "github.com/blevesearch/bleve/analysis/lang/ar" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/analysis/char/zerowidthnonjoiner" + "github.com/blevesearch/bleve/v2/analysis/lang/ar" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" ) const AnalyzerName = "fa" diff --git a/analysis/lang/fa/analyzer_fa_test.go b/analysis/lang/fa/analyzer_fa_test.go index 5529d6fed..f648261f9 100644 --- a/analysis/lang/fa/analyzer_fa_test.go +++ b/analysis/lang/fa/analyzer_fa_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestPersianAnalyzerVerbs(t *testing.T) { diff --git a/analysis/lang/fa/persian_normalize.go b/analysis/lang/fa/persian_normalize.go index 7230cbcfc..437bd435f 100644 --- a/analysis/lang/fa/persian_normalize.go +++ b/analysis/lang/fa/persian_normalize.go @@ -17,8 +17,8 @@ package fa import ( "bytes" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const NormalizeName = "normalize_fa" diff --git a/analysis/lang/fa/persian_normalize_test.go b/analysis/lang/fa/persian_normalize_test.go index 720777992..4511cbaaf 100644 --- a/analysis/lang/fa/persian_normalize_test.go +++ b/analysis/lang/fa/persian_normalize_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestPersianNormalizeFilter(t *testing.T) { diff --git a/analysis/lang/fa/stop_filter_fa.go b/analysis/lang/fa/stop_filter_fa.go index 6589b3248..0277a56a2 100644 --- a/analysis/lang/fa/stop_filter_fa.go +++ b/analysis/lang/fa/stop_filter_fa.go @@ -15,9 +15,9 @@ package fa import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/fa/stop_words_fa.go b/analysis/lang/fa/stop_words_fa.go index 0d8ce4099..624fd5271 100644 --- a/analysis/lang/fa/stop_words_fa.go +++ b/analysis/lang/fa/stop_words_fa.go @@ -1,8 +1,8 @@ package fa import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_fa" diff --git a/analysis/lang/fi/analyzer_fi.go b/analysis/lang/fi/analyzer_fi.go index 9482e6b36..5b73b0c90 100644 --- a/analysis/lang/fi/analyzer_fi.go +++ b/analysis/lang/fi/analyzer_fi.go @@ -15,11 +15,11 @@ package fi import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" ) const AnalyzerName = "fi" diff --git a/analysis/lang/fi/analyzer_fi_test.go b/analysis/lang/fi/analyzer_fi_test.go index 035e7fdb5..45aa242de 100644 --- a/analysis/lang/fi/analyzer_fi_test.go +++ b/analysis/lang/fi/analyzer_fi_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestFinishAnalyzer(t *testing.T) { diff --git a/analysis/lang/fi/stemmer_fi.go b/analysis/lang/fi/stemmer_fi.go index 14a6a1cbc..44d39020d 100644 --- a/analysis/lang/fi/stemmer_fi.go +++ b/analysis/lang/fi/stemmer_fi.go @@ -15,8 +15,8 @@ package fi import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" "github.com/blevesearch/snowballstem" "github.com/blevesearch/snowballstem/finnish" diff --git a/analysis/lang/fi/stop_filter_fi.go b/analysis/lang/fi/stop_filter_fi.go index f3576a2be..0445d6942 100644 --- a/analysis/lang/fi/stop_filter_fi.go +++ b/analysis/lang/fi/stop_filter_fi.go @@ -15,9 +15,9 @@ package fi import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/fi/stop_words_fi.go b/analysis/lang/fi/stop_words_fi.go index 7cf0c9c13..93824f4e2 100644 --- a/analysis/lang/fi/stop_words_fi.go +++ b/analysis/lang/fi/stop_words_fi.go @@ -1,8 +1,8 @@ package fi import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_fi" diff --git a/analysis/lang/fr/analyzer_fr.go b/analysis/lang/fr/analyzer_fr.go index 9d9da1dd1..138eda8ae 100644 --- a/analysis/lang/fr/analyzer_fr.go +++ b/analysis/lang/fr/analyzer_fr.go @@ -15,11 +15,11 @@ package fr import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" ) const AnalyzerName = "fr" diff --git a/analysis/lang/fr/analyzer_fr_test.go b/analysis/lang/fr/analyzer_fr_test.go index fe04bef6b..38f89e079 100644 --- a/analysis/lang/fr/analyzer_fr_test.go +++ b/analysis/lang/fr/analyzer_fr_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestFrenchAnalyzer(t *testing.T) { diff --git a/analysis/lang/fr/articles_fr.go b/analysis/lang/fr/articles_fr.go index 557409a2c..405729b81 100644 --- a/analysis/lang/fr/articles_fr.go +++ b/analysis/lang/fr/articles_fr.go @@ -1,8 +1,8 @@ package fr import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const ArticlesName = "articles_fr" diff --git a/analysis/lang/fr/elision_fr.go b/analysis/lang/fr/elision_fr.go index 1663b6f14..739e2361f 100644 --- a/analysis/lang/fr/elision_fr.go +++ b/analysis/lang/fr/elision_fr.go @@ -17,9 +17,9 @@ package fr import ( "fmt" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/elision" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/elision" + "github.com/blevesearch/bleve/v2/registry" ) const ElisionName = "elision_fr" diff --git a/analysis/lang/fr/elision_fr_test.go b/analysis/lang/fr/elision_fr_test.go index b940dd45e..19689ec66 100644 --- a/analysis/lang/fr/elision_fr_test.go +++ b/analysis/lang/fr/elision_fr_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestFrenchElision(t *testing.T) { diff --git a/analysis/lang/fr/light_stemmer_fr.go b/analysis/lang/fr/light_stemmer_fr.go index 6d13a22ab..d0e407641 100644 --- a/analysis/lang/fr/light_stemmer_fr.go +++ b/analysis/lang/fr/light_stemmer_fr.go @@ -18,8 +18,8 @@ import ( "bytes" "unicode" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const LightStemmerName = "stemmer_fr_light" diff --git a/analysis/lang/fr/light_stemmer_fr_test.go b/analysis/lang/fr/light_stemmer_fr_test.go index 45198cf56..a098b9702 100644 --- a/analysis/lang/fr/light_stemmer_fr_test.go +++ b/analysis/lang/fr/light_stemmer_fr_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestFrenchLightStemmer(t *testing.T) { diff --git a/analysis/lang/fr/minimal_stemmer_fr.go b/analysis/lang/fr/minimal_stemmer_fr.go index b76d6a891..93d954bf7 100644 --- a/analysis/lang/fr/minimal_stemmer_fr.go +++ b/analysis/lang/fr/minimal_stemmer_fr.go @@ -17,8 +17,8 @@ package fr import ( "bytes" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const MinimalStemmerName = "stemmer_fr_min" diff --git a/analysis/lang/fr/minimal_stemmer_fr_test.go b/analysis/lang/fr/minimal_stemmer_fr_test.go index 6dc0c676c..fa17528f6 100644 --- a/analysis/lang/fr/minimal_stemmer_fr_test.go +++ b/analysis/lang/fr/minimal_stemmer_fr_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestFrenchMinimalStemmer(t *testing.T) { diff --git a/analysis/lang/fr/stemmer_fr_snowball.go b/analysis/lang/fr/stemmer_fr_snowball.go index e137ce211..275d66e96 100644 --- a/analysis/lang/fr/stemmer_fr_snowball.go +++ b/analysis/lang/fr/stemmer_fr_snowball.go @@ -15,8 +15,8 @@ package fr import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" "github.com/blevesearch/snowballstem" "github.com/blevesearch/snowballstem/french" diff --git a/analysis/lang/fr/stemmer_fr_snowball_test.go b/analysis/lang/fr/stemmer_fr_snowball_test.go index aeafa4317..69e9f26c0 100644 --- a/analysis/lang/fr/stemmer_fr_snowball_test.go +++ b/analysis/lang/fr/stemmer_fr_snowball_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestSnowballFrenchStemmer(t *testing.T) { diff --git a/analysis/lang/fr/stop_filter_fr.go b/analysis/lang/fr/stop_filter_fr.go index fcacc4904..ac7abb10e 100644 --- a/analysis/lang/fr/stop_filter_fr.go +++ b/analysis/lang/fr/stop_filter_fr.go @@ -15,9 +15,9 @@ package fr import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/fr/stop_words_fr.go b/analysis/lang/fr/stop_words_fr.go index f00266f00..c59757586 100644 --- a/analysis/lang/fr/stop_words_fr.go +++ b/analysis/lang/fr/stop_words_fr.go @@ -1,8 +1,8 @@ package fr import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_fr" diff --git a/analysis/lang/ga/articles_ga.go b/analysis/lang/ga/articles_ga.go index 0b6863a62..4b859a563 100644 --- a/analysis/lang/ga/articles_ga.go +++ b/analysis/lang/ga/articles_ga.go @@ -1,8 +1,8 @@ package ga import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const ArticlesName = "articles_ga" diff --git a/analysis/lang/ga/elision_ga.go b/analysis/lang/ga/elision_ga.go index b8906c89f..30310014a 100644 --- a/analysis/lang/ga/elision_ga.go +++ b/analysis/lang/ga/elision_ga.go @@ -17,9 +17,9 @@ package ga import ( "fmt" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/elision" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/elision" + "github.com/blevesearch/bleve/v2/registry" ) const ElisionName = "elision_ga" diff --git a/analysis/lang/ga/elision_ga_test.go b/analysis/lang/ga/elision_ga_test.go index 937f294d5..809a7c3ca 100644 --- a/analysis/lang/ga/elision_ga_test.go +++ b/analysis/lang/ga/elision_ga_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestFrenchElision(t *testing.T) { diff --git a/analysis/lang/ga/stop_filter_ga.go b/analysis/lang/ga/stop_filter_ga.go index 633621d3b..d58f55b53 100644 --- a/analysis/lang/ga/stop_filter_ga.go +++ b/analysis/lang/ga/stop_filter_ga.go @@ -15,9 +15,9 @@ package ga import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/ga/stop_words_ga.go b/analysis/lang/ga/stop_words_ga.go index 12703be04..a3fc7ac4c 100644 --- a/analysis/lang/ga/stop_words_ga.go +++ b/analysis/lang/ga/stop_words_ga.go @@ -1,8 +1,8 @@ package ga import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_ga" diff --git a/analysis/lang/gl/stop_filter_gl.go b/analysis/lang/gl/stop_filter_gl.go index 246897efa..753463df4 100644 --- a/analysis/lang/gl/stop_filter_gl.go +++ b/analysis/lang/gl/stop_filter_gl.go @@ -15,9 +15,9 @@ package gl import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/gl/stop_words_gl.go b/analysis/lang/gl/stop_words_gl.go index 82a551c43..0d1fb5a0c 100644 --- a/analysis/lang/gl/stop_words_gl.go +++ b/analysis/lang/gl/stop_words_gl.go @@ -1,8 +1,8 @@ package gl import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_gl" diff --git a/analysis/lang/hi/analyzer_hi.go b/analysis/lang/hi/analyzer_hi.go index e28d81ad9..717bb8143 100644 --- a/analysis/lang/hi/analyzer_hi.go +++ b/analysis/lang/hi/analyzer_hi.go @@ -15,12 +15,12 @@ package hi import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" - "github.com/blevesearch/bleve/analysis/lang/in" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/analysis/lang/in" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" ) const AnalyzerName = "hi" diff --git a/analysis/lang/hi/analyzer_hi_test.go b/analysis/lang/hi/analyzer_hi_test.go index a56605447..a86aeefd8 100644 --- a/analysis/lang/hi/analyzer_hi_test.go +++ b/analysis/lang/hi/analyzer_hi_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestHindiAnalyzer(t *testing.T) { diff --git a/analysis/lang/hi/hindi_normalize.go b/analysis/lang/hi/hindi_normalize.go index bf2a210c4..182c6a101 100644 --- a/analysis/lang/hi/hindi_normalize.go +++ b/analysis/lang/hi/hindi_normalize.go @@ -17,8 +17,8 @@ package hi import ( "bytes" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const NormalizeName = "normalize_hi" diff --git a/analysis/lang/hi/hindi_normalize_test.go b/analysis/lang/hi/hindi_normalize_test.go index daf01fa71..242008d86 100644 --- a/analysis/lang/hi/hindi_normalize_test.go +++ b/analysis/lang/hi/hindi_normalize_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestHindiNormalizeFilter(t *testing.T) { diff --git a/analysis/lang/hi/hindi_stemmer_filter.go b/analysis/lang/hi/hindi_stemmer_filter.go index 06a304595..c1346db88 100644 --- a/analysis/lang/hi/hindi_stemmer_filter.go +++ b/analysis/lang/hi/hindi_stemmer_filter.go @@ -18,8 +18,8 @@ import ( "bytes" "unicode/utf8" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StemmerName = "stemmer_hi" diff --git a/analysis/lang/hi/hindi_stemmer_filter_test.go b/analysis/lang/hi/hindi_stemmer_filter_test.go index f17bc3316..bf5d92a80 100644 --- a/analysis/lang/hi/hindi_stemmer_filter_test.go +++ b/analysis/lang/hi/hindi_stemmer_filter_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestHindiStemmerFilter(t *testing.T) { diff --git a/analysis/lang/hi/stop_filter_hi.go b/analysis/lang/hi/stop_filter_hi.go index 2beccc590..d5598ad16 100644 --- a/analysis/lang/hi/stop_filter_hi.go +++ b/analysis/lang/hi/stop_filter_hi.go @@ -15,9 +15,9 @@ package hi import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/hi/stop_words_hi.go b/analysis/lang/hi/stop_words_hi.go index f0300f0d0..1ffdec600 100644 --- a/analysis/lang/hi/stop_words_hi.go +++ b/analysis/lang/hi/stop_words_hi.go @@ -1,8 +1,8 @@ package hi import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_hi" diff --git a/analysis/lang/hu/analyzer_hu.go b/analysis/lang/hu/analyzer_hu.go index 6797a91e4..5935b7d41 100644 --- a/analysis/lang/hu/analyzer_hu.go +++ b/analysis/lang/hu/analyzer_hu.go @@ -15,11 +15,11 @@ package hu import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" ) const AnalyzerName = "hu" diff --git a/analysis/lang/hu/analyzer_hu_test.go b/analysis/lang/hu/analyzer_hu_test.go index 4a14dff68..8745668c2 100644 --- a/analysis/lang/hu/analyzer_hu_test.go +++ b/analysis/lang/hu/analyzer_hu_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestHungarianAnalyzer(t *testing.T) { diff --git a/analysis/lang/hu/stemmer_hu.go b/analysis/lang/hu/stemmer_hu.go index b380818a0..e1a35c157 100644 --- a/analysis/lang/hu/stemmer_hu.go +++ b/analysis/lang/hu/stemmer_hu.go @@ -15,8 +15,8 @@ package hu import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" "github.com/blevesearch/snowballstem" "github.com/blevesearch/snowballstem/hungarian" diff --git a/analysis/lang/hu/stop_filter_hu.go b/analysis/lang/hu/stop_filter_hu.go index a83fd4ccb..cafaf74ad 100644 --- a/analysis/lang/hu/stop_filter_hu.go +++ b/analysis/lang/hu/stop_filter_hu.go @@ -15,9 +15,9 @@ package hu import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/hu/stop_words_hu.go b/analysis/lang/hu/stop_words_hu.go index fe45d55ea..3518538ae 100644 --- a/analysis/lang/hu/stop_words_hu.go +++ b/analysis/lang/hu/stop_words_hu.go @@ -1,8 +1,8 @@ package hu import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_hu" diff --git a/analysis/lang/hy/stop_filter_hy.go b/analysis/lang/hy/stop_filter_hy.go index a42743086..0601002ee 100644 --- a/analysis/lang/hy/stop_filter_hy.go +++ b/analysis/lang/hy/stop_filter_hy.go @@ -15,9 +15,9 @@ package hy import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/hy/stop_words_hy.go b/analysis/lang/hy/stop_words_hy.go index 6dc3db9b8..d2a105a88 100644 --- a/analysis/lang/hy/stop_words_hy.go +++ b/analysis/lang/hy/stop_words_hy.go @@ -1,8 +1,8 @@ package hy import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_hy" diff --git a/analysis/lang/id/stop_filter_id.go b/analysis/lang/id/stop_filter_id.go index 4bf44eed0..2568a5f21 100644 --- a/analysis/lang/id/stop_filter_id.go +++ b/analysis/lang/id/stop_filter_id.go @@ -15,9 +15,9 @@ package id import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/id/stop_words_id.go b/analysis/lang/id/stop_words_id.go index d802dcfce..97d02ac41 100644 --- a/analysis/lang/id/stop_words_id.go +++ b/analysis/lang/id/stop_words_id.go @@ -1,8 +1,8 @@ package id import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_id" diff --git a/analysis/lang/in/indic_normalize.go b/analysis/lang/in/indic_normalize.go index b865cee28..6c2ab2b5a 100644 --- a/analysis/lang/in/indic_normalize.go +++ b/analysis/lang/in/indic_normalize.go @@ -17,8 +17,8 @@ package in import ( "bytes" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const NormalizeName = "normalize_in" diff --git a/analysis/lang/in/indic_normalize_test.go b/analysis/lang/in/indic_normalize_test.go index cd3c516f4..5789eb7b7 100644 --- a/analysis/lang/in/indic_normalize_test.go +++ b/analysis/lang/in/indic_normalize_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestIndicNormalizeFilter(t *testing.T) { diff --git a/analysis/lang/in/scripts.go b/analysis/lang/in/scripts.go index ad4b900ec..26446cb19 100644 --- a/analysis/lang/in/scripts.go +++ b/analysis/lang/in/scripts.go @@ -17,7 +17,7 @@ package in import ( "unicode" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" "github.com/willf/bitset" ) diff --git a/analysis/lang/it/analyzer_it.go b/analysis/lang/it/analyzer_it.go index 0ec9cee5d..f86d8b8dd 100644 --- a/analysis/lang/it/analyzer_it.go +++ b/analysis/lang/it/analyzer_it.go @@ -15,11 +15,11 @@ package it import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" ) const AnalyzerName = "it" diff --git a/analysis/lang/it/analyzer_it_test.go b/analysis/lang/it/analyzer_it_test.go index 6c56d4ca0..19b9d4dfe 100644 --- a/analysis/lang/it/analyzer_it_test.go +++ b/analysis/lang/it/analyzer_it_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestItalianAnalyzer(t *testing.T) { diff --git a/analysis/lang/it/articles_it.go b/analysis/lang/it/articles_it.go index bfd4bb48d..9bd0b6702 100644 --- a/analysis/lang/it/articles_it.go +++ b/analysis/lang/it/articles_it.go @@ -1,8 +1,8 @@ package it import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const ArticlesName = "articles_it" diff --git a/analysis/lang/it/elision_it.go b/analysis/lang/it/elision_it.go index 43bf4af7d..952608513 100644 --- a/analysis/lang/it/elision_it.go +++ b/analysis/lang/it/elision_it.go @@ -17,9 +17,9 @@ package it import ( "fmt" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/elision" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/elision" + "github.com/blevesearch/bleve/v2/registry" ) const ElisionName = "elision_it" diff --git a/analysis/lang/it/elision_it_test.go b/analysis/lang/it/elision_it_test.go index 0e97a6786..b79610d7a 100644 --- a/analysis/lang/it/elision_it_test.go +++ b/analysis/lang/it/elision_it_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestItalianElision(t *testing.T) { diff --git a/analysis/lang/it/light_stemmer_it.go b/analysis/lang/it/light_stemmer_it.go index 67b90f0b8..daf63a191 100644 --- a/analysis/lang/it/light_stemmer_it.go +++ b/analysis/lang/it/light_stemmer_it.go @@ -17,8 +17,8 @@ package it import ( "bytes" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const LightStemmerName = "stemmer_it_light" diff --git a/analysis/lang/it/light_stemmer_it_test.go b/analysis/lang/it/light_stemmer_it_test.go index e15e02a87..5122f1942 100644 --- a/analysis/lang/it/light_stemmer_it_test.go +++ b/analysis/lang/it/light_stemmer_it_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestItalianLightStemmer(t *testing.T) { diff --git a/analysis/lang/it/stemmer_it_snowball.go b/analysis/lang/it/stemmer_it_snowball.go index 04c6bd701..9faec48ff 100644 --- a/analysis/lang/it/stemmer_it_snowball.go +++ b/analysis/lang/it/stemmer_it_snowball.go @@ -15,8 +15,8 @@ package it import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" "github.com/blevesearch/snowballstem" "github.com/blevesearch/snowballstem/italian" diff --git a/analysis/lang/it/stemmer_it_snowball_test.go b/analysis/lang/it/stemmer_it_snowball_test.go index 844f2f543..134f2e026 100644 --- a/analysis/lang/it/stemmer_it_snowball_test.go +++ b/analysis/lang/it/stemmer_it_snowball_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestSnowballItalianStemmer(t *testing.T) { diff --git a/analysis/lang/it/stop_filter_it.go b/analysis/lang/it/stop_filter_it.go index ada11669c..79d459c18 100644 --- a/analysis/lang/it/stop_filter_it.go +++ b/analysis/lang/it/stop_filter_it.go @@ -15,9 +15,9 @@ package it import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/it/stop_words_it.go b/analysis/lang/it/stop_words_it.go index 5cca4bab3..10b3254dc 100644 --- a/analysis/lang/it/stop_words_it.go +++ b/analysis/lang/it/stop_words_it.go @@ -1,8 +1,8 @@ package it import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_it" diff --git a/analysis/lang/nl/analyzer_nl.go b/analysis/lang/nl/analyzer_nl.go index 69853a9e1..e8a195b2c 100644 --- a/analysis/lang/nl/analyzer_nl.go +++ b/analysis/lang/nl/analyzer_nl.go @@ -15,11 +15,11 @@ package nl import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" ) const AnalyzerName = "nl" diff --git a/analysis/lang/nl/analyzer_nl_test.go b/analysis/lang/nl/analyzer_nl_test.go index 21e851c33..707655f01 100644 --- a/analysis/lang/nl/analyzer_nl_test.go +++ b/analysis/lang/nl/analyzer_nl_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestDutchAnalyzer(t *testing.T) { diff --git a/analysis/lang/nl/stemmer_nl.go b/analysis/lang/nl/stemmer_nl.go index 049d92160..b8c529517 100644 --- a/analysis/lang/nl/stemmer_nl.go +++ b/analysis/lang/nl/stemmer_nl.go @@ -15,8 +15,8 @@ package nl import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" "github.com/blevesearch/snowballstem" "github.com/blevesearch/snowballstem/dutch" diff --git a/analysis/lang/nl/stop_filter_nl.go b/analysis/lang/nl/stop_filter_nl.go index 218f0f42c..75966731b 100644 --- a/analysis/lang/nl/stop_filter_nl.go +++ b/analysis/lang/nl/stop_filter_nl.go @@ -15,9 +15,9 @@ package nl import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/nl/stop_words_nl.go b/analysis/lang/nl/stop_words_nl.go index 4adae1002..e68486199 100644 --- a/analysis/lang/nl/stop_words_nl.go +++ b/analysis/lang/nl/stop_words_nl.go @@ -1,8 +1,8 @@ package nl import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_nl" diff --git a/analysis/lang/no/analyzer_no.go b/analysis/lang/no/analyzer_no.go index 57d749eac..7876195c3 100644 --- a/analysis/lang/no/analyzer_no.go +++ b/analysis/lang/no/analyzer_no.go @@ -15,11 +15,11 @@ package no import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" ) const AnalyzerName = "no" diff --git a/analysis/lang/no/analyzer_no_test.go b/analysis/lang/no/analyzer_no_test.go index c73f5f731..b37cb4d1c 100644 --- a/analysis/lang/no/analyzer_no_test.go +++ b/analysis/lang/no/analyzer_no_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestNorwegianAnalyzer(t *testing.T) { diff --git a/analysis/lang/no/stemmer_no.go b/analysis/lang/no/stemmer_no.go index e61e02477..cf3fb37a1 100644 --- a/analysis/lang/no/stemmer_no.go +++ b/analysis/lang/no/stemmer_no.go @@ -15,8 +15,8 @@ package no import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" "github.com/blevesearch/snowballstem" "github.com/blevesearch/snowballstem/norwegian" diff --git a/analysis/lang/no/stop_filter_no.go b/analysis/lang/no/stop_filter_no.go index 093688fa7..72855bd8f 100644 --- a/analysis/lang/no/stop_filter_no.go +++ b/analysis/lang/no/stop_filter_no.go @@ -15,9 +15,9 @@ package no import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/no/stop_words_no.go b/analysis/lang/no/stop_words_no.go index bfca34846..b771091c5 100644 --- a/analysis/lang/no/stop_words_no.go +++ b/analysis/lang/no/stop_words_no.go @@ -1,8 +1,8 @@ package no import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_no" diff --git a/analysis/lang/pt/analyzer_pt.go b/analysis/lang/pt/analyzer_pt.go index 7f881d528..c8814028b 100644 --- a/analysis/lang/pt/analyzer_pt.go +++ b/analysis/lang/pt/analyzer_pt.go @@ -15,11 +15,11 @@ package pt import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" ) const AnalyzerName = "pt" diff --git a/analysis/lang/pt/analyzer_pt_test.go b/analysis/lang/pt/analyzer_pt_test.go index 691b48e5b..417e64066 100644 --- a/analysis/lang/pt/analyzer_pt_test.go +++ b/analysis/lang/pt/analyzer_pt_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestPortugueseAnalyzer(t *testing.T) { diff --git a/analysis/lang/pt/light_stemmer_pt.go b/analysis/lang/pt/light_stemmer_pt.go index 89f0d2ecc..cf3371cf3 100644 --- a/analysis/lang/pt/light_stemmer_pt.go +++ b/analysis/lang/pt/light_stemmer_pt.go @@ -17,8 +17,8 @@ package pt import ( "bytes" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const LightStemmerName = "stemmer_pt_light" diff --git a/analysis/lang/pt/light_stemmer_pt_test.go b/analysis/lang/pt/light_stemmer_pt_test.go index 73e36a7d2..76b1435b5 100644 --- a/analysis/lang/pt/light_stemmer_pt_test.go +++ b/analysis/lang/pt/light_stemmer_pt_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestPortugueseLightStemmer(t *testing.T) { diff --git a/analysis/lang/pt/stop_filter_pt.go b/analysis/lang/pt/stop_filter_pt.go index db32025fb..7bdca2e61 100644 --- a/analysis/lang/pt/stop_filter_pt.go +++ b/analysis/lang/pt/stop_filter_pt.go @@ -15,9 +15,9 @@ package pt import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/pt/stop_words_pt.go b/analysis/lang/pt/stop_words_pt.go index a0d4995f1..e5c5ebba7 100644 --- a/analysis/lang/pt/stop_words_pt.go +++ b/analysis/lang/pt/stop_words_pt.go @@ -1,8 +1,8 @@ package pt import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_pt" diff --git a/analysis/lang/ro/analyzer_ro.go b/analysis/lang/ro/analyzer_ro.go index e29388155..24c7bffe8 100644 --- a/analysis/lang/ro/analyzer_ro.go +++ b/analysis/lang/ro/analyzer_ro.go @@ -15,11 +15,11 @@ package ro import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" ) const AnalyzerName = "ro" diff --git a/analysis/lang/ro/analyzer_ro_test.go b/analysis/lang/ro/analyzer_ro_test.go index ee8b88f80..0fe4645bd 100644 --- a/analysis/lang/ro/analyzer_ro_test.go +++ b/analysis/lang/ro/analyzer_ro_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestRomanianAnalyzer(t *testing.T) { diff --git a/analysis/lang/ro/stemmer_ro.go b/analysis/lang/ro/stemmer_ro.go index 3966215ff..b37ae878d 100644 --- a/analysis/lang/ro/stemmer_ro.go +++ b/analysis/lang/ro/stemmer_ro.go @@ -15,8 +15,8 @@ package ro import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" "github.com/blevesearch/snowballstem" "github.com/blevesearch/snowballstem/romanian" diff --git a/analysis/lang/ro/stop_filter_ro.go b/analysis/lang/ro/stop_filter_ro.go index a2f7f6dd9..ccd7e6bdd 100644 --- a/analysis/lang/ro/stop_filter_ro.go +++ b/analysis/lang/ro/stop_filter_ro.go @@ -15,9 +15,9 @@ package ro import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/ro/stop_words_ro.go b/analysis/lang/ro/stop_words_ro.go index e7d62d414..4eb255a34 100644 --- a/analysis/lang/ro/stop_words_ro.go +++ b/analysis/lang/ro/stop_words_ro.go @@ -1,8 +1,8 @@ package ro import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_ro" diff --git a/analysis/lang/ru/analyzer_ru.go b/analysis/lang/ru/analyzer_ru.go index d1b7688c0..3d591aff6 100644 --- a/analysis/lang/ru/analyzer_ru.go +++ b/analysis/lang/ru/analyzer_ru.go @@ -15,11 +15,11 @@ package ru import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" ) const AnalyzerName = "ru" diff --git a/analysis/lang/ru/analyzer_ru_test.go b/analysis/lang/ru/analyzer_ru_test.go index 6cda4a586..38534aff2 100644 --- a/analysis/lang/ru/analyzer_ru_test.go +++ b/analysis/lang/ru/analyzer_ru_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestRussianAnalyzer(t *testing.T) { diff --git a/analysis/lang/ru/stemmer_ru.go b/analysis/lang/ru/stemmer_ru.go index 47a90456b..6f051dc5e 100644 --- a/analysis/lang/ru/stemmer_ru.go +++ b/analysis/lang/ru/stemmer_ru.go @@ -15,8 +15,8 @@ package ru import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" "github.com/blevesearch/snowballstem" "github.com/blevesearch/snowballstem/russian" diff --git a/analysis/lang/ru/stemmer_ru_test.go b/analysis/lang/ru/stemmer_ru_test.go index 39949fcb0..8d44181cc 100644 --- a/analysis/lang/ru/stemmer_ru_test.go +++ b/analysis/lang/ru/stemmer_ru_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestSnowballRussianStemmer(t *testing.T) { diff --git a/analysis/lang/ru/stop_filter_ru.go b/analysis/lang/ru/stop_filter_ru.go index 326fb9d56..e91f1fe2e 100644 --- a/analysis/lang/ru/stop_filter_ru.go +++ b/analysis/lang/ru/stop_filter_ru.go @@ -15,9 +15,9 @@ package ru import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/ru/stop_words_ru.go b/analysis/lang/ru/stop_words_ru.go index 0129f48c4..cca2f248c 100644 --- a/analysis/lang/ru/stop_words_ru.go +++ b/analysis/lang/ru/stop_words_ru.go @@ -1,8 +1,8 @@ package ru import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_ru" diff --git a/analysis/lang/sv/analyzer_sv.go b/analysis/lang/sv/analyzer_sv.go index f650158d4..7d987b323 100644 --- a/analysis/lang/sv/analyzer_sv.go +++ b/analysis/lang/sv/analyzer_sv.go @@ -15,11 +15,11 @@ package sv import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" ) const AnalyzerName = "sv" diff --git a/analysis/lang/sv/analyzer_sv_test.go b/analysis/lang/sv/analyzer_sv_test.go index 2d358b63e..a3bd5f161 100644 --- a/analysis/lang/sv/analyzer_sv_test.go +++ b/analysis/lang/sv/analyzer_sv_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestSwedishAnalyzer(t *testing.T) { diff --git a/analysis/lang/sv/stemmer_sv.go b/analysis/lang/sv/stemmer_sv.go index 247f11bb2..39265e7f4 100644 --- a/analysis/lang/sv/stemmer_sv.go +++ b/analysis/lang/sv/stemmer_sv.go @@ -15,8 +15,8 @@ package sv import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" "github.com/blevesearch/snowballstem" "github.com/blevesearch/snowballstem/swedish" diff --git a/analysis/lang/sv/stop_filter_sv.go b/analysis/lang/sv/stop_filter_sv.go index 46a533d17..6cd09baf9 100644 --- a/analysis/lang/sv/stop_filter_sv.go +++ b/analysis/lang/sv/stop_filter_sv.go @@ -15,9 +15,9 @@ package sv import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/sv/stop_words_sv.go b/analysis/lang/sv/stop_words_sv.go index b4022fd90..0943e6941 100644 --- a/analysis/lang/sv/stop_words_sv.go +++ b/analysis/lang/sv/stop_words_sv.go @@ -1,8 +1,8 @@ package sv import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_sv" diff --git a/analysis/lang/tr/analyzer_tr.go b/analysis/lang/tr/analyzer_tr.go index d52a1d5cc..64c6b3f8c 100644 --- a/analysis/lang/tr/analyzer_tr.go +++ b/analysis/lang/tr/analyzer_tr.go @@ -15,12 +15,12 @@ package tr import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" - "github.com/blevesearch/bleve/analysis/token/apostrophe" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/analysis/token/apostrophe" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" ) const AnalyzerName = "tr" diff --git a/analysis/lang/tr/analyzer_tr_test.go b/analysis/lang/tr/analyzer_tr_test.go index fe8980938..3c4592b6e 100644 --- a/analysis/lang/tr/analyzer_tr_test.go +++ b/analysis/lang/tr/analyzer_tr_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestTurkishAnalyzer(t *testing.T) { diff --git a/analysis/lang/tr/stemmer_tr.go b/analysis/lang/tr/stemmer_tr.go index ba3034e1a..fa4590631 100644 --- a/analysis/lang/tr/stemmer_tr.go +++ b/analysis/lang/tr/stemmer_tr.go @@ -15,8 +15,8 @@ package tr import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" "github.com/blevesearch/snowballstem" "github.com/blevesearch/snowballstem/turkish" diff --git a/analysis/lang/tr/stop_filter_tr.go b/analysis/lang/tr/stop_filter_tr.go index 5b616eb9c..d096d7139 100644 --- a/analysis/lang/tr/stop_filter_tr.go +++ b/analysis/lang/tr/stop_filter_tr.go @@ -15,9 +15,9 @@ package tr import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/token/stop" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/token/stop" + "github.com/blevesearch/bleve/v2/registry" ) func StopTokenFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { diff --git a/analysis/lang/tr/stop_words_tr.go b/analysis/lang/tr/stop_words_tr.go index f96fb07ed..8d0cdc5f0 100644 --- a/analysis/lang/tr/stop_words_tr.go +++ b/analysis/lang/tr/stop_words_tr.go @@ -1,8 +1,8 @@ package tr import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const StopName = "stop_tr" diff --git a/analysis/token/apostrophe/apostrophe.go b/analysis/token/apostrophe/apostrophe.go index 40b3f1368..4ab47bf26 100644 --- a/analysis/token/apostrophe/apostrophe.go +++ b/analysis/token/apostrophe/apostrophe.go @@ -17,8 +17,8 @@ package apostrophe import ( "bytes" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "apostrophe" diff --git a/analysis/token/apostrophe/apostrophe_test.go b/analysis/token/apostrophe/apostrophe_test.go index 2688db652..b704dc723 100644 --- a/analysis/token/apostrophe/apostrophe_test.go +++ b/analysis/token/apostrophe/apostrophe_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestApostropheFilter(t *testing.T) { diff --git a/analysis/token/camelcase/camelcase.go b/analysis/token/camelcase/camelcase.go index 42b7483c6..0f6685cc0 100644 --- a/analysis/token/camelcase/camelcase.go +++ b/analysis/token/camelcase/camelcase.go @@ -18,8 +18,8 @@ import ( "bytes" "unicode/utf8" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "camelCase" diff --git a/analysis/token/camelcase/camelcase_test.go b/analysis/token/camelcase/camelcase_test.go index 8b7c20cbb..9220bc582 100644 --- a/analysis/token/camelcase/camelcase_test.go +++ b/analysis/token/camelcase/camelcase_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestCamelCaseFilter(t *testing.T) { diff --git a/analysis/token/camelcase/parser.go b/analysis/token/camelcase/parser.go index ff4ce2fea..2d93fc4f7 100644 --- a/analysis/token/camelcase/parser.go +++ b/analysis/token/camelcase/parser.go @@ -15,7 +15,7 @@ package camelcase import ( - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func (p *Parser) buildTokenFromTerm(buffer []rune) *analysis.Token { diff --git a/analysis/token/compound/dict.go b/analysis/token/compound/dict.go index 7596e7711..e5065df4d 100644 --- a/analysis/token/compound/dict.go +++ b/analysis/token/compound/dict.go @@ -19,8 +19,8 @@ import ( "fmt" "unicode/utf8" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "dict_compound" diff --git a/analysis/token/compound/dict_test.go b/analysis/token/compound/dict_test.go index 4c3d5b7a4..8d9b093da 100644 --- a/analysis/token/compound/dict_test.go +++ b/analysis/token/compound/dict_test.go @@ -18,9 +18,9 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/tokenmap" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/tokenmap" + "github.com/blevesearch/bleve/v2/registry" ) func TestStopWordsFilter(t *testing.T) { diff --git a/analysis/token/edgengram/edgengram.go b/analysis/token/edgengram/edgengram.go index 1628193df..9e079c6c3 100644 --- a/analysis/token/edgengram/edgengram.go +++ b/analysis/token/edgengram/edgengram.go @@ -19,8 +19,8 @@ import ( "fmt" "unicode/utf8" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "edge_ngram" diff --git a/analysis/token/edgengram/edgengram_test.go b/analysis/token/edgengram/edgengram_test.go index 1be4db387..cb206a553 100644 --- a/analysis/token/edgengram/edgengram_test.go +++ b/analysis/token/edgengram/edgengram_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestEdgeNgramFilter(t *testing.T) { diff --git a/analysis/token/elision/elision.go b/analysis/token/elision/elision.go index 702a4389b..909d24121 100644 --- a/analysis/token/elision/elision.go +++ b/analysis/token/elision/elision.go @@ -18,8 +18,8 @@ import ( "fmt" "unicode/utf8" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "elision" diff --git a/analysis/token/elision/elision_test.go b/analysis/token/elision/elision_test.go index 73d2eb2b2..ed580b0c1 100644 --- a/analysis/token/elision/elision_test.go +++ b/analysis/token/elision/elision_test.go @@ -18,9 +18,9 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/tokenmap" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/tokenmap" + "github.com/blevesearch/bleve/v2/registry" ) func TestElisionFilter(t *testing.T) { diff --git a/analysis/token/keyword/keyword.go b/analysis/token/keyword/keyword.go index c39c40bea..49aa55d49 100644 --- a/analysis/token/keyword/keyword.go +++ b/analysis/token/keyword/keyword.go @@ -17,8 +17,8 @@ package keyword import ( "fmt" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "keyword_marker" diff --git a/analysis/token/keyword/keyword_test.go b/analysis/token/keyword/keyword_test.go index de241f0f0..8b789f16d 100644 --- a/analysis/token/keyword/keyword_test.go +++ b/analysis/token/keyword/keyword_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestKeyWordMarkerFilter(t *testing.T) { diff --git a/analysis/token/length/length.go b/analysis/token/length/length.go index 485a79813..6b5cdd84b 100644 --- a/analysis/token/length/length.go +++ b/analysis/token/length/length.go @@ -18,8 +18,8 @@ import ( "fmt" "unicode/utf8" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "length" diff --git a/analysis/token/length/length_test.go b/analysis/token/length/length_test.go index 5f0fa80e6..b3cb06428 100644 --- a/analysis/token/length/length_test.go +++ b/analysis/token/length/length_test.go @@ -17,7 +17,7 @@ package length import ( "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestLengthFilter(t *testing.T) { diff --git a/analysis/token/lowercase/lowercase.go b/analysis/token/lowercase/lowercase.go index adb740c3e..a1b6dbd05 100644 --- a/analysis/token/lowercase/lowercase.go +++ b/analysis/token/lowercase/lowercase.go @@ -21,8 +21,8 @@ import ( "unicode" "unicode/utf8" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) // Name is the name used to register LowerCaseFilter in the bleve registry diff --git a/analysis/token/lowercase/lowercase_test.go b/analysis/token/lowercase/lowercase_test.go index 771f61028..95fd2af5f 100644 --- a/analysis/token/lowercase/lowercase_test.go +++ b/analysis/token/lowercase/lowercase_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestLowerCaseFilter(t *testing.T) { diff --git a/analysis/token/ngram/ngram.go b/analysis/token/ngram/ngram.go index abab0aefc..ba99d9d42 100644 --- a/analysis/token/ngram/ngram.go +++ b/analysis/token/ngram/ngram.go @@ -19,8 +19,8 @@ import ( "fmt" "unicode/utf8" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "ngram" diff --git a/analysis/token/ngram/ngram_test.go b/analysis/token/ngram/ngram_test.go index aac12bf5f..877c881f5 100644 --- a/analysis/token/ngram/ngram_test.go +++ b/analysis/token/ngram/ngram_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestNgramFilter(t *testing.T) { diff --git a/analysis/token/porter/porter.go b/analysis/token/porter/porter.go index 4cd08d99c..95af0fa72 100644 --- a/analysis/token/porter/porter.go +++ b/analysis/token/porter/porter.go @@ -17,8 +17,8 @@ package porter import ( "bytes" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" "github.com/blevesearch/go-porterstemmer" ) diff --git a/analysis/token/porter/porter_test.go b/analysis/token/porter/porter_test.go index abacd3bfa..3e0a79fe5 100644 --- a/analysis/token/porter/porter_test.go +++ b/analysis/token/porter/porter_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestPorterStemmer(t *testing.T) { diff --git a/analysis/token/reverse/reverse.go b/analysis/token/reverse/reverse.go index 671ed8992..f02e6cdf0 100644 --- a/analysis/token/reverse/reverse.go +++ b/analysis/token/reverse/reverse.go @@ -18,8 +18,8 @@ import ( "unicode" "unicode/utf8" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) // Name is the name used to register ReverseFilter in the bleve registry diff --git a/analysis/token/reverse/reverse_test.go b/analysis/token/reverse/reverse_test.go index 8e84ab983..4bb7626a5 100644 --- a/analysis/token/reverse/reverse_test.go +++ b/analysis/token/reverse/reverse_test.go @@ -18,7 +18,7 @@ import ( "bytes" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestReverseFilter(t *testing.T) { diff --git a/analysis/token/shingle/shingle.go b/analysis/token/shingle/shingle.go index a1e6a6c68..59b8ddbfa 100644 --- a/analysis/token/shingle/shingle.go +++ b/analysis/token/shingle/shingle.go @@ -18,8 +18,8 @@ import ( "container/ring" "fmt" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "shingle" diff --git a/analysis/token/shingle/shingle_test.go b/analysis/token/shingle/shingle_test.go index 64406cb62..b545056c4 100644 --- a/analysis/token/shingle/shingle_test.go +++ b/analysis/token/shingle/shingle_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestShingleFilter(t *testing.T) { diff --git a/analysis/token/snowball/snowball.go b/analysis/token/snowball/snowball.go index 6a672c2b2..79b233b28 100644 --- a/analysis/token/snowball/snowball.go +++ b/analysis/token/snowball/snowball.go @@ -17,8 +17,8 @@ package snowball import ( "fmt" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" "github.com/kljensen/snowball" ) diff --git a/analysis/token/snowball/snowball_test.go b/analysis/token/snowball/snowball_test.go index 80c2f6f47..a80534721 100644 --- a/analysis/token/snowball/snowball_test.go +++ b/analysis/token/snowball/snowball_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestSnowballStemmer(t *testing.T) { diff --git a/analysis/token/stop/stop.go b/analysis/token/stop/stop.go index cca2d8e01..bf4b98db1 100644 --- a/analysis/token/stop/stop.go +++ b/analysis/token/stop/stop.go @@ -24,8 +24,8 @@ package stop import ( "fmt" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "stop_tokens" diff --git a/analysis/token/stop/stop_test.go b/analysis/token/stop/stop_test.go index 24c941edc..f63c5620d 100644 --- a/analysis/token/stop/stop_test.go +++ b/analysis/token/stop/stop_test.go @@ -18,9 +18,9 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/tokenmap" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/tokenmap" + "github.com/blevesearch/bleve/v2/registry" ) func TestStopWordsFilter(t *testing.T) { diff --git a/analysis/token/truncate/truncate.go b/analysis/token/truncate/truncate.go index be9570d92..faf65b705 100644 --- a/analysis/token/truncate/truncate.go +++ b/analysis/token/truncate/truncate.go @@ -18,8 +18,8 @@ import ( "fmt" "unicode/utf8" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "truncate_token" diff --git a/analysis/token/truncate/truncate_test.go b/analysis/token/truncate/truncate_test.go index 88c25c432..083e277c9 100644 --- a/analysis/token/truncate/truncate_test.go +++ b/analysis/token/truncate/truncate_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestTruncateTokenFilter(t *testing.T) { diff --git a/analysis/token/unicodenorm/unicodenorm.go b/analysis/token/unicodenorm/unicodenorm.go index c03bac98a..01b191bc2 100644 --- a/analysis/token/unicodenorm/unicodenorm.go +++ b/analysis/token/unicodenorm/unicodenorm.go @@ -17,8 +17,8 @@ package unicodenorm import ( "fmt" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" "golang.org/x/text/unicode/norm" ) diff --git a/analysis/token/unicodenorm/unicodenorm_test.go b/analysis/token/unicodenorm/unicodenorm_test.go index 7f5bfc4e9..0ff2bd8f4 100644 --- a/analysis/token/unicodenorm/unicodenorm_test.go +++ b/analysis/token/unicodenorm/unicodenorm_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) // the following tests come from the lucene diff --git a/analysis/token/unique/unique.go b/analysis/token/unique/unique.go index c60e8c979..6fbc663de 100644 --- a/analysis/token/unique/unique.go +++ b/analysis/token/unique/unique.go @@ -15,8 +15,8 @@ package unique import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "unique" diff --git a/analysis/token/unique/unique_test.go b/analysis/token/unique/unique_test.go index 216d8f1fa..bc17130ad 100644 --- a/analysis/token/unique/unique_test.go +++ b/analysis/token/unique/unique_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestUniqueTermFilter(t *testing.T) { diff --git a/analysis/tokenizer/character/character.go b/analysis/tokenizer/character/character.go index dcac9247a..9c4f7e44b 100644 --- a/analysis/tokenizer/character/character.go +++ b/analysis/tokenizer/character/character.go @@ -17,7 +17,7 @@ package character import ( "unicode/utf8" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) type IsTokenRune func(r rune) bool diff --git a/analysis/tokenizer/character/character_test.go b/analysis/tokenizer/character/character_test.go index 2c7e4531f..30d00e8f4 100644 --- a/analysis/tokenizer/character/character_test.go +++ b/analysis/tokenizer/character/character_test.go @@ -19,7 +19,7 @@ import ( "testing" "unicode" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestCharacterTokenizer(t *testing.T) { diff --git a/analysis/tokenizer/exception/exception.go b/analysis/tokenizer/exception/exception.go index f73872a99..11023e855 100644 --- a/analysis/tokenizer/exception/exception.go +++ b/analysis/tokenizer/exception/exception.go @@ -31,8 +31,8 @@ import ( "regexp" "strings" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "exception" diff --git a/analysis/tokenizer/exception/exception_test.go b/analysis/tokenizer/exception/exception_test.go index a679abf06..1c4acb047 100644 --- a/analysis/tokenizer/exception/exception_test.go +++ b/analysis/tokenizer/exception/exception_test.go @@ -18,9 +18,9 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - _ "github.com/blevesearch/bleve/analysis/tokenizer/unicode" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + _ "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/registry" ) func TestExceptionsTokenizer(t *testing.T) { diff --git a/analysis/tokenizer/letter/letter.go b/analysis/tokenizer/letter/letter.go index 49045c907..96a2a664b 100644 --- a/analysis/tokenizer/letter/letter.go +++ b/analysis/tokenizer/letter/letter.go @@ -17,9 +17,9 @@ package letter import ( "unicode" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/tokenizer/character" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/character" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "letter" diff --git a/analysis/tokenizer/regexp/regexp.go b/analysis/tokenizer/regexp/regexp.go index c3401d825..61bac6ca6 100644 --- a/analysis/tokenizer/regexp/regexp.go +++ b/analysis/tokenizer/regexp/regexp.go @@ -19,8 +19,8 @@ import ( "regexp" "strconv" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "regexp" diff --git a/analysis/tokenizer/regexp/regexp_test.go b/analysis/tokenizer/regexp/regexp_test.go index bd6de66b7..cfad9158b 100644 --- a/analysis/tokenizer/regexp/regexp_test.go +++ b/analysis/tokenizer/regexp/regexp_test.go @@ -19,7 +19,7 @@ import ( "regexp" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestBoundary(t *testing.T) { diff --git a/analysis/tokenizer/single/single.go b/analysis/tokenizer/single/single.go index 18b2b1af9..a3eac7899 100644 --- a/analysis/tokenizer/single/single.go +++ b/analysis/tokenizer/single/single.go @@ -15,8 +15,8 @@ package single import ( - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "single" diff --git a/analysis/tokenizer/single/single_test.go b/analysis/tokenizer/single/single_test.go index 5f3b68d74..7cc134ce3 100644 --- a/analysis/tokenizer/single/single_test.go +++ b/analysis/tokenizer/single/single_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestSingleTokenTokenizer(t *testing.T) { diff --git a/analysis/tokenizer/unicode/unicode.go b/analysis/tokenizer/unicode/unicode.go index 39e38b453..ca3cfe76c 100644 --- a/analysis/tokenizer/unicode/unicode.go +++ b/analysis/tokenizer/unicode/unicode.go @@ -17,8 +17,8 @@ package unicode import ( "github.com/blevesearch/segment" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "unicode" diff --git a/analysis/tokenizer/unicode/unicode_test.go b/analysis/tokenizer/unicode/unicode_test.go index f793b972f..0e0cfd4cc 100644 --- a/analysis/tokenizer/unicode/unicode_test.go +++ b/analysis/tokenizer/unicode/unicode_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" "github.com/blevesearch/segment" ) diff --git a/analysis/tokenizer/web/web.go b/analysis/tokenizer/web/web.go index 8542bc1c4..545ccd9d6 100644 --- a/analysis/tokenizer/web/web.go +++ b/analysis/tokenizer/web/web.go @@ -18,10 +18,10 @@ import ( "regexp" "strings" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/tokenizer/exception" - "github.com/blevesearch/bleve/analysis/tokenizer/unicode" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/exception" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "web" diff --git a/analysis/tokenizer/web/web_test.go b/analysis/tokenizer/web/web_test.go index 16e0da9ba..d5dbcce93 100644 --- a/analysis/tokenizer/web/web_test.go +++ b/analysis/tokenizer/web/web_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) func TestWeb(t *testing.T) { diff --git a/analysis/tokenizer/whitespace/whitespace.go b/analysis/tokenizer/whitespace/whitespace.go index 504545a1f..06134c771 100644 --- a/analysis/tokenizer/whitespace/whitespace.go +++ b/analysis/tokenizer/whitespace/whitespace.go @@ -17,9 +17,9 @@ package whitespace import ( "unicode" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/tokenizer/character" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/character" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "whitespace" diff --git a/analysis/tokenizer/whitespace/whitespace_test.go b/analysis/tokenizer/whitespace/whitespace_test.go index 1165ed923..6bd6b54ab 100644 --- a/analysis/tokenizer/whitespace/whitespace_test.go +++ b/analysis/tokenizer/whitespace/whitespace_test.go @@ -18,8 +18,8 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/tokenizer/character" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/character" ) func TestBoundary(t *testing.T) { diff --git a/analysis/tokenmap/custom.go b/analysis/tokenmap/custom.go index 9b86ce575..ae08d3e17 100644 --- a/analysis/tokenmap/custom.go +++ b/analysis/tokenmap/custom.go @@ -28,8 +28,8 @@ package tokenmap import ( "fmt" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "custom" diff --git a/builder.go b/builder.go index 011933497..dbb7e3ed4 100644 --- a/builder.go +++ b/builder.go @@ -18,9 +18,9 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index/scorch" - "github.com/blevesearch/bleve/mapping" + "github.com/blevesearch/bleve/v2/document" + "github.com/blevesearch/bleve/v2/index/scorch" + "github.com/blevesearch/bleve/v2/mapping" index "github.com/blevesearch/bleve_index_api" ) diff --git a/cmd/bleve/cmd/check.go b/cmd/bleve/cmd/check.go index b1b799c2d..ca4f286ed 100644 --- a/cmd/bleve/cmd/check.go +++ b/cmd/bleve/cmd/check.go @@ -18,7 +18,7 @@ import ( "fmt" "log" - "github.com/blevesearch/bleve" + "github.com/blevesearch/bleve/v2" "github.com/spf13/cobra" ) diff --git a/cmd/bleve/cmd/create.go b/cmd/bleve/cmd/create.go index a5ef3d5bb..3827c6429 100644 --- a/cmd/bleve/cmd/create.go +++ b/cmd/bleve/cmd/create.go @@ -19,8 +19,8 @@ import ( "fmt" "io/ioutil" - "github.com/blevesearch/bleve" - "github.com/blevesearch/bleve/mapping" + "github.com/blevesearch/bleve/v2" + "github.com/blevesearch/bleve/v2/mapping" "github.com/spf13/cobra" ) diff --git a/cmd/bleve/cmd/dump.go b/cmd/bleve/cmd/dump.go index efe60cdf1..db76eeb4b 100644 --- a/cmd/bleve/cmd/dump.go +++ b/cmd/bleve/cmd/dump.go @@ -17,7 +17,7 @@ package cmd import ( "fmt" - "github.com/blevesearch/bleve/index/upsidedown" + "github.com/blevesearch/bleve/v2/index/upsidedown" "github.com/spf13/cobra" ) diff --git a/cmd/bleve/cmd/dumpDoc.go b/cmd/bleve/cmd/dumpDoc.go index 86713d7f2..4473ab66f 100644 --- a/cmd/bleve/cmd/dumpDoc.go +++ b/cmd/bleve/cmd/dumpDoc.go @@ -17,7 +17,7 @@ package cmd import ( "fmt" - "github.com/blevesearch/bleve/index/upsidedown" + "github.com/blevesearch/bleve/v2/index/upsidedown" "github.com/spf13/cobra" ) diff --git a/cmd/bleve/cmd/dumpFields.go b/cmd/bleve/cmd/dumpFields.go index 931e14a2c..0021ff92e 100644 --- a/cmd/bleve/cmd/dumpFields.go +++ b/cmd/bleve/cmd/dumpFields.go @@ -17,7 +17,7 @@ package cmd import ( "fmt" - "github.com/blevesearch/bleve/index/upsidedown" + "github.com/blevesearch/bleve/v2/index/upsidedown" "github.com/spf13/cobra" ) diff --git a/cmd/bleve/cmd/query.go b/cmd/bleve/cmd/query.go index 6e1bd0943..e1b4beceb 100644 --- a/cmd/bleve/cmd/query.go +++ b/cmd/bleve/cmd/query.go @@ -18,8 +18,8 @@ import ( "fmt" "strings" - "github.com/blevesearch/bleve" - "github.com/blevesearch/bleve/search/query" + "github.com/blevesearch/bleve/v2" + "github.com/blevesearch/bleve/v2/search/query" "github.com/spf13/cobra" ) diff --git a/cmd/bleve/cmd/registry.go b/cmd/bleve/cmd/registry.go index ff2db88f1..9d5fc3f4e 100644 --- a/cmd/bleve/cmd/registry.go +++ b/cmd/bleve/cmd/registry.go @@ -18,7 +18,7 @@ import ( "fmt" "sort" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/registry" "github.com/spf13/cobra" ) diff --git a/cmd/bleve/cmd/root.go b/cmd/bleve/cmd/root.go index 8dcf165b2..37a6735da 100644 --- a/cmd/bleve/cmd/root.go +++ b/cmd/bleve/cmd/root.go @@ -19,7 +19,7 @@ import ( "os" "strconv" - "github.com/blevesearch/bleve" + "github.com/blevesearch/bleve/v2" "github.com/spf13/cobra" ) diff --git a/cmd/bleve/cmd/scorch.go b/cmd/bleve/cmd/scorch.go index 781db7031..d8991512c 100644 --- a/cmd/bleve/cmd/scorch.go +++ b/cmd/bleve/cmd/scorch.go @@ -15,7 +15,7 @@ package cmd import ( - "github.com/blevesearch/bleve/cmd/bleve/cmd/scorch" + "github.com/blevesearch/bleve/v2/cmd/bleve/cmd/scorch" ) // make scorch command-line tool a bleve sub-command diff --git a/cmd/bleve/cmd/scorch/ascii.go b/cmd/bleve/cmd/scorch/ascii.go index 34fb1ed70..f6bdaeccd 100644 --- a/cmd/bleve/cmd/scorch/ascii.go +++ b/cmd/bleve/cmd/scorch/ascii.go @@ -18,7 +18,7 @@ import ( "fmt" "strconv" - "github.com/blevesearch/bleve/index/scorch/mergeplan" + "github.com/blevesearch/bleve/v2/index/scorch/mergeplan" "github.com/spf13/cobra" ) diff --git a/cmd/bleve/cmd/scorch/root.go b/cmd/bleve/cmd/scorch/root.go index b27992edc..5e2a44139 100644 --- a/cmd/bleve/cmd/scorch/root.go +++ b/cmd/bleve/cmd/scorch/root.go @@ -18,7 +18,7 @@ import ( "fmt" "os" - "github.com/blevesearch/bleve/index/scorch" + "github.com/blevesearch/bleve/v2/index/scorch" "github.com/spf13/cobra" ) diff --git a/cmd/bleve/gendocs.go b/cmd/bleve/gendocs.go index 4634132a2..433dd78af 100644 --- a/cmd/bleve/gendocs.go +++ b/cmd/bleve/gendocs.go @@ -19,7 +19,7 @@ package main import ( "fmt" - "github.com/blevesearch/bleve/cmd/bleve/cmd" + "github.com/blevesearch/bleve/v2/cmd/bleve/cmd" "github.com/spf13/cobra/doc" ) diff --git a/cmd/bleve/main.go b/cmd/bleve/main.go index ecc82c189..64e627984 100644 --- a/cmd/bleve/main.go +++ b/cmd/bleve/main.go @@ -15,10 +15,10 @@ package main import ( - "github.com/blevesearch/bleve/cmd/bleve/cmd" + "github.com/blevesearch/bleve/v2/cmd/bleve/cmd" // to support standard set of build tags - _ "github.com/blevesearch/bleve/config" + _ "github.com/blevesearch/bleve/v2/config" ) func main() { diff --git a/config.go b/config.go index 2eae641ab..0622b359d 100644 --- a/config.go +++ b/config.go @@ -20,10 +20,10 @@ import ( "log" "time" - "github.com/blevesearch/bleve/index/scorch" - "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" - "github.com/blevesearch/bleve/registry" - "github.com/blevesearch/bleve/search/highlight/highlighter/html" + "github.com/blevesearch/bleve/v2/index/scorch" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap" + "github.com/blevesearch/bleve/v2/registry" + "github.com/blevesearch/bleve/v2/search/highlight/highlighter/html" index "github.com/blevesearch/bleve_index_api" ) diff --git a/config/config.go b/config/config.go index f963fbcc7..04f9fa0c3 100644 --- a/config/config.go +++ b/config/config.go @@ -16,100 +16,100 @@ package config import ( // token maps - _ "github.com/blevesearch/bleve/analysis/tokenmap" + _ "github.com/blevesearch/bleve/v2/analysis/tokenmap" // fragment formatters - _ "github.com/blevesearch/bleve/search/highlight/format/ansi" - _ "github.com/blevesearch/bleve/search/highlight/format/html" + _ "github.com/blevesearch/bleve/v2/search/highlight/format/ansi" + _ "github.com/blevesearch/bleve/v2/search/highlight/format/html" // fragmenters - _ "github.com/blevesearch/bleve/search/highlight/fragmenter/simple" + _ "github.com/blevesearch/bleve/v2/search/highlight/fragmenter/simple" // highlighters - _ "github.com/blevesearch/bleve/search/highlight/highlighter/ansi" - _ "github.com/blevesearch/bleve/search/highlight/highlighter/html" - _ "github.com/blevesearch/bleve/search/highlight/highlighter/simple" + _ "github.com/blevesearch/bleve/v2/search/highlight/highlighter/ansi" + _ "github.com/blevesearch/bleve/v2/search/highlight/highlighter/html" + _ "github.com/blevesearch/bleve/v2/search/highlight/highlighter/simple" // char filters - _ "github.com/blevesearch/bleve/analysis/char/asciifolding" - _ "github.com/blevesearch/bleve/analysis/char/html" - _ "github.com/blevesearch/bleve/analysis/char/regexp" - _ "github.com/blevesearch/bleve/analysis/char/zerowidthnonjoiner" + _ "github.com/blevesearch/bleve/v2/analysis/char/asciifolding" + _ "github.com/blevesearch/bleve/v2/analysis/char/html" + _ "github.com/blevesearch/bleve/v2/analysis/char/regexp" + _ "github.com/blevesearch/bleve/v2/analysis/char/zerowidthnonjoiner" // analyzers - _ "github.com/blevesearch/bleve/analysis/analyzer/custom" - _ "github.com/blevesearch/bleve/analysis/analyzer/keyword" - _ "github.com/blevesearch/bleve/analysis/analyzer/simple" - _ "github.com/blevesearch/bleve/analysis/analyzer/standard" - _ "github.com/blevesearch/bleve/analysis/analyzer/web" + _ "github.com/blevesearch/bleve/v2/analysis/analyzer/custom" + _ "github.com/blevesearch/bleve/v2/analysis/analyzer/keyword" + _ "github.com/blevesearch/bleve/v2/analysis/analyzer/simple" + _ "github.com/blevesearch/bleve/v2/analysis/analyzer/standard" + _ "github.com/blevesearch/bleve/v2/analysis/analyzer/web" // token filters - _ "github.com/blevesearch/bleve/analysis/token/apostrophe" - _ "github.com/blevesearch/bleve/analysis/token/camelcase" - _ "github.com/blevesearch/bleve/analysis/token/compound" - _ "github.com/blevesearch/bleve/analysis/token/edgengram" - _ "github.com/blevesearch/bleve/analysis/token/elision" - _ "github.com/blevesearch/bleve/analysis/token/keyword" - _ "github.com/blevesearch/bleve/analysis/token/length" - _ "github.com/blevesearch/bleve/analysis/token/lowercase" - _ "github.com/blevesearch/bleve/analysis/token/ngram" - _ "github.com/blevesearch/bleve/analysis/token/reverse" - _ "github.com/blevesearch/bleve/analysis/token/shingle" - _ "github.com/blevesearch/bleve/analysis/token/stop" - _ "github.com/blevesearch/bleve/analysis/token/truncate" - _ "github.com/blevesearch/bleve/analysis/token/unicodenorm" - _ "github.com/blevesearch/bleve/analysis/token/unique" + _ "github.com/blevesearch/bleve/v2/analysis/token/apostrophe" + _ "github.com/blevesearch/bleve/v2/analysis/token/camelcase" + _ "github.com/blevesearch/bleve/v2/analysis/token/compound" + _ "github.com/blevesearch/bleve/v2/analysis/token/edgengram" + _ "github.com/blevesearch/bleve/v2/analysis/token/elision" + _ "github.com/blevesearch/bleve/v2/analysis/token/keyword" + _ "github.com/blevesearch/bleve/v2/analysis/token/length" + _ "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + _ "github.com/blevesearch/bleve/v2/analysis/token/ngram" + _ "github.com/blevesearch/bleve/v2/analysis/token/reverse" + _ "github.com/blevesearch/bleve/v2/analysis/token/shingle" + _ "github.com/blevesearch/bleve/v2/analysis/token/stop" + _ "github.com/blevesearch/bleve/v2/analysis/token/truncate" + _ "github.com/blevesearch/bleve/v2/analysis/token/unicodenorm" + _ "github.com/blevesearch/bleve/v2/analysis/token/unique" // tokenizers - _ "github.com/blevesearch/bleve/analysis/tokenizer/exception" - _ "github.com/blevesearch/bleve/analysis/tokenizer/regexp" - _ "github.com/blevesearch/bleve/analysis/tokenizer/single" - _ "github.com/blevesearch/bleve/analysis/tokenizer/unicode" - _ "github.com/blevesearch/bleve/analysis/tokenizer/web" - _ "github.com/blevesearch/bleve/analysis/tokenizer/whitespace" + _ "github.com/blevesearch/bleve/v2/analysis/tokenizer/exception" + _ "github.com/blevesearch/bleve/v2/analysis/tokenizer/regexp" + _ "github.com/blevesearch/bleve/v2/analysis/tokenizer/single" + _ "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" + _ "github.com/blevesearch/bleve/v2/analysis/tokenizer/web" + _ "github.com/blevesearch/bleve/v2/analysis/tokenizer/whitespace" // date time parsers - _ "github.com/blevesearch/bleve/analysis/datetime/flexible" - _ "github.com/blevesearch/bleve/analysis/datetime/optional" + _ "github.com/blevesearch/bleve/v2/analysis/datetime/flexible" + _ "github.com/blevesearch/bleve/v2/analysis/datetime/optional" // languages - _ "github.com/blevesearch/bleve/analysis/lang/ar" - _ "github.com/blevesearch/bleve/analysis/lang/bg" - _ "github.com/blevesearch/bleve/analysis/lang/ca" - _ "github.com/blevesearch/bleve/analysis/lang/cjk" - _ "github.com/blevesearch/bleve/analysis/lang/ckb" - _ "github.com/blevesearch/bleve/analysis/lang/cs" - _ "github.com/blevesearch/bleve/analysis/lang/da" - _ "github.com/blevesearch/bleve/analysis/lang/de" - _ "github.com/blevesearch/bleve/analysis/lang/el" - _ "github.com/blevesearch/bleve/analysis/lang/en" - _ "github.com/blevesearch/bleve/analysis/lang/es" - _ "github.com/blevesearch/bleve/analysis/lang/eu" - _ "github.com/blevesearch/bleve/analysis/lang/fa" - _ "github.com/blevesearch/bleve/analysis/lang/fi" - _ "github.com/blevesearch/bleve/analysis/lang/fr" - _ "github.com/blevesearch/bleve/analysis/lang/ga" - _ "github.com/blevesearch/bleve/analysis/lang/gl" - _ "github.com/blevesearch/bleve/analysis/lang/hi" - _ "github.com/blevesearch/bleve/analysis/lang/hu" - _ "github.com/blevesearch/bleve/analysis/lang/hy" - _ "github.com/blevesearch/bleve/analysis/lang/id" - _ "github.com/blevesearch/bleve/analysis/lang/in" - _ "github.com/blevesearch/bleve/analysis/lang/it" - _ "github.com/blevesearch/bleve/analysis/lang/nl" - _ "github.com/blevesearch/bleve/analysis/lang/no" - _ "github.com/blevesearch/bleve/analysis/lang/pt" - _ "github.com/blevesearch/bleve/analysis/lang/ro" - _ "github.com/blevesearch/bleve/analysis/lang/ru" - _ "github.com/blevesearch/bleve/analysis/lang/sv" - _ "github.com/blevesearch/bleve/analysis/lang/tr" + _ "github.com/blevesearch/bleve/v2/analysis/lang/ar" + _ "github.com/blevesearch/bleve/v2/analysis/lang/bg" + _ "github.com/blevesearch/bleve/v2/analysis/lang/ca" + _ "github.com/blevesearch/bleve/v2/analysis/lang/cjk" + _ "github.com/blevesearch/bleve/v2/analysis/lang/ckb" + _ "github.com/blevesearch/bleve/v2/analysis/lang/cs" + _ "github.com/blevesearch/bleve/v2/analysis/lang/da" + _ "github.com/blevesearch/bleve/v2/analysis/lang/de" + _ "github.com/blevesearch/bleve/v2/analysis/lang/el" + _ "github.com/blevesearch/bleve/v2/analysis/lang/en" + _ "github.com/blevesearch/bleve/v2/analysis/lang/es" + _ "github.com/blevesearch/bleve/v2/analysis/lang/eu" + _ "github.com/blevesearch/bleve/v2/analysis/lang/fa" + _ "github.com/blevesearch/bleve/v2/analysis/lang/fi" + _ "github.com/blevesearch/bleve/v2/analysis/lang/fr" + _ "github.com/blevesearch/bleve/v2/analysis/lang/ga" + _ "github.com/blevesearch/bleve/v2/analysis/lang/gl" + _ "github.com/blevesearch/bleve/v2/analysis/lang/hi" + _ "github.com/blevesearch/bleve/v2/analysis/lang/hu" + _ "github.com/blevesearch/bleve/v2/analysis/lang/hy" + _ "github.com/blevesearch/bleve/v2/analysis/lang/id" + _ "github.com/blevesearch/bleve/v2/analysis/lang/in" + _ "github.com/blevesearch/bleve/v2/analysis/lang/it" + _ "github.com/blevesearch/bleve/v2/analysis/lang/nl" + _ "github.com/blevesearch/bleve/v2/analysis/lang/no" + _ "github.com/blevesearch/bleve/v2/analysis/lang/pt" + _ "github.com/blevesearch/bleve/v2/analysis/lang/ro" + _ "github.com/blevesearch/bleve/v2/analysis/lang/ru" + _ "github.com/blevesearch/bleve/v2/analysis/lang/sv" + _ "github.com/blevesearch/bleve/v2/analysis/lang/tr" // kv stores - _ "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" - _ "github.com/blevesearch/bleve/index/upsidedown/store/goleveldb" - _ "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" - _ "github.com/blevesearch/bleve/index/upsidedown/store/moss" + _ "github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb" + _ "github.com/blevesearch/bleve/v2/index/upsidedown/store/goleveldb" + _ "github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap" + _ "github.com/blevesearch/bleve/v2/index/upsidedown/store/moss" // index types - _ "github.com/blevesearch/bleve/index/upsidedown" + _ "github.com/blevesearch/bleve/v2/index/upsidedown" ) diff --git a/config_disk.go b/config_disk.go index 7db7d0cd3..ccfd6da8c 100644 --- a/config_disk.go +++ b/config_disk.go @@ -16,7 +16,7 @@ package bleve -import "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" +import "github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb" // in normal environments we configure boltdb as the default storage func initDisk() { diff --git a/document/document.go b/document/document.go index a0e0fad61..1a6050f0a 100644 --- a/document/document.go +++ b/document/document.go @@ -18,7 +18,7 @@ import ( "fmt" "reflect" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/size" index "github.com/blevesearch/bleve_index_api" ) diff --git a/document/field_boolean.go b/document/field_boolean.go index a588bdf9b..fdf3cc0e5 100644 --- a/document/field_boolean.go +++ b/document/field_boolean.go @@ -18,8 +18,8 @@ import ( "fmt" "reflect" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/size" index "github.com/blevesearch/bleve_index_api" ) diff --git a/document/field_composite.go b/document/field_composite.go index 8517ee4c3..8c47643f5 100644 --- a/document/field_composite.go +++ b/document/field_composite.go @@ -17,7 +17,7 @@ package document import ( "reflect" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/size" index "github.com/blevesearch/bleve_index_api" ) diff --git a/document/field_datetime.go b/document/field_datetime.go index dbb66a72b..650640550 100644 --- a/document/field_datetime.go +++ b/document/field_datetime.go @@ -20,9 +20,9 @@ import ( "reflect" "time" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/numeric" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/numeric" + "github.com/blevesearch/bleve/v2/size" index "github.com/blevesearch/bleve_index_api" ) diff --git a/document/field_geopoint.go b/document/field_geopoint.go index 35375ff4c..89de4e3bf 100644 --- a/document/field_geopoint.go +++ b/document/field_geopoint.go @@ -18,10 +18,10 @@ import ( "fmt" "reflect" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/geo" - "github.com/blevesearch/bleve/numeric" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/geo" + "github.com/blevesearch/bleve/v2/numeric" + "github.com/blevesearch/bleve/v2/size" index "github.com/blevesearch/bleve_index_api" ) diff --git a/document/field_numeric.go b/document/field_numeric.go index 4d2ceb239..a54b082b4 100644 --- a/document/field_numeric.go +++ b/document/field_numeric.go @@ -18,9 +18,9 @@ import ( "fmt" "reflect" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/numeric" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/numeric" + "github.com/blevesearch/bleve/v2/size" index "github.com/blevesearch/bleve_index_api" ) diff --git a/document/field_text.go b/document/field_text.go index b2f8a0103..924de532c 100644 --- a/document/field_text.go +++ b/document/field_text.go @@ -18,8 +18,8 @@ import ( "fmt" "reflect" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/size" index "github.com/blevesearch/bleve_index_api" ) diff --git a/examples_test.go b/examples_test.go index 3a629c301..a624b2605 100644 --- a/examples_test.go +++ b/examples_test.go @@ -20,9 +20,9 @@ import ( "testing" "time" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/highlight/highlighter/ansi" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/highlight/highlighter/ansi" ) var indexMapping mapping.IndexMapping diff --git a/geo/geo.go b/geo/geo.go index b18ace433..55eace1df 100644 --- a/geo/geo.go +++ b/geo/geo.go @@ -18,7 +18,7 @@ import ( "fmt" "math" - "github.com/blevesearch/bleve/numeric" + "github.com/blevesearch/bleve/v2/numeric" ) // GeoBits is the number of bits used for a single geo point diff --git a/go.mod b/go.mod index 10504cc08..3ba4ec654 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/blevesearch/bleve +module github.com/blevesearch/bleve/v2 go 1.13 diff --git a/http/debug.go b/http/debug.go index d102f11d6..292a5392a 100644 --- a/http/debug.go +++ b/http/debug.go @@ -18,7 +18,7 @@ import ( "fmt" "net/http" - "github.com/blevesearch/bleve/index/upsidedown" + "github.com/blevesearch/bleve/v2/index/upsidedown" ) // DebugDocumentHandler allows you to debug the index content diff --git a/http/index_create.go b/http/index_create.go index 387cf8cbb..609e14f51 100644 --- a/http/index_create.go +++ b/http/index_create.go @@ -21,7 +21,7 @@ import ( "net/http" "os" - "github.com/blevesearch/bleve" + "github.com/blevesearch/bleve/v2" ) type CreateIndexHandler struct { diff --git a/http/index_get.go b/http/index_get.go index 88181702f..443c357e1 100644 --- a/http/index_get.go +++ b/http/index_get.go @@ -18,7 +18,7 @@ import ( "fmt" "net/http" - "github.com/blevesearch/bleve/mapping" + "github.com/blevesearch/bleve/v2/mapping" ) type GetIndexHandler struct { diff --git a/http/registry.go b/http/registry.go index 63a2a17e7..3bacb3b1b 100644 --- a/http/registry.go +++ b/http/registry.go @@ -18,7 +18,7 @@ import ( "fmt" "sync" - "github.com/blevesearch/bleve" + "github.com/blevesearch/bleve/v2" ) var indexNameMapping map[string]bleve.Index diff --git a/http/search.go b/http/search.go index e2bd09df7..c5f77ad35 100644 --- a/http/search.go +++ b/http/search.go @@ -20,8 +20,8 @@ import ( "io/ioutil" "net/http" - "github.com/blevesearch/bleve" - "github.com/blevesearch/bleve/search/query" + "github.com/blevesearch/bleve/v2" + "github.com/blevesearch/bleve/v2/search/query" ) // SearchHandler can handle search requests sent over HTTP diff --git a/index.go b/index.go index e5d686c5e..e08271e51 100644 --- a/index.go +++ b/index.go @@ -16,11 +16,11 @@ package bleve import ( "context" - "github.com/blevesearch/bleve/index/upsidedown" + "github.com/blevesearch/bleve/v2/index/upsidedown" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/document" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/size" index "github.com/blevesearch/bleve_index_api" ) diff --git a/index/scorch/builder_test.go b/index/scorch/builder_test.go index 2f7e7abb7..aaff060e9 100644 --- a/index/scorch/builder_test.go +++ b/index/scorch/builder_test.go @@ -20,7 +20,7 @@ import ( "os" "testing" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" ) diff --git a/index/scorch/event_test.go b/index/scorch/event_test.go index c72cfe122..ed1dd4d95 100644 --- a/index/scorch/event_test.go +++ b/index/scorch/event_test.go @@ -17,7 +17,7 @@ package scorch import ( "testing" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" ) diff --git a/index/scorch/field_dict_test.go b/index/scorch/field_dict_test.go index e2df21d44..6bca8e348 100644 --- a/index/scorch/field_dict_test.go +++ b/index/scorch/field_dict_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" ) diff --git a/index/scorch/merge.go b/index/scorch/merge.go index 0a1c5ccb0..5cd41ae8a 100644 --- a/index/scorch/merge.go +++ b/index/scorch/merge.go @@ -24,7 +24,7 @@ import ( "time" "github.com/RoaringBitmap/roaring" - "github.com/blevesearch/bleve/index/scorch/mergeplan" + "github.com/blevesearch/bleve/v2/index/scorch/mergeplan" segment "github.com/blevesearch/scorch_segment_api" ) diff --git a/index/scorch/merge_test.go b/index/scorch/merge_test.go index ed5770b09..b3783c6c3 100644 --- a/index/scorch/merge_test.go +++ b/index/scorch/merge_test.go @@ -19,7 +19,7 @@ import ( "sync/atomic" "testing" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" ) diff --git a/index/scorch/reader_test.go b/index/scorch/reader_test.go index 929a6e8a2..e1bca049c 100644 --- a/index/scorch/reader_test.go +++ b/index/scorch/reader_test.go @@ -19,7 +19,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" ) diff --git a/index/scorch/rollback_test.go b/index/scorch/rollback_test.go index c9b1ddd66..183e5347c 100644 --- a/index/scorch/rollback_test.go +++ b/index/scorch/rollback_test.go @@ -17,7 +17,7 @@ package scorch import ( "testing" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" ) diff --git a/index/scorch/scorch.go b/index/scorch/scorch.go index 7295f714e..99c345bee 100644 --- a/index/scorch/scorch.go +++ b/index/scorch/scorch.go @@ -24,7 +24,7 @@ import ( "time" "github.com/RoaringBitmap/roaring" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/registry" index "github.com/blevesearch/bleve_index_api" segment "github.com/blevesearch/scorch_segment_api" bolt "go.etcd.io/bbolt" diff --git a/index/scorch/scorch_test.go b/index/scorch/scorch_test.go index 4fd915550..38cd70e63 100644 --- a/index/scorch/scorch_test.go +++ b/index/scorch/scorch_test.go @@ -28,14 +28,14 @@ import ( "testing" "time" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/analyzer/keyword" - "github.com/blevesearch/bleve/analysis/analyzer/standard" - regexpTokenizer "github.com/blevesearch/bleve/analysis/tokenizer/regexp" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/analyzer/keyword" + "github.com/blevesearch/bleve/v2/analysis/analyzer/standard" + regexpTokenizer "github.com/blevesearch/bleve/v2/analysis/tokenizer/regexp" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/scorch/mergeplan" - "github.com/blevesearch/bleve/mapping" + "github.com/blevesearch/bleve/v2/index/scorch/mergeplan" + "github.com/blevesearch/bleve/v2/mapping" ) func init() { diff --git a/index/scorch/snapshot_index.go b/index/scorch/snapshot_index.go index f4347d508..7c8353c8b 100644 --- a/index/scorch/snapshot_index.go +++ b/index/scorch/snapshot_index.go @@ -24,7 +24,7 @@ import ( "sync/atomic" "github.com/RoaringBitmap/roaring" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" segment "github.com/blevesearch/scorch_segment_api" "github.com/couchbase/vellum" diff --git a/index/scorch/snapshot_index_doc.go b/index/scorch/snapshot_index_doc.go index 09d07f930..183f1783a 100644 --- a/index/scorch/snapshot_index_doc.go +++ b/index/scorch/snapshot_index_doc.go @@ -20,7 +20,7 @@ import ( "github.com/RoaringBitmap/roaring" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeIndexSnapshotDocIDReader int diff --git a/index/scorch/snapshot_index_tfr.go b/index/scorch/snapshot_index_tfr.go index 05b5cba46..367d29be4 100644 --- a/index/scorch/snapshot_index_tfr.go +++ b/index/scorch/snapshot_index_tfr.go @@ -22,7 +22,7 @@ import ( index "github.com/blevesearch/bleve_index_api" segment "github.com/blevesearch/scorch_segment_api" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeIndexSnapshotTermFieldReader int diff --git a/index/scorch/snapshot_segment.go b/index/scorch/snapshot_segment.go index e585541eb..38ffb3623 100644 --- a/index/scorch/snapshot_segment.go +++ b/index/scorch/snapshot_segment.go @@ -22,7 +22,7 @@ import ( "github.com/RoaringBitmap/roaring" index "github.com/blevesearch/bleve_index_api" segment "github.com/blevesearch/scorch_segment_api" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/size" ) var TermSeparator byte = 0xff diff --git a/index/upsidedown/analysis_test.go b/index/upsidedown/analysis_test.go index 473ac935e..0e964b327 100644 --- a/index/upsidedown/analysis_test.go +++ b/index/upsidedown/analysis_test.go @@ -17,11 +17,11 @@ package upsidedown import ( "testing" - "github.com/blevesearch/bleve/analysis/analyzer/standard" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/analysis/analyzer/standard" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/upsidedown/store/null" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/null" + "github.com/blevesearch/bleve/v2/registry" ) func TestAnalysisBug328(t *testing.T) { diff --git a/index/upsidedown/benchmark_boltdb_test.go b/index/upsidedown/benchmark_boltdb_test.go index 0f96a48a2..5fabfa668 100644 --- a/index/upsidedown/benchmark_boltdb_test.go +++ b/index/upsidedown/benchmark_boltdb_test.go @@ -17,7 +17,7 @@ package upsidedown import ( "testing" - "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb" ) var boltTestConfig = map[string]interface{}{ diff --git a/index/upsidedown/benchmark_common_test.go b/index/upsidedown/benchmark_common_test.go index 4ae33f2ce..d4bb9e8f9 100644 --- a/index/upsidedown/benchmark_common_test.go +++ b/index/upsidedown/benchmark_common_test.go @@ -19,10 +19,10 @@ import ( "strconv" "testing" - _ "github.com/blevesearch/bleve/analysis/analyzer/standard" - "github.com/blevesearch/bleve/document" + _ "github.com/blevesearch/bleve/v2/analysis/analyzer/standard" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/registry" ) var benchmarkDocBodies = []string{ diff --git a/index/upsidedown/benchmark_gtreap_test.go b/index/upsidedown/benchmark_gtreap_test.go index 30b87e305..fb508fd13 100644 --- a/index/upsidedown/benchmark_gtreap_test.go +++ b/index/upsidedown/benchmark_gtreap_test.go @@ -17,7 +17,7 @@ package upsidedown import ( "testing" - "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap" ) func BenchmarkGTreapIndexing1Workers(b *testing.B) { diff --git a/index/upsidedown/benchmark_null_test.go b/index/upsidedown/benchmark_null_test.go index 5f92e6e22..1576aaefc 100644 --- a/index/upsidedown/benchmark_null_test.go +++ b/index/upsidedown/benchmark_null_test.go @@ -17,7 +17,7 @@ package upsidedown import ( "testing" - "github.com/blevesearch/bleve/index/upsidedown/store/null" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/null" ) func BenchmarkNullIndexing1Workers(b *testing.B) { diff --git a/index/upsidedown/dump_test.go b/index/upsidedown/dump_test.go index 662acd293..74408532c 100644 --- a/index/upsidedown/dump_test.go +++ b/index/upsidedown/dump_test.go @@ -18,10 +18,10 @@ import ( "testing" "time" - "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/document" ) func TestDump(t *testing.T) { diff --git a/index/upsidedown/field_dict_test.go b/index/upsidedown/field_dict_test.go index d2170553e..b3b3d9179 100644 --- a/index/upsidedown/field_dict_test.go +++ b/index/upsidedown/field_dict_test.go @@ -18,9 +18,9 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb" ) func TestIndexFieldDict(t *testing.T) { diff --git a/index/upsidedown/index_reader.go b/index/upsidedown/index_reader.go index ea1fd65ca..ff0986d57 100644 --- a/index/upsidedown/index_reader.go +++ b/index/upsidedown/index_reader.go @@ -17,7 +17,7 @@ package upsidedown import ( "reflect" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/upsidedown_store_api" ) diff --git a/index/upsidedown/reader.go b/index/upsidedown/reader.go index 0d2d11028..701967298 100644 --- a/index/upsidedown/reader.go +++ b/index/upsidedown/reader.go @@ -22,7 +22,7 @@ import ( index "github.com/blevesearch/bleve_index_api" "github.com/blevesearch/upsidedown_store_api" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeUpsideDownCouchTermFieldReader int diff --git a/index/upsidedown/reader_test.go b/index/upsidedown/reader_test.go index 8fd52292d..1abc4f197 100644 --- a/index/upsidedown/reader_test.go +++ b/index/upsidedown/reader_test.go @@ -18,9 +18,9 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb" ) func TestIndexReader(t *testing.T) { diff --git a/index/upsidedown/row.go b/index/upsidedown/row.go index 531e0a0d3..901a4bcb0 100644 --- a/index/upsidedown/row.go +++ b/index/upsidedown/row.go @@ -22,7 +22,7 @@ import ( "math" "reflect" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/size" "github.com/golang/protobuf/proto" ) diff --git a/index/upsidedown/store/boltdb/store.go b/index/upsidedown/store/boltdb/store.go index 5bfbb6db8..ac3a0f825 100644 --- a/index/upsidedown/store/boltdb/store.go +++ b/index/upsidedown/store/boltdb/store.go @@ -29,7 +29,7 @@ import ( "os" store "github.com/blevesearch/upsidedown_store_api" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/registry" bolt "go.etcd.io/bbolt" ) diff --git a/index/upsidedown/store/goleveldb/store.go b/index/upsidedown/store/goleveldb/store.go index de41c73ad..fcd961b9a 100644 --- a/index/upsidedown/store/goleveldb/store.go +++ b/index/upsidedown/store/goleveldb/store.go @@ -20,7 +20,7 @@ import ( "os" store "github.com/blevesearch/upsidedown_store_api" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/registry" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/opt" "github.com/syndtr/goleveldb/leveldb/util" diff --git a/index/upsidedown/store/gtreap/store.go b/index/upsidedown/store/gtreap/store.go index 6f186257d..8a81663d3 100644 --- a/index/upsidedown/store/gtreap/store.go +++ b/index/upsidedown/store/gtreap/store.go @@ -25,7 +25,7 @@ import ( "sync" "github.com/blevesearch/upsidedown_store_api" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/registry" "github.com/steveyen/gtreap" ) diff --git a/index/upsidedown/store/metrics/metrics_test.go b/index/upsidedown/store/metrics/metrics_test.go index 6699c70d2..416a7dc1d 100644 --- a/index/upsidedown/store/metrics/metrics_test.go +++ b/index/upsidedown/store/metrics/metrics_test.go @@ -20,7 +20,7 @@ import ( "fmt" "testing" - "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap" ) func TestMetricsStore(t *testing.T) { diff --git a/index/upsidedown/store/metrics/store.go b/index/upsidedown/store/metrics/store.go index 5ae7870f6..376dce2d3 100644 --- a/index/upsidedown/store/metrics/store.go +++ b/index/upsidedown/store/metrics/store.go @@ -26,7 +26,7 @@ import ( "time" store "github.com/blevesearch/upsidedown_store_api" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/registry" "github.com/rcrowley/go-metrics" ) diff --git a/index/upsidedown/store/metrics/store_test.go b/index/upsidedown/store/metrics/store_test.go index 1513dd18d..0cd00af23 100644 --- a/index/upsidedown/store/metrics/store_test.go +++ b/index/upsidedown/store/metrics/store_test.go @@ -18,7 +18,7 @@ import ( "testing" store "github.com/blevesearch/upsidedown_store_api" - "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap" "github.com/blevesearch/upsidedown_store_api/test" ) diff --git a/index/upsidedown/store/moss/lower.go b/index/upsidedown/store/moss/lower.go index 0b0dd8044..cfe570929 100644 --- a/index/upsidedown/store/moss/lower.go +++ b/index/upsidedown/store/moss/lower.go @@ -26,7 +26,7 @@ import ( "github.com/couchbase/moss" store "github.com/blevesearch/upsidedown_store_api" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/registry" ) func initLowerLevelStore( diff --git a/index/upsidedown/store/moss/store.go b/index/upsidedown/store/moss/store.go index e2099c286..5253f08b0 100644 --- a/index/upsidedown/store/moss/store.go +++ b/index/upsidedown/store/moss/store.go @@ -25,7 +25,7 @@ import ( "github.com/couchbase/moss" store "github.com/blevesearch/upsidedown_store_api" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/registry" ) // RegistryCollectionOptions should be treated as read-only after diff --git a/index/upsidedown/store/null/null.go b/index/upsidedown/store/null/null.go index d7c1b5750..f88d482da 100644 --- a/index/upsidedown/store/null/null.go +++ b/index/upsidedown/store/null/null.go @@ -16,7 +16,7 @@ package null import ( store "github.com/blevesearch/upsidedown_store_api" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/registry" ) const Name = "null" diff --git a/index/upsidedown/upsidedown.go b/index/upsidedown/upsidedown.go index 6f00fb438..d67ee03fb 100644 --- a/index/upsidedown/upsidedown.go +++ b/index/upsidedown/upsidedown.go @@ -25,8 +25,8 @@ import ( "sync/atomic" "time" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/document" + "github.com/blevesearch/bleve/v2/registry" index "github.com/blevesearch/bleve_index_api" store "github.com/blevesearch/upsidedown_store_api" diff --git a/index/upsidedown/upsidedown_test.go b/index/upsidedown/upsidedown_test.go index f2a829273..0d72c5504 100644 --- a/index/upsidedown/upsidedown_test.go +++ b/index/upsidedown/upsidedown_test.go @@ -24,14 +24,14 @@ import ( "testing" "time" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/analyzer/standard" - regexpTokenizer "github.com/blevesearch/bleve/analysis/tokenizer/regexp" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/analyzer/standard" + regexpTokenizer "github.com/blevesearch/bleve/v2/analysis/tokenizer/regexp" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" - "github.com/blevesearch/bleve/index/upsidedown/store/null" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/null" + "github.com/blevesearch/bleve/v2/registry" ) var testAnalyzer = &analysis.Analyzer{ diff --git a/index_alias_impl.go b/index_alias_impl.go index 4092932fa..5a4dc5a48 100644 --- a/index_alias_impl.go +++ b/index_alias_impl.go @@ -19,8 +19,8 @@ import ( "sync" "time" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" index "github.com/blevesearch/bleve_index_api" ) diff --git a/index_alias_impl_test.go b/index_alias_impl_test.go index 759d0715a..1b6ae55f4 100644 --- a/index_alias_impl_test.go +++ b/index_alias_impl_test.go @@ -21,10 +21,10 @@ import ( "testing" "time" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/numeric" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/document" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/numeric" + "github.com/blevesearch/bleve/v2/search" index "github.com/blevesearch/bleve_index_api" ) diff --git a/index_impl.go b/index_impl.go index 497329622..879a36634 100644 --- a/index_impl.go +++ b/index_impl.go @@ -23,14 +23,14 @@ import ( "sync/atomic" "time" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index/upsidedown" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/registry" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/collector" - "github.com/blevesearch/bleve/search/facet" - "github.com/blevesearch/bleve/search/highlight" + "github.com/blevesearch/bleve/v2/document" + "github.com/blevesearch/bleve/v2/index/upsidedown" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/registry" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/collector" + "github.com/blevesearch/bleve/v2/search/facet" + "github.com/blevesearch/bleve/v2/search/highlight" index "github.com/blevesearch/bleve_index_api" ) diff --git a/index_meta.go b/index_meta.go index d814799a8..fe0ddebac 100644 --- a/index_meta.go +++ b/index_meta.go @@ -20,7 +20,7 @@ import ( "os" "path/filepath" - "github.com/blevesearch/bleve/index/upsidedown" + "github.com/blevesearch/bleve/v2/index/upsidedown" ) const metaFilename = "index_meta.json" diff --git a/index_test.go b/index_test.go index 23e9d62dd..6b1e72ddc 100644 --- a/index_test.go +++ b/index_test.go @@ -31,17 +31,17 @@ import ( "testing" "time" - "github.com/blevesearch/bleve/analysis/analyzer/keyword" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/analysis/analyzer/keyword" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" - "github.com/blevesearch/bleve/index/upsidedown/store/null" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/query" - - "github.com/blevesearch/bleve/index/scorch" - "github.com/blevesearch/bleve/index/upsidedown" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/null" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/query" + + "github.com/blevesearch/bleve/v2/index/scorch" + "github.com/blevesearch/bleve/v2/index/upsidedown" ) type Fatalfable interface { diff --git a/mapping.go b/mapping.go index 76238dc15..54753073a 100644 --- a/mapping.go +++ b/mapping.go @@ -14,7 +14,7 @@ package bleve -import "github.com/blevesearch/bleve/mapping" +import "github.com/blevesearch/bleve/v2/mapping" // NewIndexMapping creates a new IndexMapping that will use all the default indexing rules func NewIndexMapping() *mapping.IndexMappingImpl { diff --git a/mapping/document.go b/mapping/document.go index dd42fab96..44911de77 100644 --- a/mapping/document.go +++ b/mapping/document.go @@ -21,7 +21,7 @@ import ( "reflect" "time" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/registry" ) // A DocumentMapping describes how a type of document diff --git a/mapping/field.go b/mapping/field.go index edfb8af0d..7ad1744d4 100644 --- a/mapping/field.go +++ b/mapping/field.go @@ -21,9 +21,9 @@ import ( index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/geo" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/document" + "github.com/blevesearch/bleve/v2/geo" ) // control the default behavior for dynamic fields (those not explicitly mapped) diff --git a/mapping/index.go b/mapping/index.go index 1c9cbdfc1..c34343385 100644 --- a/mapping/index.go +++ b/mapping/index.go @@ -19,11 +19,11 @@ import ( "fmt" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/analyzer/standard" - "github.com/blevesearch/bleve/analysis/datetime/optional" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/analyzer/standard" + "github.com/blevesearch/bleve/v2/analysis/datetime/optional" + "github.com/blevesearch/bleve/v2/document" + "github.com/blevesearch/bleve/v2/registry" ) var MappingJSONStrict = false @@ -107,10 +107,10 @@ func (im *IndexMappingImpl) AddCustomTokenFilter(name string, config map[string] // use their metadata to fill configuration entries: // // import ( -// "github.com/blevesearch/bleve/analysis/analyzer/custom" -// "github.com/blevesearch/bleve/analysis/char/html" -// "github.com/blevesearch/bleve/analysis/token/lowercase" -// "github.com/blevesearch/bleve/analysis/tokenizer/unicode" +// "github.com/blevesearch/bleve/v2/analysis/analyzer/custom" +// "github.com/blevesearch/bleve/v2/analysis/char/html" +// "github.com/blevesearch/bleve/v2/analysis/token/lowercase" +// "github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode" // ) // // m := bleve.NewIndexMapping() diff --git a/mapping/mapping.go b/mapping/mapping.go index 4a4728112..bcf6749a4 100644 --- a/mapping/mapping.go +++ b/mapping/mapping.go @@ -18,8 +18,8 @@ import ( "io/ioutil" "log" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/document" ) // A Classifier is an interface describing any object which knows how to diff --git a/mapping/mapping_test.go b/mapping/mapping_test.go index 2f4477933..f20b9ede7 100644 --- a/mapping/mapping_test.go +++ b/mapping/mapping_test.go @@ -23,9 +23,9 @@ import ( "testing" "time" - "github.com/blevesearch/bleve/analysis/tokenizer/exception" - "github.com/blevesearch/bleve/analysis/tokenizer/regexp" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/exception" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/regexp" + "github.com/blevesearch/bleve/v2/document" ) var mappingSource = []byte(`{ diff --git a/query.go b/query.go index 523db5ec0..91d2d5f42 100644 --- a/query.go +++ b/query.go @@ -17,7 +17,7 @@ package bleve import ( "time" - "github.com/blevesearch/bleve/search/query" + "github.com/blevesearch/bleve/v2/search/query" ) // NewBoolFieldQuery creates a new Query for boolean fields diff --git a/registry/analyzer.go b/registry/analyzer.go index 340e349dc..6c0d73b31 100644 --- a/registry/analyzer.go +++ b/registry/analyzer.go @@ -17,7 +17,7 @@ package registry import ( "fmt" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func RegisterAnalyzer(name string, constructor AnalyzerConstructor) { diff --git a/registry/char_filter.go b/registry/char_filter.go index 4696713cc..aa400be68 100644 --- a/registry/char_filter.go +++ b/registry/char_filter.go @@ -17,7 +17,7 @@ package registry import ( "fmt" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func RegisterCharFilter(name string, constructor CharFilterConstructor) { diff --git a/registry/datetime_parser.go b/registry/datetime_parser.go index 2cd46e5ac..a2d8ac24a 100644 --- a/registry/datetime_parser.go +++ b/registry/datetime_parser.go @@ -17,7 +17,7 @@ package registry import ( "fmt" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func RegisterDateTimeParser(name string, constructor DateTimeParserConstructor) { diff --git a/registry/fragment_formatter.go b/registry/fragment_formatter.go index d0121d967..6699f53ba 100644 --- a/registry/fragment_formatter.go +++ b/registry/fragment_formatter.go @@ -17,7 +17,7 @@ package registry import ( "fmt" - "github.com/blevesearch/bleve/search/highlight" + "github.com/blevesearch/bleve/v2/search/highlight" ) func RegisterFragmentFormatter(name string, constructor FragmentFormatterConstructor) { diff --git a/registry/fragmenter.go b/registry/fragmenter.go index 18ab2ac07..cd1e32d28 100644 --- a/registry/fragmenter.go +++ b/registry/fragmenter.go @@ -17,7 +17,7 @@ package registry import ( "fmt" - "github.com/blevesearch/bleve/search/highlight" + "github.com/blevesearch/bleve/v2/search/highlight" ) func RegisterFragmenter(name string, constructor FragmenterConstructor) { diff --git a/registry/highlighter.go b/registry/highlighter.go index b84219ca1..8eb210fb3 100644 --- a/registry/highlighter.go +++ b/registry/highlighter.go @@ -17,7 +17,7 @@ package registry import ( "fmt" - "github.com/blevesearch/bleve/search/highlight" + "github.com/blevesearch/bleve/v2/search/highlight" ) func RegisterHighlighter(name string, constructor HighlighterConstructor) { diff --git a/registry/registry.go b/registry/registry.go index a0ea69c8b..02125e64f 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -17,8 +17,8 @@ package registry import ( "fmt" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/search/highlight" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/search/highlight" ) var stores = make(KVStoreRegistry, 0) diff --git a/registry/token_filter.go b/registry/token_filter.go index e202e15fc..df39411ae 100644 --- a/registry/token_filter.go +++ b/registry/token_filter.go @@ -17,7 +17,7 @@ package registry import ( "fmt" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func RegisterTokenFilter(name string, constructor TokenFilterConstructor) { diff --git a/registry/token_maps.go b/registry/token_maps.go index 66ca08fdf..08c9956eb 100644 --- a/registry/token_maps.go +++ b/registry/token_maps.go @@ -17,7 +17,7 @@ package registry import ( "fmt" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func RegisterTokenMap(name string, constructor TokenMapConstructor) { diff --git a/registry/tokenizer.go b/registry/tokenizer.go index cb9af6438..eb954287c 100644 --- a/registry/tokenizer.go +++ b/registry/tokenizer.go @@ -17,7 +17,7 @@ package registry import ( "fmt" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func RegisterTokenizer(name string, constructor TokenizerConstructor) { diff --git a/search.go b/search.go index f67450779..a9d00b935 100644 --- a/search.go +++ b/search.go @@ -21,14 +21,14 @@ import ( "sort" "time" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/datetime/optional" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/registry" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/collector" - "github.com/blevesearch/bleve/search/query" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/datetime/optional" + "github.com/blevesearch/bleve/v2/document" + "github.com/blevesearch/bleve/v2/registry" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/collector" + "github.com/blevesearch/bleve/v2/search/query" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeSearchResult int diff --git a/search/collector/bench_test.go b/search/collector/bench_test.go index c0c8f421b..8e7d27de9 100644 --- a/search/collector/bench_test.go +++ b/search/collector/bench_test.go @@ -21,7 +21,7 @@ import ( "testing" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) type createCollector func() search.Collector diff --git a/search/collector/heap.go b/search/collector/heap.go index 05502d5df..9503f0060 100644 --- a/search/collector/heap.go +++ b/search/collector/heap.go @@ -17,7 +17,7 @@ package collector import ( "container/heap" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) type collectStoreHeap struct { diff --git a/search/collector/list.go b/search/collector/list.go index f01d205c9..20d4c9d01 100644 --- a/search/collector/list.go +++ b/search/collector/list.go @@ -17,7 +17,7 @@ package collector import ( "container/list" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) type collectStoreList struct { diff --git a/search/collector/search_test.go b/search/collector/search_test.go index 3c484d284..0d7cd09b0 100644 --- a/search/collector/search_test.go +++ b/search/collector/search_test.go @@ -17,7 +17,7 @@ package collector import ( "reflect" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" index "github.com/blevesearch/bleve_index_api" ) diff --git a/search/collector/slice.go b/search/collector/slice.go index 85fe73c40..b38d9abc4 100644 --- a/search/collector/slice.go +++ b/search/collector/slice.go @@ -14,7 +14,7 @@ package collector -import "github.com/blevesearch/bleve/search" +import "github.com/blevesearch/bleve/v2/search" type collectStoreSlice struct { slice search.DocumentMatchCollection diff --git a/search/collector/topn.go b/search/collector/topn.go index 16e6659fc..937904f4b 100644 --- a/search/collector/topn.go +++ b/search/collector/topn.go @@ -21,8 +21,8 @@ import ( "time" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeTopNCollector int diff --git a/search/collector/topn_test.go b/search/collector/topn_test.go index 907a92fa9..26fcd52cd 100644 --- a/search/collector/topn_test.go +++ b/search/collector/topn_test.go @@ -20,7 +20,7 @@ import ( "testing" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) func TestTop10Scores(t *testing.T) { diff --git a/search/explanation.go b/search/explanation.go index 3b81737b5..b1ac29aa8 100644 --- a/search/explanation.go +++ b/search/explanation.go @@ -19,7 +19,7 @@ import ( "fmt" "reflect" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeExplanation int diff --git a/search/facet/facet_builder_datetime.go b/search/facet/facet_builder_datetime.go index c45442e4d..a316ee4da 100644 --- a/search/facet/facet_builder_datetime.go +++ b/search/facet/facet_builder_datetime.go @@ -19,9 +19,9 @@ import ( "sort" "time" - "github.com/blevesearch/bleve/numeric" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/numeric" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeDateTimeFacetBuilder int diff --git a/search/facet/facet_builder_numeric.go b/search/facet/facet_builder_numeric.go index c1692b549..6d0c6c9d1 100644 --- a/search/facet/facet_builder_numeric.go +++ b/search/facet/facet_builder_numeric.go @@ -18,9 +18,9 @@ import ( "reflect" "sort" - "github.com/blevesearch/bleve/numeric" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/numeric" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeNumericFacetBuilder int diff --git a/search/facet/facet_builder_numeric_test.go b/search/facet/facet_builder_numeric_test.go index 41824092d..391395c49 100644 --- a/search/facet/facet_builder_numeric_test.go +++ b/search/facet/facet_builder_numeric_test.go @@ -18,7 +18,7 @@ import ( "strconv" "testing" - "github.com/blevesearch/bleve/numeric" + "github.com/blevesearch/bleve/v2/numeric" ) var pcodedvalues []numeric.PrefixCoded diff --git a/search/facet/facet_builder_terms.go b/search/facet/facet_builder_terms.go index 5b5901e01..1b378db7c 100644 --- a/search/facet/facet_builder_terms.go +++ b/search/facet/facet_builder_terms.go @@ -18,8 +18,8 @@ import ( "reflect" "sort" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeTermsFacetBuilder int diff --git a/search/facets_builder.go b/search/facets_builder.go index dc629f6ed..fb0dfcbe0 100644 --- a/search/facets_builder.go +++ b/search/facets_builder.go @@ -19,7 +19,7 @@ import ( "sort" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeFacetsBuilder int diff --git a/search/highlight/format/ansi/ansi.go b/search/highlight/format/ansi/ansi.go index 2500409c0..b9171ae2e 100644 --- a/search/highlight/format/ansi/ansi.go +++ b/search/highlight/format/ansi/ansi.go @@ -15,8 +15,8 @@ package ansi import ( - "github.com/blevesearch/bleve/registry" - "github.com/blevesearch/bleve/search/highlight" + "github.com/blevesearch/bleve/v2/registry" + "github.com/blevesearch/bleve/v2/search/highlight" ) const Name = "ansi" diff --git a/search/highlight/format/html/html.go b/search/highlight/format/html/html.go index 5bf16ca92..a0658d9c7 100644 --- a/search/highlight/format/html/html.go +++ b/search/highlight/format/html/html.go @@ -17,8 +17,8 @@ package html import ( "html" - "github.com/blevesearch/bleve/registry" - "github.com/blevesearch/bleve/search/highlight" + "github.com/blevesearch/bleve/v2/registry" + "github.com/blevesearch/bleve/v2/search/highlight" ) const Name = "html" diff --git a/search/highlight/format/html/html_test.go b/search/highlight/format/html/html_test.go index 0652d477f..774ab06bc 100644 --- a/search/highlight/format/html/html_test.go +++ b/search/highlight/format/html/html_test.go @@ -17,8 +17,8 @@ package html import ( "testing" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/highlight" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/highlight" ) func TestHTMLFragmentFormatter(t *testing.T) { diff --git a/search/highlight/fragmenter/simple/simple.go b/search/highlight/fragmenter/simple/simple.go index 9c63f7fb6..348dc1ce3 100644 --- a/search/highlight/fragmenter/simple/simple.go +++ b/search/highlight/fragmenter/simple/simple.go @@ -17,8 +17,8 @@ package simple import ( "unicode/utf8" - "github.com/blevesearch/bleve/registry" - "github.com/blevesearch/bleve/search/highlight" + "github.com/blevesearch/bleve/v2/registry" + "github.com/blevesearch/bleve/v2/search/highlight" ) const Name = "simple" diff --git a/search/highlight/fragmenter/simple/simple_test.go b/search/highlight/fragmenter/simple/simple_test.go index d02e83bd1..dcf4bf830 100644 --- a/search/highlight/fragmenter/simple/simple_test.go +++ b/search/highlight/fragmenter/simple/simple_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/search/highlight" + "github.com/blevesearch/bleve/v2/search/highlight" ) func TestSimpleFragmenter(t *testing.T) { diff --git a/search/highlight/highlighter.go b/search/highlight/highlighter.go index 33ff285e9..3dd9ce053 100644 --- a/search/highlight/highlighter.go +++ b/search/highlight/highlighter.go @@ -15,7 +15,7 @@ package highlight import ( - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" index "github.com/blevesearch/bleve_index_api" ) diff --git a/search/highlight/highlighter/ansi/ansi.go b/search/highlight/highlighter/ansi/ansi.go index 1d9f2efc2..39d950b4e 100644 --- a/search/highlight/highlighter/ansi/ansi.go +++ b/search/highlight/highlighter/ansi/ansi.go @@ -17,11 +17,11 @@ package ansi import ( "fmt" - "github.com/blevesearch/bleve/registry" - "github.com/blevesearch/bleve/search/highlight" - ansiFormatter "github.com/blevesearch/bleve/search/highlight/format/ansi" - simpleFragmenter "github.com/blevesearch/bleve/search/highlight/fragmenter/simple" - simpleHighlighter "github.com/blevesearch/bleve/search/highlight/highlighter/simple" + "github.com/blevesearch/bleve/v2/registry" + "github.com/blevesearch/bleve/v2/search/highlight" + ansiFormatter "github.com/blevesearch/bleve/v2/search/highlight/format/ansi" + simpleFragmenter "github.com/blevesearch/bleve/v2/search/highlight/fragmenter/simple" + simpleHighlighter "github.com/blevesearch/bleve/v2/search/highlight/highlighter/simple" ) const Name = "ansi" diff --git a/search/highlight/highlighter/html/html.go b/search/highlight/highlighter/html/html.go index 928589c47..ceb686dce 100644 --- a/search/highlight/highlighter/html/html.go +++ b/search/highlight/highlighter/html/html.go @@ -17,11 +17,11 @@ package html import ( "fmt" - "github.com/blevesearch/bleve/registry" - "github.com/blevesearch/bleve/search/highlight" - htmlFormatter "github.com/blevesearch/bleve/search/highlight/format/html" - simpleFragmenter "github.com/blevesearch/bleve/search/highlight/fragmenter/simple" - simpleHighlighter "github.com/blevesearch/bleve/search/highlight/highlighter/simple" + "github.com/blevesearch/bleve/v2/registry" + "github.com/blevesearch/bleve/v2/search/highlight" + htmlFormatter "github.com/blevesearch/bleve/v2/search/highlight/format/html" + simpleFragmenter "github.com/blevesearch/bleve/v2/search/highlight/fragmenter/simple" + simpleHighlighter "github.com/blevesearch/bleve/v2/search/highlight/highlighter/simple" ) const Name = "html" diff --git a/search/highlight/highlighter/simple/fragment_scorer_simple.go b/search/highlight/highlighter/simple/fragment_scorer_simple.go index 3ec4c3d28..786e33cb3 100644 --- a/search/highlight/highlighter/simple/fragment_scorer_simple.go +++ b/search/highlight/highlighter/simple/fragment_scorer_simple.go @@ -15,8 +15,8 @@ package simple import ( - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/highlight" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/highlight" ) // FragmentScorer will score fragments by how many diff --git a/search/highlight/highlighter/simple/fragment_scorer_simple_test.go b/search/highlight/highlighter/simple/fragment_scorer_simple_test.go index 92ced62db..116c7bda0 100644 --- a/search/highlight/highlighter/simple/fragment_scorer_simple_test.go +++ b/search/highlight/highlighter/simple/fragment_scorer_simple_test.go @@ -17,8 +17,8 @@ package simple import ( "testing" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/highlight" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/highlight" ) func TestSimpleFragmentScorer(t *testing.T) { diff --git a/search/highlight/highlighter/simple/highlighter_simple.go b/search/highlight/highlighter/simple/highlighter_simple.go index 0a0c89611..19949687d 100644 --- a/search/highlight/highlighter/simple/highlighter_simple.go +++ b/search/highlight/highlighter/simple/highlighter_simple.go @@ -19,9 +19,9 @@ import ( "fmt" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/registry" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/highlight" + "github.com/blevesearch/bleve/v2/registry" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/highlight" ) const Name = "simple" diff --git a/search/highlight/highlighter/simple/highlighter_simple_test.go b/search/highlight/highlighter/simple/highlighter_simple_test.go index 4b51ce924..e93166a4d 100644 --- a/search/highlight/highlighter/simple/highlighter_simple_test.go +++ b/search/highlight/highlighter/simple/highlighter_simple_test.go @@ -18,10 +18,10 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/highlight/format/ansi" - sfrag "github.com/blevesearch/bleve/search/highlight/fragmenter/simple" + "github.com/blevesearch/bleve/v2/document" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/highlight/format/ansi" + sfrag "github.com/blevesearch/bleve/v2/search/highlight/fragmenter/simple" ) const ( diff --git a/search/highlight/term_locations.go b/search/highlight/term_locations.go index 6d2cb133e..6bf385c05 100644 --- a/search/highlight/term_locations.go +++ b/search/highlight/term_locations.go @@ -18,7 +18,7 @@ import ( "reflect" "sort" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) type TermLocation struct { diff --git a/search/highlight/term_locations_test.go b/search/highlight/term_locations_test.go index c45376eae..6daa5ccff 100644 --- a/search/highlight/term_locations_test.go +++ b/search/highlight/term_locations_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) func TestTermLocationOverlaps(t *testing.T) { diff --git a/search/query/bool_field.go b/search/query/bool_field.go index 356d55fec..5b3bd2fb9 100644 --- a/search/query/bool_field.go +++ b/search/query/bool_field.go @@ -16,9 +16,9 @@ package query import ( index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type BoolFieldQuery struct { diff --git a/search/query/boolean.go b/search/query/boolean.go index 66bd89586..0f49c5fbe 100644 --- a/search/query/boolean.go +++ b/search/query/boolean.go @@ -19,9 +19,9 @@ import ( "fmt" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type BooleanQuery struct { diff --git a/search/query/conjunction.go b/search/query/conjunction.go index 16e4c9f72..15a3b8eb0 100644 --- a/search/query/conjunction.go +++ b/search/query/conjunction.go @@ -18,9 +18,9 @@ import ( "encoding/json" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type ConjunctionQuery struct { diff --git a/search/query/date_range.go b/search/query/date_range.go index 9eb4338d6..a92788301 100644 --- a/search/query/date_range.go +++ b/search/query/date_range.go @@ -20,13 +20,13 @@ import ( "math" "time" - "github.com/blevesearch/bleve/analysis/datetime/optional" + "github.com/blevesearch/bleve/v2/analysis/datetime/optional" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/numeric" - "github.com/blevesearch/bleve/registry" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/numeric" + "github.com/blevesearch/bleve/v2/registry" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) // QueryDateTimeParser controls the default query date time parser diff --git a/search/query/disjunction.go b/search/query/disjunction.go index a926413b9..cb8c52e32 100644 --- a/search/query/disjunction.go +++ b/search/query/disjunction.go @@ -19,9 +19,9 @@ import ( "fmt" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type DisjunctionQuery struct { diff --git a/search/query/docid.go b/search/query/docid.go index 711eee483..2dfbaadce 100644 --- a/search/query/docid.go +++ b/search/query/docid.go @@ -16,9 +16,9 @@ package query import ( index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type DocIDQuery struct { diff --git a/search/query/fuzzy.go b/search/query/fuzzy.go index b1fbd5ca6..4cd3deef8 100644 --- a/search/query/fuzzy.go +++ b/search/query/fuzzy.go @@ -16,9 +16,9 @@ package query import ( index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type FuzzyQuery struct { diff --git a/search/query/geo_boundingbox.go b/search/query/geo_boundingbox.go index b93e81236..04c0b8f91 100644 --- a/search/query/geo_boundingbox.go +++ b/search/query/geo_boundingbox.go @@ -18,11 +18,11 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/geo" + "github.com/blevesearch/bleve/v2/geo" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type GeoBoundingBoxQuery struct { diff --git a/search/query/geo_boundingpolygon.go b/search/query/geo_boundingpolygon.go index 37ceb3cfe..fadfde7b9 100644 --- a/search/query/geo_boundingpolygon.go +++ b/search/query/geo_boundingpolygon.go @@ -18,11 +18,11 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/geo" + "github.com/blevesearch/bleve/v2/geo" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type GeoBoundingPolygonQuery struct { diff --git a/search/query/geo_distance.go b/search/query/geo_distance.go index b3e5993d3..ab487942c 100644 --- a/search/query/geo_distance.go +++ b/search/query/geo_distance.go @@ -18,11 +18,11 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/geo" + "github.com/blevesearch/bleve/v2/geo" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type GeoDistanceQuery struct { diff --git a/search/query/match.go b/search/query/match.go index 079e085e6..dae596233 100644 --- a/search/query/match.go +++ b/search/query/match.go @@ -19,8 +19,8 @@ import ( "fmt" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" ) type MatchQuery struct { diff --git a/search/query/match_all.go b/search/query/match_all.go index ffbe96f60..9ada4f87a 100644 --- a/search/query/match_all.go +++ b/search/query/match_all.go @@ -18,9 +18,9 @@ import ( "encoding/json" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type MatchAllQuery struct { diff --git a/search/query/match_none.go b/search/query/match_none.go index d1a8c8bfa..e50478dc4 100644 --- a/search/query/match_none.go +++ b/search/query/match_none.go @@ -18,9 +18,9 @@ import ( "encoding/json" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type MatchNoneQuery struct { diff --git a/search/query/match_phrase.go b/search/query/match_phrase.go index e1301de65..cc9bc5800 100644 --- a/search/query/match_phrase.go +++ b/search/query/match_phrase.go @@ -17,10 +17,10 @@ package query import ( "fmt" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" ) type MatchPhraseQuery struct { diff --git a/search/query/match_phrase_test.go b/search/query/match_phrase_test.go index a4afbc2d6..a04f29ada 100644 --- a/search/query/match_phrase_test.go +++ b/search/query/match_phrase_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/analysis" + "github.com/blevesearch/bleve/v2/analysis" ) func TestTokenStreamToPhrase(t *testing.T) { diff --git a/search/query/multi_phrase.go b/search/query/multi_phrase.go index 020a62f3a..1005b1c27 100644 --- a/search/query/multi_phrase.go +++ b/search/query/multi_phrase.go @@ -19,9 +19,9 @@ import ( "fmt" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type MultiPhraseQuery struct { diff --git a/search/query/numeric_range.go b/search/query/numeric_range.go index ec6e1cca1..e6bcda90f 100644 --- a/search/query/numeric_range.go +++ b/search/query/numeric_range.go @@ -18,9 +18,9 @@ import ( "fmt" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type NumericRangeQuery struct { diff --git a/search/query/phrase.go b/search/query/phrase.go index 9d2da386f..0a71a0a9b 100644 --- a/search/query/phrase.go +++ b/search/query/phrase.go @@ -19,9 +19,9 @@ import ( "fmt" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type PhraseQuery struct { diff --git a/search/query/prefix.go b/search/query/prefix.go index bf2474ec6..cf5159991 100644 --- a/search/query/prefix.go +++ b/search/query/prefix.go @@ -16,9 +16,9 @@ package query import ( index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type PrefixQuery struct { diff --git a/search/query/query.go b/search/query/query.go index 1b8a3604e..f012d5ac7 100644 --- a/search/query/query.go +++ b/search/query/query.go @@ -21,8 +21,8 @@ import ( "log" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" ) var logger = log.New(ioutil.Discard, "bleve mapping ", log.LstdFlags) diff --git a/search/query/query_string.go b/search/query/query_string.go index 35fea9ebd..52eb4a71b 100644 --- a/search/query/query_string.go +++ b/search/query/query_string.go @@ -16,8 +16,8 @@ package query import ( index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" ) type QueryStringQuery struct { diff --git a/search/query/query_string_parser_test.go b/search/query/query_string_parser_test.go index f10170edd..bf144f90f 100644 --- a/search/query/query_string_parser_test.go +++ b/search/query/query_string_parser_test.go @@ -20,7 +20,7 @@ import ( "testing" "time" - "github.com/blevesearch/bleve/mapping" + "github.com/blevesearch/bleve/v2/mapping" ) func TestQuerySyntaxParserValid(t *testing.T) { diff --git a/search/query/query_test.go b/search/query/query_test.go index 717c4b811..f8a9227df 100644 --- a/search/query/query_test.go +++ b/search/query/query_test.go @@ -20,7 +20,7 @@ import ( "testing" "time" - "github.com/blevesearch/bleve/mapping" + "github.com/blevesearch/bleve/v2/mapping" ) var minNum = 5.1 diff --git a/search/query/regexp.go b/search/query/regexp.go index 3e7f24353..72150277c 100644 --- a/search/query/regexp.go +++ b/search/query/regexp.go @@ -18,9 +18,9 @@ import ( "strings" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type RegexpQuery struct { diff --git a/search/query/term.go b/search/query/term.go index 96821d7dd..12362eeb4 100644 --- a/search/query/term.go +++ b/search/query/term.go @@ -16,9 +16,9 @@ package query import ( index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type TermQuery struct { diff --git a/search/query/term_range.go b/search/query/term_range.go index b194fe6bf..7db4db89b 100644 --- a/search/query/term_range.go +++ b/search/query/term_range.go @@ -18,9 +18,9 @@ import ( "fmt" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) type TermRangeQuery struct { diff --git a/search/query/wildcard.go b/search/query/wildcard.go index 88445e5be..94d4f0224 100644 --- a/search/query/wildcard.go +++ b/search/query/wildcard.go @@ -18,9 +18,9 @@ import ( "strings" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" ) var wildcardRegexpReplacer = strings.NewReplacer( diff --git a/search/scorer/scorer_conjunction.go b/search/scorer/scorer_conjunction.go index 48cdf3ae9..f3c81a78c 100644 --- a/search/scorer/scorer_conjunction.go +++ b/search/scorer/scorer_conjunction.go @@ -17,8 +17,8 @@ package scorer import ( "reflect" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeConjunctionQueryScorer int diff --git a/search/scorer/scorer_constant.go b/search/scorer/scorer_constant.go index 02c651ced..30ae3ffe5 100644 --- a/search/scorer/scorer_constant.go +++ b/search/scorer/scorer_constant.go @@ -19,8 +19,8 @@ import ( "reflect" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeConstantScorer int diff --git a/search/scorer/scorer_constant_test.go b/search/scorer/scorer_constant_test.go index d6cbeb898..7257b89ce 100644 --- a/search/scorer/scorer_constant_test.go +++ b/search/scorer/scorer_constant_test.go @@ -19,7 +19,7 @@ import ( "testing" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) func TestConstantScorer(t *testing.T) { diff --git a/search/scorer/scorer_disjunction.go b/search/scorer/scorer_disjunction.go index 7a955e168..054e76fd4 100644 --- a/search/scorer/scorer_disjunction.go +++ b/search/scorer/scorer_disjunction.go @@ -18,8 +18,8 @@ import ( "fmt" "reflect" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeDisjunctionQueryScorer int diff --git a/search/scorer/scorer_term.go b/search/scorer/scorer_term.go index b5cd9e2ff..c09e11092 100644 --- a/search/scorer/scorer_term.go +++ b/search/scorer/scorer_term.go @@ -20,8 +20,8 @@ import ( "reflect" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeTermQueryScorer int diff --git a/search/scorer/scorer_term_test.go b/search/scorer/scorer_term_test.go index f138373ed..69cc1a9a7 100644 --- a/search/scorer/scorer_term_test.go +++ b/search/scorer/scorer_term_test.go @@ -20,7 +20,7 @@ import ( "testing" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) func TestTermScorer(t *testing.T) { diff --git a/search/search.go b/search/search.go index 5247fab90..61a9e9a16 100644 --- a/search/search.go +++ b/search/search.go @@ -20,7 +20,7 @@ import ( "sort" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeDocumentMatch int diff --git a/search/searcher/base_test.go b/search/searcher/base_test.go index 1f1e3ab85..3d0323f5c 100644 --- a/search/searcher/base_test.go +++ b/search/searcher/base_test.go @@ -18,13 +18,13 @@ import ( "math" "regexp" - "github.com/blevesearch/bleve/analysis" - regexpTokenizer "github.com/blevesearch/bleve/analysis/tokenizer/regexp" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/analysis" + regexpTokenizer "github.com/blevesearch/bleve/v2/analysis/tokenizer/regexp" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/scorch" - "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" - "github.com/blevesearch/bleve/index/upsidedown" + "github.com/blevesearch/bleve/v2/index/scorch" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap" + "github.com/blevesearch/bleve/v2/index/upsidedown" ) var twoDocIndex index.Index diff --git a/search/searcher/ordered_searchers_list.go b/search/searcher/ordered_searchers_list.go index 536c593cd..f3e646e9d 100644 --- a/search/searcher/ordered_searchers_list.go +++ b/search/searcher/ordered_searchers_list.go @@ -15,7 +15,7 @@ package searcher import ( - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) type OrderedSearcherList []search.Searcher diff --git a/search/searcher/search_boolean.go b/search/searcher/search_boolean.go index 69b796518..2dae3d9d2 100644 --- a/search/searcher/search_boolean.go +++ b/search/searcher/search_boolean.go @@ -19,9 +19,9 @@ import ( "reflect" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/scorer" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/scorer" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeBooleanSearcher int diff --git a/search/searcher/search_boolean_test.go b/search/searcher/search_boolean_test.go index 226de7621..07c1f7a74 100644 --- a/search/searcher/search_boolean_test.go +++ b/search/searcher/search_boolean_test.go @@ -18,7 +18,7 @@ import ( "testing" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) func TestBooleanSearch(t *testing.T) { diff --git a/search/searcher/search_conjunction.go b/search/searcher/search_conjunction.go index 783248ef6..2d99165fb 100644 --- a/search/searcher/search_conjunction.go +++ b/search/searcher/search_conjunction.go @@ -20,9 +20,9 @@ import ( "sort" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/scorer" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/scorer" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeConjunctionSearcher int diff --git a/search/searcher/search_conjunction_test.go b/search/searcher/search_conjunction_test.go index 8b41efba4..8f6b06d3a 100644 --- a/search/searcher/search_conjunction_test.go +++ b/search/searcher/search_conjunction_test.go @@ -21,8 +21,8 @@ import ( "testing" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/scorch" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/index/scorch" + "github.com/blevesearch/bleve/v2/search" ) func TestConjunctionSearch(t *testing.T) { diff --git a/search/searcher/search_disjunction.go b/search/searcher/search_disjunction.go index 5dcbe3af7..8d3423bea 100644 --- a/search/searcher/search_disjunction.go +++ b/search/searcher/search_disjunction.go @@ -17,7 +17,7 @@ package searcher import ( "fmt" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) // DisjunctionMaxClauseCount is a compile time setting that applications can diff --git a/search/searcher/search_disjunction_heap.go b/search/searcher/search_disjunction_heap.go index 57179df1d..d153c4755 100644 --- a/search/searcher/search_disjunction_heap.go +++ b/search/searcher/search_disjunction_heap.go @@ -21,9 +21,9 @@ import ( "reflect" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/scorer" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/scorer" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeDisjunctionHeapSearcher int diff --git a/search/searcher/search_disjunction_slice.go b/search/searcher/search_disjunction_slice.go index de5cd5f4f..d3af72802 100644 --- a/search/searcher/search_disjunction_slice.go +++ b/search/searcher/search_disjunction_slice.go @@ -20,9 +20,9 @@ import ( "sort" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/scorer" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/scorer" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeDisjunctionSliceSearcher int diff --git a/search/searcher/search_disjunction_test.go b/search/searcher/search_disjunction_test.go index ba5a72e0a..7edc48080 100644 --- a/search/searcher/search_disjunction_test.go +++ b/search/searcher/search_disjunction_test.go @@ -18,7 +18,7 @@ import ( "testing" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) func TestDisjunctionSearch(t *testing.T) { diff --git a/search/searcher/search_docid.go b/search/searcher/search_docid.go index 3de787544..19e8a32ef 100644 --- a/search/searcher/search_docid.go +++ b/search/searcher/search_docid.go @@ -18,9 +18,9 @@ import ( "reflect" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/scorer" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/scorer" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeDocIDSearcher int diff --git a/search/searcher/search_docid_test.go b/search/searcher/search_docid_test.go index f0d42afdd..61698c7e6 100644 --- a/search/searcher/search_docid_test.go +++ b/search/searcher/search_docid_test.go @@ -17,11 +17,11 @@ package searcher import ( "testing" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" - "github.com/blevesearch/bleve/index/upsidedown" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap" + "github.com/blevesearch/bleve/v2/index/upsidedown" + "github.com/blevesearch/bleve/v2/search" ) func testDocIDSearcher(t *testing.T, indexed, searched, wanted []string) { diff --git a/search/searcher/search_filter.go b/search/searcher/search_filter.go index d5a439ba5..3adba5dc9 100644 --- a/search/searcher/search_filter.go +++ b/search/searcher/search_filter.go @@ -18,8 +18,8 @@ import ( "reflect" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeFilteringSearcher int diff --git a/search/searcher/search_fuzzy.go b/search/searcher/search_fuzzy.go index d50f45f82..fb4aafdab 100644 --- a/search/searcher/search_fuzzy.go +++ b/search/searcher/search_fuzzy.go @@ -18,7 +18,7 @@ import ( "fmt" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) var MaxFuzziness = 2 diff --git a/search/searcher/search_fuzzy_test.go b/search/searcher/search_fuzzy_test.go index 5e53121a7..5c3ae2ef5 100644 --- a/search/searcher/search_fuzzy_test.go +++ b/search/searcher/search_fuzzy_test.go @@ -18,7 +18,7 @@ import ( "testing" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) func TestFuzzySearch(t *testing.T) { diff --git a/search/searcher/search_geoboundingbox.go b/search/searcher/search_geoboundingbox.go index a4ba08709..c442fd2a0 100644 --- a/search/searcher/search_geoboundingbox.go +++ b/search/searcher/search_geoboundingbox.go @@ -15,11 +15,11 @@ package searcher import ( - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/geo" + "github.com/blevesearch/bleve/v2/document" + "github.com/blevesearch/bleve/v2/geo" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/numeric" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/numeric" + "github.com/blevesearch/bleve/v2/search" ) type filterFunc func(key []byte) bool diff --git a/search/searcher/search_geoboundingbox_test.go b/search/searcher/search_geoboundingbox_test.go index 1fcdf7bce..449e08515 100644 --- a/search/searcher/search_geoboundingbox_test.go +++ b/search/searcher/search_geoboundingbox_test.go @@ -18,13 +18,13 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/geo" + "github.com/blevesearch/bleve/v2/document" + "github.com/blevesearch/bleve/v2/geo" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" - "github.com/blevesearch/bleve/index/upsidedown" - "github.com/blevesearch/bleve/numeric" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap" + "github.com/blevesearch/bleve/v2/index/upsidedown" + "github.com/blevesearch/bleve/v2/numeric" + "github.com/blevesearch/bleve/v2/search" ) func TestGeoBoundingBox(t *testing.T) { diff --git a/search/searcher/search_geopointdistance.go b/search/searcher/search_geopointdistance.go index 826c41de0..c3b12915d 100644 --- a/search/searcher/search_geopointdistance.go +++ b/search/searcher/search_geopointdistance.go @@ -15,10 +15,10 @@ package searcher import ( - "github.com/blevesearch/bleve/geo" + "github.com/blevesearch/bleve/v2/geo" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/numeric" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/numeric" + "github.com/blevesearch/bleve/v2/search" ) func NewGeoPointDistanceSearcher(indexReader index.IndexReader, centerLon, diff --git a/search/searcher/search_geopointdistance_test.go b/search/searcher/search_geopointdistance_test.go index ef6795d4b..0bf63664b 100644 --- a/search/searcher/search_geopointdistance_test.go +++ b/search/searcher/search_geopointdistance_test.go @@ -18,9 +18,9 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/geo" + "github.com/blevesearch/bleve/v2/geo" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) func TestGeoPointDistanceSearcher(t *testing.T) { diff --git a/search/searcher/search_geopolygon.go b/search/searcher/search_geopolygon.go index 75c63a6f1..ee3e53964 100644 --- a/search/searcher/search_geopolygon.go +++ b/search/searcher/search_geopolygon.go @@ -16,10 +16,10 @@ package searcher import ( "fmt" - "github.com/blevesearch/bleve/geo" + "github.com/blevesearch/bleve/v2/geo" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/numeric" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/numeric" + "github.com/blevesearch/bleve/v2/search" "math" ) diff --git a/search/searcher/search_geopolygon_test.go b/search/searcher/search_geopolygon_test.go index cedd9a7ee..c80333250 100644 --- a/search/searcher/search_geopolygon_test.go +++ b/search/searcher/search_geopolygon_test.go @@ -18,12 +18,12 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/geo" + "github.com/blevesearch/bleve/v2/document" + "github.com/blevesearch/bleve/v2/geo" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" - "github.com/blevesearch/bleve/index/upsidedown" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap" + "github.com/blevesearch/bleve/v2/index/upsidedown" + "github.com/blevesearch/bleve/v2/search" ) func TestSimpleGeoPolygons(t *testing.T) { diff --git a/search/searcher/search_match_all.go b/search/searcher/search_match_all.go index 43619ce59..68f76e97d 100644 --- a/search/searcher/search_match_all.go +++ b/search/searcher/search_match_all.go @@ -18,9 +18,9 @@ import ( "reflect" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/scorer" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/scorer" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeMatchAllSearcher int diff --git a/search/searcher/search_match_all_test.go b/search/searcher/search_match_all_test.go index e91dd0761..fd6565b7f 100644 --- a/search/searcher/search_match_all_test.go +++ b/search/searcher/search_match_all_test.go @@ -18,7 +18,7 @@ import ( "testing" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) func TestMatchAllSearch(t *testing.T) { diff --git a/search/searcher/search_match_none.go b/search/searcher/search_match_none.go index 9c19b5a8a..6765371a5 100644 --- a/search/searcher/search_match_none.go +++ b/search/searcher/search_match_none.go @@ -18,8 +18,8 @@ import ( "reflect" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeMatchNoneSearcher int diff --git a/search/searcher/search_match_none_test.go b/search/searcher/search_match_none_test.go index 7563074ca..c3a370d83 100644 --- a/search/searcher/search_match_none_test.go +++ b/search/searcher/search_match_none_test.go @@ -17,7 +17,7 @@ package searcher import ( "testing" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) func TestMatchNoneSearch(t *testing.T) { diff --git a/search/searcher/search_multi_term.go b/search/searcher/search_multi_term.go index 5f919f53c..98bc3daa9 100644 --- a/search/searcher/search_multi_term.go +++ b/search/searcher/search_multi_term.go @@ -17,7 +17,7 @@ package searcher import ( "fmt" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) func NewMultiTermSearcher(indexReader index.IndexReader, terms []string, diff --git a/search/searcher/search_numeric_range.go b/search/searcher/search_numeric_range.go index f9787c95c..b02acf26a 100644 --- a/search/searcher/search_numeric_range.go +++ b/search/searcher/search_numeric_range.go @@ -20,8 +20,8 @@ import ( "sort" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/numeric" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/numeric" + "github.com/blevesearch/bleve/v2/search" ) func NewNumericRangeSearcher(indexReader index.IndexReader, diff --git a/search/searcher/search_numeric_range_test.go b/search/searcher/search_numeric_range_test.go index b19e1b24a..83611cd9e 100644 --- a/search/searcher/search_numeric_range_test.go +++ b/search/searcher/search_numeric_range_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - "github.com/blevesearch/bleve/numeric" + "github.com/blevesearch/bleve/v2/numeric" ) func TestSplitRange(t *testing.T) { diff --git a/search/searcher/search_phrase.go b/search/searcher/search_phrase.go index a41af3d8d..91777074f 100644 --- a/search/searcher/search_phrase.go +++ b/search/searcher/search_phrase.go @@ -20,8 +20,8 @@ import ( "reflect" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizePhraseSearcher int diff --git a/search/searcher/search_phrase_test.go b/search/searcher/search_phrase_test.go index b1982ba9e..546673c8c 100644 --- a/search/searcher/search_phrase_test.go +++ b/search/searcher/search_phrase_test.go @@ -19,7 +19,7 @@ import ( "testing" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) func TestPhraseSearch(t *testing.T) { diff --git a/search/searcher/search_regexp.go b/search/searcher/search_regexp.go index ea2a87379..1a85914a1 100644 --- a/search/searcher/search_regexp.go +++ b/search/searcher/search_regexp.go @@ -18,7 +18,7 @@ import ( "regexp" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) // The Regexp interface defines the subset of the regexp.Regexp API diff --git a/search/searcher/search_regexp_test.go b/search/searcher/search_regexp_test.go index c78d7a986..347403463 100644 --- a/search/searcher/search_regexp_test.go +++ b/search/searcher/search_regexp_test.go @@ -23,7 +23,7 @@ import ( "testing" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) func TestRegexpSearchUpsideDown(t *testing.T) { diff --git a/search/searcher/search_term.go b/search/searcher/search_term.go index 3eb456c36..f2f1b0e79 100644 --- a/search/searcher/search_term.go +++ b/search/searcher/search_term.go @@ -18,9 +18,9 @@ import ( "reflect" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/scorer" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/scorer" + "github.com/blevesearch/bleve/v2/size" ) var reflectStaticSizeTermSearcher int diff --git a/search/searcher/search_term_prefix.go b/search/searcher/search_term_prefix.go index 3609938d8..35f96efce 100644 --- a/search/searcher/search_term_prefix.go +++ b/search/searcher/search_term_prefix.go @@ -16,7 +16,7 @@ package searcher import ( index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) func NewTermPrefixSearcher(indexReader index.IndexReader, prefix string, diff --git a/search/searcher/search_term_range.go b/search/searcher/search_term_range.go index 4f10e6c7b..c8e3b3d25 100644 --- a/search/searcher/search_term_range.go +++ b/search/searcher/search_term_range.go @@ -16,7 +16,7 @@ package searcher import ( index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) func NewTermRangeSearcher(indexReader index.IndexReader, diff --git a/search/searcher/search_term_range_test.go b/search/searcher/search_term_range_test.go index 22cf065d2..126e03ee4 100644 --- a/search/searcher/search_term_range_test.go +++ b/search/searcher/search_term_range_test.go @@ -15,14 +15,14 @@ package searcher import ( - "github.com/blevesearch/bleve/index/scorch" + "github.com/blevesearch/bleve/v2/index/scorch" "io/ioutil" "os" "reflect" "sort" "testing" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" ) func TestTermRangeSearch(t *testing.T) { diff --git a/search/searcher/search_term_test.go b/search/searcher/search_term_test.go index 6c57dbcad..a87d2b24d 100644 --- a/search/searcher/search_term_test.go +++ b/search/searcher/search_term_test.go @@ -18,11 +18,11 @@ import ( "math" "testing" - "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/v2/document" index "github.com/blevesearch/bleve_index_api" - "github.com/blevesearch/bleve/index/upsidedown/store/gtreap" - "github.com/blevesearch/bleve/index/upsidedown" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap" + "github.com/blevesearch/bleve/v2/index/upsidedown" + "github.com/blevesearch/bleve/v2/search" ) func TestTermSearcher(t *testing.T) { diff --git a/search/sort.go b/search/sort.go index dca422ebd..496db47fc 100644 --- a/search/sort.go +++ b/search/sort.go @@ -22,8 +22,8 @@ import ( "sort" "strings" - "github.com/blevesearch/bleve/geo" - "github.com/blevesearch/bleve/numeric" + "github.com/blevesearch/bleve/v2/geo" + "github.com/blevesearch/bleve/v2/numeric" ) var HighTerm = strings.Repeat(string([]byte{0xff}), 10) diff --git a/search_test.go b/search_test.go index 9a3fbd9ec..bfdbd8786 100644 --- a/search_test.go +++ b/search_test.go @@ -24,24 +24,24 @@ import ( "testing" "time" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/analysis/analyzer/custom" - "github.com/blevesearch/bleve/analysis/analyzer/keyword" - "github.com/blevesearch/bleve/analysis/analyzer/standard" - regexp_char_filter "github.com/blevesearch/bleve/analysis/char/regexp" - "github.com/blevesearch/bleve/analysis/token/length" - "github.com/blevesearch/bleve/analysis/token/lowercase" - "github.com/blevesearch/bleve/analysis/token/shingle" - "github.com/blevesearch/bleve/analysis/tokenizer/single" - "github.com/blevesearch/bleve/analysis/tokenizer/whitespace" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index/scorch" - "github.com/blevesearch/bleve/index/upsidedown" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/highlight/highlighter/ansi" - "github.com/blevesearch/bleve/search/highlight/highlighter/html" - "github.com/blevesearch/bleve/search/query" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/analysis/analyzer/custom" + "github.com/blevesearch/bleve/v2/analysis/analyzer/keyword" + "github.com/blevesearch/bleve/v2/analysis/analyzer/standard" + regexp_char_filter "github.com/blevesearch/bleve/v2/analysis/char/regexp" + "github.com/blevesearch/bleve/v2/analysis/token/length" + "github.com/blevesearch/bleve/v2/analysis/token/lowercase" + "github.com/blevesearch/bleve/v2/analysis/token/shingle" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/single" + "github.com/blevesearch/bleve/v2/analysis/tokenizer/whitespace" + "github.com/blevesearch/bleve/v2/document" + "github.com/blevesearch/bleve/v2/index/scorch" + "github.com/blevesearch/bleve/v2/index/upsidedown" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/highlight/highlighter/ansi" + "github.com/blevesearch/bleve/v2/search/highlight/highlighter/html" + "github.com/blevesearch/bleve/v2/search/query" ) func TestSearchResultString(t *testing.T) { diff --git a/test/integration.go b/test/integration.go index 74031a2ce..c45286b05 100644 --- a/test/integration.go +++ b/test/integration.go @@ -15,7 +15,7 @@ package test import ( - "github.com/blevesearch/bleve" + "github.com/blevesearch/bleve/v2" ) type SearchTest struct { diff --git a/test/integration_test.go b/test/integration_test.go index cdd50f03a..5cc4d185f 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -26,11 +26,11 @@ import ( "regexp" "testing" - "github.com/blevesearch/bleve" - "github.com/blevesearch/bleve/mapping" + "github.com/blevesearch/bleve/v2" + "github.com/blevesearch/bleve/v2/mapping" // allow choosing alternate kvstores - _ "github.com/blevesearch/bleve/config" + _ "github.com/blevesearch/bleve/v2/config" ) var dataset = flag.String("dataset", "", "only test datasets matching this regex") diff --git a/test/versus_score_test.go b/test/versus_score_test.go index 28be3dd77..7a7b87520 100644 --- a/test/versus_score_test.go +++ b/test/versus_score_test.go @@ -22,12 +22,12 @@ import ( "strconv" "testing" - "github.com/blevesearch/bleve" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index/scorch" - "github.com/blevesearch/bleve/index/upsidedown" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2" + "github.com/blevesearch/bleve/v2/document" + "github.com/blevesearch/bleve/v2/index/scorch" + "github.com/blevesearch/bleve/v2/index/upsidedown" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" ) func TestDisjunctionSearchScoreIndexWithCompositeFields(t *testing.T) { diff --git a/test/versus_test.go b/test/versus_test.go index e2f38c4e2..3812d4c45 100644 --- a/test/versus_test.go +++ b/test/versus_test.go @@ -27,12 +27,12 @@ import ( "testing" "text/template" - "github.com/blevesearch/bleve" - "github.com/blevesearch/bleve/index/scorch" - "github.com/blevesearch/bleve/index/upsidedown/store/boltdb" - "github.com/blevesearch/bleve/index/upsidedown" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2" + "github.com/blevesearch/bleve/v2/index/scorch" + "github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb" + "github.com/blevesearch/bleve/v2/index/upsidedown" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" ) // Tests scorch indexer versus upsidedown/bolt indexer against various