diff options
author | Lauris BH <lauris@nix.lv> | 2021-01-18 03:21:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-17 20:21:14 -0500 |
commit | f5abe2f563e7dbcfd278bb05b8236af9d10a4e8e (patch) | |
tree | f448512c2db0712a9a1eee63e21909c1f6c5762f /vendor/github.com/blevesearch/bleve | |
parent | 3aa53dc6bc7e20fa7c894275e27910ea61a59bb3 (diff) | |
download | gitea-f5abe2f563e7dbcfd278bb05b8236af9d10a4e8e.tar.gz gitea-f5abe2f563e7dbcfd278bb05b8236af9d10a4e8e.zip |
Upgrade blevesearch dependency to v2.0.1 (#14346)
* Upgrade blevesearch dependency to v2.0.1
* Update rupture to v1.0.0
* Fix test
Diffstat (limited to 'vendor/github.com/blevesearch/bleve')
-rw-r--r-- | vendor/github.com/blevesearch/bleve/analysis/freq.go | 152 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/document/indexing_options.go | 66 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/index/analysis.go | 110 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/index/index.go | 376 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/index/scorch/segment/empty.go | 137 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/index/scorch/segment/int.go | 176 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/index/scorch/segment/plugin.go | 58 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/index/scorch/segment/segment.go | 153 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/index/scorch/segment_plugin.go | 93 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/index/store/batch.go | 62 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/index/store/kvstore.go | 174 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/index/store/merge.go | 64 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/.gitignore (renamed from vendor/github.com/blevesearch/bleve/.gitignore) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/.travis.yml (renamed from vendor/github.com/blevesearch/bleve/.travis.yml) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/CONTRIBUTING.md (renamed from vendor/github.com/blevesearch/bleve/CONTRIBUTING.md) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/LICENSE (renamed from vendor/github.com/blevesearch/bleve/LICENSE) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/README.md (renamed from vendor/github.com/blevesearch/bleve/README.md) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/analyzer/custom/custom.go (renamed from vendor/github.com/blevesearch/bleve/analysis/analyzer/custom/custom.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/analyzer/keyword/keyword.go (renamed from vendor/github.com/blevesearch/bleve/analysis/analyzer/keyword/keyword.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/analyzer/standard/standard.go (renamed from vendor/github.com/blevesearch/bleve/analysis/analyzer/standard/standard.go) | 10 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/datetime/flexible/flexible.go (renamed from vendor/github.com/blevesearch/bleve/analysis/datetime/flexible/flexible.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/datetime/optional/optional.go (renamed from vendor/github.com/blevesearch/bleve/analysis/datetime/optional/optional.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/freq.go | 70 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/lang/en/analyzer_en.go (renamed from vendor/github.com/blevesearch/bleve/analysis/lang/en/analyzer_en.go) | 10 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/lang/en/possessive_filter_en.go (renamed from vendor/github.com/blevesearch/bleve/analysis/lang/en/possessive_filter_en.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/lang/en/stemmer_en_snowball.go (renamed from vendor/github.com/blevesearch/bleve/analysis/lang/en/stemmer_en_snowball.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/lang/en/stop_filter_en.go (renamed from vendor/github.com/blevesearch/bleve/analysis/lang/en/stop_filter_en.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/lang/en/stop_words_en.go (renamed from vendor/github.com/blevesearch/bleve/analysis/lang/en/stop_words_en.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/test_words.txt (renamed from vendor/github.com/blevesearch/bleve/analysis/test_words.txt) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/token/lowercase/lowercase.go (renamed from vendor/github.com/blevesearch/bleve/analysis/token/lowercase/lowercase.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/token/porter/porter.go (renamed from vendor/github.com/blevesearch/bleve/analysis/token/porter/porter.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/token/stop/stop.go (renamed from vendor/github.com/blevesearch/bleve/analysis/token/stop/stop.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/token/unicodenorm/unicodenorm.go (renamed from vendor/github.com/blevesearch/bleve/analysis/token/unicodenorm/unicodenorm.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/tokenizer/single/single.go (renamed from vendor/github.com/blevesearch/bleve/analysis/tokenizer/single/single.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode/unicode.go (renamed from vendor/github.com/blevesearch/bleve/analysis/tokenizer/unicode/unicode.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/tokenmap.go (renamed from vendor/github.com/blevesearch/bleve/analysis/tokenmap.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/type.go (renamed from vendor/github.com/blevesearch/bleve/analysis/type.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/analysis/util.go (renamed from vendor/github.com/blevesearch/bleve/analysis/util.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/builder.go (renamed from vendor/github.com/blevesearch/bleve/builder.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/config.go (renamed from vendor/github.com/blevesearch/bleve/config.go) | 15 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/config_app.go (renamed from vendor/github.com/blevesearch/bleve/config_app.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/config_disk.go (renamed from vendor/github.com/blevesearch/bleve/config_disk.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/doc.go (renamed from vendor/github.com/blevesearch/bleve/doc.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/document/document.go (renamed from vendor/github.com/blevesearch/bleve/document/document.go) | 39 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/document/field.go (renamed from vendor/github.com/blevesearch/bleve/document/field.go) | 10 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/document/field_boolean.go (renamed from vendor/github.com/blevesearch/bleve/document/field_boolean.go) | 34 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/document/field_composite.go (renamed from vendor/github.com/blevesearch/bleve/document/field_composite.go) | 33 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/document/field_datetime.go (renamed from vendor/github.com/blevesearch/bleve/document/field_datetime.go) | 36 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/document/field_geopoint.go (renamed from vendor/github.com/blevesearch/bleve/document/field_geopoint.go) | 36 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/document/field_numeric.go (renamed from vendor/github.com/blevesearch/bleve/document/field_numeric.go) | 36 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/document/field_text.go (renamed from vendor/github.com/blevesearch/bleve/document/field_text.go) | 40 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/error.go (renamed from vendor/github.com/blevesearch/bleve/error.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/geo/README.md (renamed from vendor/github.com/blevesearch/bleve/geo/README.md) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/geo/geo.go (renamed from vendor/github.com/blevesearch/bleve/geo/geo.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/geo/geo_dist.go (renamed from vendor/github.com/blevesearch/bleve/geo/geo_dist.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/geo/geohash.go (renamed from vendor/github.com/blevesearch/bleve/geo/geohash.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/geo/parse.go (renamed from vendor/github.com/blevesearch/bleve/geo/parse.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/geo/sloppy.go (renamed from vendor/github.com/blevesearch/bleve/geo/sloppy.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/go.mod (renamed from vendor/github.com/blevesearch/bleve/go.mod) | 16 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/go.sum | 128 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index.go (renamed from vendor/github.com/blevesearch/bleve/index.go) | 21 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/README.md (renamed from vendor/github.com/blevesearch/bleve/index/scorch/README.md) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/builder.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/builder.go) | 17 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/empty.go (renamed from vendor/github.com/blevesearch/bleve/index/store/multiget.go) | 30 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/event.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/event.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/int.go | 92 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/introducer.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/introducer.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/merge.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/merge.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/mergeplan/merge_plan.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/mergeplan/merge_plan.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/mergeplan/sort.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/mergeplan/sort.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/optimize.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/optimize.go) | 24 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/persister.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/persister.go) | 20 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/regexp.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/segment/regexp.go) | 24 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/rollback.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/rollback.go) | 7 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/scorch.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/scorch.go) | 62 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/segment_plugin.go | 133 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/snapshot_index.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/snapshot_index.go) | 113 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/snapshot_index_dict.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/snapshot_index_dict.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/snapshot_index_doc.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/snapshot_index_doc.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/snapshot_index_tfr.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/snapshot_index_tfr.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/snapshot_segment.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/snapshot_segment.go) | 14 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/stats.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/stats.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/scorch/unadorned.go (renamed from vendor/github.com/blevesearch/bleve/index/scorch/segment/unadorned.go) | 47 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/analysis.go (renamed from vendor/github.com/blevesearch/bleve/index/upsidedown/analysis.go) | 61 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/benchmark_all.sh (renamed from vendor/github.com/blevesearch/bleve/index/upsidedown/benchmark_all.sh) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/dump.go (renamed from vendor/github.com/blevesearch/bleve/index/upsidedown/dump.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/field_cache.go (renamed from vendor/github.com/blevesearch/bleve/index/field_cache.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/field_dict.go (renamed from vendor/github.com/blevesearch/bleve/index/upsidedown/field_dict.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/index_reader.go (renamed from vendor/github.com/blevesearch/bleve/index/upsidedown/index_reader.go) | 23 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/reader.go (renamed from vendor/github.com/blevesearch/bleve/index/upsidedown/reader.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/row.go (renamed from vendor/github.com/blevesearch/bleve/index/upsidedown/row.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/row_merge.go (renamed from vendor/github.com/blevesearch/bleve/index/upsidedown/row_merge.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/stats.go (renamed from vendor/github.com/blevesearch/bleve/index/upsidedown/stats.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb/iterator.go (renamed from vendor/github.com/blevesearch/bleve/index/store/boltdb/iterator.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb/reader.go (renamed from vendor/github.com/blevesearch/bleve/index/store/boltdb/reader.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb/stats.go (renamed from vendor/github.com/blevesearch/bleve/index/store/boltdb/stats.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb/store.go (renamed from vendor/github.com/blevesearch/bleve/index/store/boltdb/store.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb/writer.go (renamed from vendor/github.com/blevesearch/bleve/index/store/boltdb/writer.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap/iterator.go (renamed from vendor/github.com/blevesearch/bleve/index/store/gtreap/iterator.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap/reader.go (renamed from vendor/github.com/blevesearch/bleve/index/store/gtreap/reader.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap/store.go (renamed from vendor/github.com/blevesearch/bleve/index/store/gtreap/store.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap/writer.go (renamed from vendor/github.com/blevesearch/bleve/index/store/gtreap/writer.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/upsidedown.go (renamed from vendor/github.com/blevesearch/bleve/index/upsidedown/upsidedown.go) | 76 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/upsidedown.pb.go (renamed from vendor/github.com/blevesearch/bleve/index/upsidedown/upsidedown.pb.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index/upsidedown/upsidedown.proto (renamed from vendor/github.com/blevesearch/bleve/index/upsidedown/upsidedown.proto) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index_alias.go (renamed from vendor/github.com/blevesearch/bleve/index_alias.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index_alias_impl.go (renamed from vendor/github.com/blevesearch/bleve/index_alias_impl.go) | 16 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index_impl.go (renamed from vendor/github.com/blevesearch/bleve/index_impl.go) | 56 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index_meta.go (renamed from vendor/github.com/blevesearch/bleve/index_meta.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/index_stats.go (renamed from vendor/github.com/blevesearch/bleve/index_stats.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/mapping.go (renamed from vendor/github.com/blevesearch/bleve/mapping.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/mapping/analysis.go (renamed from vendor/github.com/blevesearch/bleve/mapping/analysis.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/mapping/document.go (renamed from vendor/github.com/blevesearch/bleve/mapping/document.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/mapping/field.go (renamed from vendor/github.com/blevesearch/bleve/mapping/field.go) | 34 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/mapping/index.go (renamed from vendor/github.com/blevesearch/bleve/mapping/index.go) | 21 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/mapping/mapping.go (renamed from vendor/github.com/blevesearch/bleve/mapping/mapping.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/mapping/reflect.go (renamed from vendor/github.com/blevesearch/bleve/mapping/reflect.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/numeric/bin.go (renamed from vendor/github.com/blevesearch/bleve/numeric/bin.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/numeric/float.go (renamed from vendor/github.com/blevesearch/bleve/numeric/float.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/numeric/prefix_coded.go (renamed from vendor/github.com/blevesearch/bleve/numeric/prefix_coded.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/query.go (renamed from vendor/github.com/blevesearch/bleve/query.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/registry/analyzer.go (renamed from vendor/github.com/blevesearch/bleve/registry/analyzer.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/registry/cache.go (renamed from vendor/github.com/blevesearch/bleve/registry/cache.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/registry/char_filter.go (renamed from vendor/github.com/blevesearch/bleve/registry/char_filter.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/registry/datetime_parser.go (renamed from vendor/github.com/blevesearch/bleve/registry/datetime_parser.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/registry/fragment_formatter.go (renamed from vendor/github.com/blevesearch/bleve/registry/fragment_formatter.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/registry/fragmenter.go (renamed from vendor/github.com/blevesearch/bleve/registry/fragmenter.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/registry/highlighter.go (renamed from vendor/github.com/blevesearch/bleve/registry/highlighter.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/registry/index_type.go (renamed from vendor/github.com/blevesearch/bleve/registry/index_type.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/registry/registry.go (renamed from vendor/github.com/blevesearch/bleve/registry/registry.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/registry/store.go (renamed from vendor/github.com/blevesearch/bleve/registry/store.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/registry/token_filter.go (renamed from vendor/github.com/blevesearch/bleve/registry/token_filter.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/registry/token_maps.go (renamed from vendor/github.com/blevesearch/bleve/registry/token_maps.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/registry/tokenizer.go (renamed from vendor/github.com/blevesearch/bleve/registry/tokenizer.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search.go (renamed from vendor/github.com/blevesearch/bleve/search.go) | 16 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/collector.go (renamed from vendor/github.com/blevesearch/bleve/search/collector.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/collector/heap.go (renamed from vendor/github.com/blevesearch/bleve/search/collector/heap.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/collector/list.go (renamed from vendor/github.com/blevesearch/bleve/search/collector/list.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/collector/slice.go (renamed from vendor/github.com/blevesearch/bleve/search/collector/slice.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/collector/topn.go (renamed from vendor/github.com/blevesearch/bleve/search/collector/topn.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/explanation.go (renamed from vendor/github.com/blevesearch/bleve/search/explanation.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/facet/benchmark_data.txt (renamed from vendor/github.com/blevesearch/bleve/search/facet/benchmark_data.txt) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/facet/facet_builder_datetime.go (renamed from vendor/github.com/blevesearch/bleve/search/facet/facet_builder_datetime.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/facet/facet_builder_numeric.go (renamed from vendor/github.com/blevesearch/bleve/search/facet/facet_builder_numeric.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/facet/facet_builder_terms.go (renamed from vendor/github.com/blevesearch/bleve/search/facet/facet_builder_terms.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/facets_builder.go (renamed from vendor/github.com/blevesearch/bleve/search/facets_builder.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/highlight/format/html/html.go (renamed from vendor/github.com/blevesearch/bleve/search/highlight/format/html/html.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/highlight/fragmenter/simple/simple.go (renamed from vendor/github.com/blevesearch/bleve/search/highlight/fragmenter/simple/simple.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/highlight/highlighter.go (renamed from vendor/github.com/blevesearch/bleve/search/highlight/highlighter.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/highlight/highlighter/html/html.go (renamed from vendor/github.com/blevesearch/bleve/search/highlight/highlighter/html/html.go) | 10 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/highlight/highlighter/simple/fragment_scorer_simple.go (renamed from vendor/github.com/blevesearch/bleve/search/highlight/highlighter/simple/fragment_scorer_simple.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/highlight/highlighter/simple/highlighter_simple.go (renamed from vendor/github.com/blevesearch/bleve/search/highlight/highlighter/simple/highlighter_simple.go) | 18 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/highlight/term_locations.go (renamed from vendor/github.com/blevesearch/bleve/search/highlight/term_locations.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/levenshtein.go (renamed from vendor/github.com/blevesearch/bleve/search/levenshtein.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/pool.go (renamed from vendor/github.com/blevesearch/bleve/search/pool.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/bool_field.go (renamed from vendor/github.com/blevesearch/bleve/search/query/bool_field.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/boolean.go (renamed from vendor/github.com/blevesearch/bleve/search/query/boolean.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/boost.go (renamed from vendor/github.com/blevesearch/bleve/search/query/boost.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/conjunction.go (renamed from vendor/github.com/blevesearch/bleve/search/query/conjunction.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/date_range.go (renamed from vendor/github.com/blevesearch/bleve/search/query/date_range.go) | 14 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/disjunction.go (renamed from vendor/github.com/blevesearch/bleve/search/query/disjunction.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/docid.go (renamed from vendor/github.com/blevesearch/bleve/search/query/docid.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/fuzzy.go (renamed from vendor/github.com/blevesearch/bleve/search/query/fuzzy.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/geo_boundingbox.go (renamed from vendor/github.com/blevesearch/bleve/search/query/geo_boundingbox.go) | 10 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/geo_boundingpolygon.go (renamed from vendor/github.com/blevesearch/bleve/search/query/geo_boundingpolygon.go) | 10 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/geo_distance.go (renamed from vendor/github.com/blevesearch/bleve/search/query/geo_distance.go) | 10 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/match.go (renamed from vendor/github.com/blevesearch/bleve/search/query/match.go) | 10 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/match_all.go (renamed from vendor/github.com/blevesearch/bleve/search/query/match_all.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/match_none.go (renamed from vendor/github.com/blevesearch/bleve/search/query/match_none.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/match_phrase.go (renamed from vendor/github.com/blevesearch/bleve/search/query/match_phrase.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/multi_phrase.go (renamed from vendor/github.com/blevesearch/bleve/search/query/multi_phrase.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/numeric_range.go (renamed from vendor/github.com/blevesearch/bleve/search/query/numeric_range.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/phrase.go (renamed from vendor/github.com/blevesearch/bleve/search/query/phrase.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/prefix.go (renamed from vendor/github.com/blevesearch/bleve/search/query/prefix.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/query.go (renamed from vendor/github.com/blevesearch/bleve/search/query/query.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/query_string.go (renamed from vendor/github.com/blevesearch/bleve/search/query/query_string.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/query_string.y (renamed from vendor/github.com/blevesearch/bleve/search/query/query_string.y) | 36 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/query_string.y.go (renamed from vendor/github.com/blevesearch/bleve/search/query/query_string.y.go) | 144 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/query_string_lex.go (renamed from vendor/github.com/blevesearch/bleve/search/query/query_string_lex.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/query_string_parser.go (renamed from vendor/github.com/blevesearch/bleve/search/query/query_string_parser.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/regexp.go (renamed from vendor/github.com/blevesearch/bleve/search/query/regexp.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/term.go (renamed from vendor/github.com/blevesearch/bleve/search/query/term.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/term_range.go (renamed from vendor/github.com/blevesearch/bleve/search/query/term_range.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/query/wildcard.go (renamed from vendor/github.com/blevesearch/bleve/search/query/wildcard.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/scorer/scorer_conjunction.go (renamed from vendor/github.com/blevesearch/bleve/search/scorer/scorer_conjunction.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/scorer/scorer_constant.go (renamed from vendor/github.com/blevesearch/bleve/search/scorer/scorer_constant.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/scorer/scorer_disjunction.go (renamed from vendor/github.com/blevesearch/bleve/search/scorer/scorer_disjunction.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/scorer/scorer_term.go (renamed from vendor/github.com/blevesearch/bleve/search/scorer/scorer_term.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/scorer/sqrt_cache.go (renamed from vendor/github.com/blevesearch/bleve/search/scorer/sqrt_cache.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/search.go (renamed from vendor/github.com/blevesearch/bleve/search/search.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/ordered_searchers_list.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/ordered_searchers_list.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_boolean.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_boolean.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_conjunction.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_conjunction.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_disjunction.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_disjunction.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_disjunction_heap.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_disjunction_heap.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_disjunction_slice.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_disjunction_slice.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_docid.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_docid.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_filter.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_filter.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_fuzzy.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_fuzzy.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_geoboundingbox.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_geoboundingbox.go) | 41 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_geopointdistance.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_geopointdistance.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_geopolygon.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_geopolygon.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_match_all.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_match_all.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_match_none.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_match_none.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_multi_term.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_multi_term.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_numeric_range.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_numeric_range.go) | 24 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_phrase.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_phrase.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_regexp.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_regexp.go) | 19 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_term.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_term.go) | 8 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_term_prefix.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_term_prefix.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/searcher/search_term_range.go (renamed from vendor/github.com/blevesearch/bleve/search/searcher/search_term_range.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/sort.go (renamed from vendor/github.com/blevesearch/bleve/search/sort.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/search/util.go (renamed from vendor/github.com/blevesearch/bleve/search/util.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/blevesearch/bleve/v2/size/sizes.go (renamed from vendor/github.com/blevesearch/bleve/size/sizes.go) | 0 |
214 files changed, 1417 insertions, 2492 deletions
diff --git a/vendor/github.com/blevesearch/bleve/analysis/freq.go b/vendor/github.com/blevesearch/bleve/analysis/freq.go deleted file mode 100644 index 198c149b2b..0000000000 --- a/vendor/github.com/blevesearch/bleve/analysis/freq.go +++ /dev/null @@ -1,152 +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 analysis - -import ( - "reflect" - - "github.com/blevesearch/bleve/size" -) - -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)) - - if includeTermVectors { - tls := make([]TokenLocation, len(tokens)) - tlNext := 0 - - for _, token := range tokens { - tls[tlNext] = TokenLocation{ - ArrayPositions: arrayPositions, - Start: token.Start, - End: token.End, - Position: token.Position, - } - - curr, ok := rv[string(token.Term)] - if ok { - curr.Locations = append(curr.Locations, &tls[tlNext]) - curr.frequency++ - } else { - rv[string(token.Term)] = &TokenFreq{ - Term: token.Term, - Locations: []*TokenLocation{&tls[tlNext]}, - frequency: 1, - } - } - - tlNext++ - } - } else { - for _, token := range tokens { - curr, exists := rv[string(token.Term)] - if exists { - curr.frequency++ - } else { - rv[string(token.Term)] = &TokenFreq{ - Term: token.Term, - frequency: 1, - } - } - } - } - - return rv -} diff --git a/vendor/github.com/blevesearch/bleve/document/indexing_options.go b/vendor/github.com/blevesearch/bleve/document/indexing_options.go deleted file mode 100644 index 44498a8e90..0000000000 --- a/vendor/github.com/blevesearch/bleve/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/vendor/github.com/blevesearch/bleve/index/analysis.go b/vendor/github.com/blevesearch/bleve/index/analysis.go deleted file mode 100644 index 82883af019..0000000000 --- a/vendor/github.com/blevesearch/bleve/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/vendor/github.com/blevesearch/bleve/index/index.go b/vendor/github.com/blevesearch/bleve/index/index.go deleted file mode 100644 index 551f8de842..0000000000 --- a/vendor/github.com/blevesearch/bleve/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/vendor/github.com/blevesearch/bleve/index/scorch/segment/empty.go b/vendor/github.com/blevesearch/bleve/index/scorch/segment/empty.go deleted file mode 100644 index 340db73a67..0000000000 --- a/vendor/github.com/blevesearch/bleve/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/vendor/github.com/blevesearch/bleve/index/scorch/segment/int.go b/vendor/github.com/blevesearch/bleve/index/scorch/segment/int.go deleted file mode 100644 index 55299d8f7a..0000000000 --- a/vendor/github.com/blevesearch/bleve/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)<<s, nil - } - - x |= uint64(b&0x7f) << s - s += 7 - } -} - -// SkipUvarint skips ahead one encoded uint64. -func (r *MemUvarintReader) SkipUvarint() { - for { - b := r.S[r.C] - r.C++ - - if b < 0x80 { - return - } - } -} - -// SkipBytes skips a count number of bytes. -func (r *MemUvarintReader) SkipBytes(count int) { - r.C = r.C + count -} - -func (r *MemUvarintReader) Reset(s []byte) { - r.C = 0 - r.S = s -} diff --git a/vendor/github.com/blevesearch/bleve/index/scorch/segment/plugin.go b/vendor/github.com/blevesearch/bleve/index/scorch/segment/plugin.go deleted file mode 100644 index d8aaa0b6d1..0000000000 --- a/vendor/github.com/blevesearch/bleve/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/vendor/github.com/blevesearch/bleve/index/scorch/segment/segment.go b/vendor/github.com/blevesearch/bleve/index/scorch/segment/segment.go deleted file mode 100644 index ddd0d09102..0000000000 --- a/vendor/github.com/blevesearch/bleve/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/vendor/github.com/blevesearch/bleve/index/scorch/segment_plugin.go b/vendor/github.com/blevesearch/bleve/index/scorch/segment_plugin.go deleted file mode 100644 index 2f7db48b38..0000000000 --- a/vendor/github.com/blevesearch/bleve/index/scorch/segment_plugin.go +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 2019 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" - - "github.com/blevesearch/bleve/index/scorch/segment" - - 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" -) - -var supportedSegmentPlugins map[string]map[uint32]segment.Plugin -var defaultSegmentPlugin segment.Plugin - -func init() { - ResetPlugins() - RegisterPlugin(zapv15.Plugin(), false) - RegisterPlugin(zapv14.Plugin(), false) - RegisterPlugin(zapv13.Plugin(), false) - RegisterPlugin(zapv12.Plugin(), false) - RegisterPlugin(zapv11.Plugin(), true) -} - -func ResetPlugins() { - supportedSegmentPlugins = map[string]map[uint32]segment.Plugin{} -} - -func RegisterPlugin(plugin segment.Plugin, makeDefault bool) { - if _, ok := supportedSegmentPlugins[plugin.Type()]; !ok { - supportedSegmentPlugins[plugin.Type()] = map[uint32]segment.Plugin{} - } - supportedSegmentPlugins[plugin.Type()][plugin.Version()] = plugin - if makeDefault { - defaultSegmentPlugin = plugin - } -} - -func SupportedSegmentTypes() (rv []string) { - for k := range supportedSegmentPlugins { - rv = append(rv, k) - } - return -} - -func SupportedSegmentTypeVersions(typ string) (rv []uint32) { - for k := range supportedSegmentPlugins[typ] { - rv = append(rv, k) - } - return rv -} - -func chooseSegmentPlugin(forcedSegmentType string, - forcedSegmentVersion uint32) (segment.Plugin, error) { - if versions, ok := supportedSegmentPlugins[forcedSegmentType]; ok { - if segPlugin, ok := versions[uint32(forcedSegmentVersion)]; ok { - return segPlugin, nil - } - return nil, fmt.Errorf( - "unsupported version %d for segment type: %s, supported: %v", - forcedSegmentVersion, forcedSegmentType, - SupportedSegmentTypeVersions(forcedSegmentType)) - } - return nil, fmt.Errorf("unsupported segment type: %s, supported: %v", - forcedSegmentType, SupportedSegmentTypes()) -} - -func (s *Scorch) loadSegmentPlugin(forcedSegmentType string, - forcedSegmentVersion uint32) error { - segPlugin, err := chooseSegmentPlugin(forcedSegmentType, - forcedSegmentVersion) - if err != nil { - return err - } - s.segPlugin = segPlugin - return nil -} diff --git a/vendor/github.com/blevesearch/bleve/index/store/batch.go b/vendor/github.com/blevesearch/bleve/index/store/batch.go deleted file mode 100644 index 7110526610..0000000000 --- a/vendor/github.com/blevesearch/bleve/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/vendor/github.com/blevesearch/bleve/index/store/kvstore.go b/vendor/github.com/blevesearch/bleve/index/store/kvstore.go deleted file mode 100644 index 34698c7bda..0000000000 --- a/vendor/github.com/blevesearch/bleve/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/vendor/github.com/blevesearch/bleve/index/store/merge.go b/vendor/github.com/blevesearch/bleve/index/store/merge.go deleted file mode 100644 index ca2561b0a9..0000000000 --- a/vendor/github.com/blevesearch/bleve/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/vendor/github.com/blevesearch/bleve/.gitignore b/vendor/github.com/blevesearch/bleve/v2/.gitignore index ab7a1e21a6..ab7a1e21a6 100644 --- a/vendor/github.com/blevesearch/bleve/.gitignore +++ b/vendor/github.com/blevesearch/bleve/v2/.gitignore diff --git a/vendor/github.com/blevesearch/bleve/.travis.yml b/vendor/github.com/blevesearch/bleve/v2/.travis.yml index 7b7297afe3..7b7297afe3 100644 --- a/vendor/github.com/blevesearch/bleve/.travis.yml +++ b/vendor/github.com/blevesearch/bleve/v2/.travis.yml diff --git a/vendor/github.com/blevesearch/bleve/CONTRIBUTING.md b/vendor/github.com/blevesearch/bleve/v2/CONTRIBUTING.md index 5ebf3d65bc..5ebf3d65bc 100644 --- a/vendor/github.com/blevesearch/bleve/CONTRIBUTING.md +++ b/vendor/github.com/blevesearch/bleve/v2/CONTRIBUTING.md diff --git a/vendor/github.com/blevesearch/bleve/LICENSE b/vendor/github.com/blevesearch/bleve/v2/LICENSE index 7a4a3ea242..7a4a3ea242 100644 --- a/vendor/github.com/blevesearch/bleve/LICENSE +++ b/vendor/github.com/blevesearch/bleve/v2/LICENSE diff --git a/vendor/github.com/blevesearch/bleve/README.md b/vendor/github.com/blevesearch/bleve/v2/README.md index eff0be97e4..30b1ecb5a5 100644 --- a/vendor/github.com/blevesearch/bleve/README.md +++ b/vendor/github.com/blevesearch/bleve/v2/README.md @@ -11,8 +11,6 @@ modern text indexing in go - [blevesearch.com](http://www.blevesearch.com/) -Try out bleve live by [searching the bleve website](http://www.blevesearch.com/search/?q=bleve). - ## Features * Index any go data structure (including JSON) diff --git a/vendor/github.com/blevesearch/bleve/analysis/analyzer/custom/custom.go b/vendor/github.com/blevesearch/bleve/v2/analysis/analyzer/custom/custom.go index bcd4d42db3..70e7a2699c 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/analyzer/custom/custom.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/analysis/analyzer/keyword/keyword.go b/vendor/github.com/blevesearch/bleve/v2/analysis/analyzer/keyword/keyword.go index 2a6c1aff71..473c294710 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/analyzer/keyword/keyword.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/analysis/analyzer/standard/standard.go b/vendor/github.com/blevesearch/bleve/v2/analysis/analyzer/standard/standard.go index 74ea564eaa..80a481be07 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/analyzer/standard/standard.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/analysis/datetime/flexible/flexible.go b/vendor/github.com/blevesearch/bleve/v2/analysis/datetime/flexible/flexible.go index cd549f55f2..0eba074cd7 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/datetime/flexible/flexible.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/analysis/datetime/optional/optional.go b/vendor/github.com/blevesearch/bleve/v2/analysis/datetime/optional/optional.go index 4b98de666d..196aa25cba 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/datetime/optional/optional.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/v2/analysis/freq.go b/vendor/github.com/blevesearch/bleve/v2/analysis/freq.go new file mode 100644 index 0000000000..a0fd1a416b --- /dev/null +++ b/vendor/github.com/blevesearch/bleve/v2/analysis/freq.go @@ -0,0 +1,70 @@ +// 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 analysis + +import ( + index "github.com/blevesearch/bleve_index_api" +) + +func TokenFrequency(tokens TokenStream, arrayPositions []uint64, options index.FieldIndexingOptions) index.TokenFrequencies { + rv := make(map[string]*index.TokenFreq, len(tokens)) + + if options.IncludeTermVectors() { + tls := make([]index.TokenLocation, len(tokens)) + tlNext := 0 + + for _, token := range tokens { + tls[tlNext] = index.TokenLocation{ + ArrayPositions: arrayPositions, + Start: token.Start, + End: token.End, + Position: token.Position, + } + + curr, ok := rv[string(token.Term)] + if ok { + curr.Locations = append(curr.Locations, &tls[tlNext]) + } else { + curr = &index.TokenFreq{ + Term: token.Term, + Locations: []*index.TokenLocation{&tls[tlNext]}, + } + rv[string(token.Term)] = curr + } + + if !options.SkipFreqNorm() { + curr.SetFrequency(curr.Frequency() + 1) + } + + tlNext++ + } + } else { + for _, token := range tokens { + curr, exists := rv[string(token.Term)] + if !exists { + curr = &index.TokenFreq{ + Term: token.Term, + } + rv[string(token.Term)] = curr + } + + if !options.SkipFreqNorm() { + curr.SetFrequency(curr.Frequency() + 1) + } + } + } + + return rv +} diff --git a/vendor/github.com/blevesearch/bleve/analysis/lang/en/analyzer_en.go b/vendor/github.com/blevesearch/bleve/v2/analysis/lang/en/analyzer_en.go index 8402785f28..7a4ae58661 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/lang/en/analyzer_en.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/analysis/lang/en/possessive_filter_en.go b/vendor/github.com/blevesearch/bleve/v2/analysis/lang/en/possessive_filter_en.go index 2c06efd678..79c2489e28 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/lang/en/possessive_filter_en.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/analysis/lang/en/stemmer_en_snowball.go b/vendor/github.com/blevesearch/bleve/v2/analysis/lang/en/stemmer_en_snowball.go index 225bb0664d..ab30b8b195 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/lang/en/stemmer_en_snowball.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/analysis/lang/en/stop_filter_en.go b/vendor/github.com/blevesearch/bleve/v2/analysis/lang/en/stop_filter_en.go index bfdb2c9728..a3f91d2267 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/lang/en/stop_filter_en.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/analysis/lang/en/stop_words_en.go b/vendor/github.com/blevesearch/bleve/v2/analysis/lang/en/stop_words_en.go index 6423cf2cb4..9b6ca86a72 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/lang/en/stop_words_en.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/analysis/test_words.txt b/vendor/github.com/blevesearch/bleve/v2/analysis/test_words.txt index b86e254bb9..b86e254bb9 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/test_words.txt +++ b/vendor/github.com/blevesearch/bleve/v2/analysis/test_words.txt diff --git a/vendor/github.com/blevesearch/bleve/analysis/token/lowercase/lowercase.go b/vendor/github.com/blevesearch/bleve/v2/analysis/token/lowercase/lowercase.go index adb740c3e8..a1b6dbd057 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/token/lowercase/lowercase.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/analysis/token/porter/porter.go b/vendor/github.com/blevesearch/bleve/v2/analysis/token/porter/porter.go index 4cd08d99c3..95af0fa72b 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/token/porter/porter.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/analysis/token/stop/stop.go b/vendor/github.com/blevesearch/bleve/v2/analysis/token/stop/stop.go index cca2d8e015..bf4b98db18 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/token/stop/stop.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/analysis/token/unicodenorm/unicodenorm.go b/vendor/github.com/blevesearch/bleve/v2/analysis/token/unicodenorm/unicodenorm.go index c03bac98a0..01b191bc22 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/token/unicodenorm/unicodenorm.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/analysis/tokenizer/single/single.go b/vendor/github.com/blevesearch/bleve/v2/analysis/tokenizer/single/single.go index 18b2b1af9b..a3eac78995 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/tokenizer/single/single.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/analysis/tokenizer/unicode/unicode.go b/vendor/github.com/blevesearch/bleve/v2/analysis/tokenizer/unicode/unicode.go index 39e38b4531..ca3cfe76c4 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/tokenizer/unicode/unicode.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/analysis/tokenmap.go b/vendor/github.com/blevesearch/bleve/v2/analysis/tokenmap.go index 7c0d0a890b..7c0d0a890b 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/tokenmap.go +++ b/vendor/github.com/blevesearch/bleve/v2/analysis/tokenmap.go diff --git a/vendor/github.com/blevesearch/bleve/analysis/type.go b/vendor/github.com/blevesearch/bleve/v2/analysis/type.go index 589cc1ca6a..589cc1ca6a 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/type.go +++ b/vendor/github.com/blevesearch/bleve/v2/analysis/type.go diff --git a/vendor/github.com/blevesearch/bleve/analysis/util.go b/vendor/github.com/blevesearch/bleve/v2/analysis/util.go index 8e4348a1ac..8e4348a1ac 100644 --- a/vendor/github.com/blevesearch/bleve/analysis/util.go +++ b/vendor/github.com/blevesearch/bleve/v2/analysis/util.go diff --git a/vendor/github.com/blevesearch/bleve/builder.go b/vendor/github.com/blevesearch/bleve/v2/builder.go index de00c97b6e..dbb7e3ed44 100644 --- a/vendor/github.com/blevesearch/bleve/builder.go +++ b/vendor/github.com/blevesearch/bleve/v2/builder.go @@ -18,10 +18,10 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" - "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" ) type builderImpl struct { diff --git a/vendor/github.com/blevesearch/bleve/config.go b/vendor/github.com/blevesearch/bleve/v2/config.go index 99f2e081fc..0622b359db 100644 --- a/vendor/github.com/blevesearch/bleve/config.go +++ b/vendor/github.com/blevesearch/bleve/v2/config.go @@ -20,14 +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" - - // force import of scorch so its accessible by default - _ "github.com/blevesearch/bleve/index/scorch" + "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" ) 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/vendor/github.com/blevesearch/bleve/config_app.go b/vendor/github.com/blevesearch/bleve/v2/config_app.go index 112d0b600d..112d0b600d 100644 --- a/vendor/github.com/blevesearch/bleve/config_app.go +++ b/vendor/github.com/blevesearch/bleve/v2/config_app.go diff --git a/vendor/github.com/blevesearch/bleve/config_disk.go b/vendor/github.com/blevesearch/bleve/v2/config_disk.go index d03bceb404..ccfd6da8c0 100644 --- a/vendor/github.com/blevesearch/bleve/config_disk.go +++ b/vendor/github.com/blevesearch/bleve/v2/config_disk.go @@ -16,7 +16,7 @@ package bleve -import "github.com/blevesearch/bleve/index/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/vendor/github.com/blevesearch/bleve/doc.go b/vendor/github.com/blevesearch/bleve/v2/doc.go index d54af7c9af..d54af7c9af 100644 --- a/vendor/github.com/blevesearch/bleve/doc.go +++ b/vendor/github.com/blevesearch/bleve/v2/doc.go diff --git a/vendor/github.com/blevesearch/bleve/document/document.go b/vendor/github.com/blevesearch/bleve/v2/document/document.go index 6ac17b9ab7..1a6050f0ae 100644 --- a/vendor/github.com/blevesearch/bleve/document/document.go +++ b/vendor/github.com/blevesearch/bleve/v2/document/document.go @@ -18,7 +18,8 @@ import ( "fmt" "reflect" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/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()), index.IndexField|index.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/vendor/github.com/blevesearch/bleve/document/field.go b/vendor/github.com/blevesearch/bleve/v2/document/field.go index 2fe9166985..eb104e2dfe 100644 --- a/vendor/github.com/blevesearch/bleve/document/field.go +++ b/vendor/github.com/blevesearch/bleve/v2/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 { @@ -28,8 +28,8 @@ type Field interface { // arrays, ArrayPositions returns 2 indices used to resolve "doc2" value in // "doc1", then "field" in "doc2". ArrayPositions() []uint64 - Options() IndexingOptions - Analyze() (int, analysis.TokenFrequencies) + Options() index.FieldIndexingOptions + Analyze() Value() []byte // NumPlainTextBytes should return the number of plain text bytes @@ -38,4 +38,8 @@ type Field interface { NumPlainTextBytes() uint64 Size() int + + EncodedFieldType() byte + AnalyzedLength() int + AnalyzedTokenFrequencies() index.TokenFrequencies } diff --git a/vendor/github.com/blevesearch/bleve/document/field_boolean.go b/vendor/github.com/blevesearch/bleve/v2/document/field_boolean.go index 6864b16f44..fdf3cc0e53 100644 --- a/vendor/github.com/blevesearch/bleve/document/field_boolean.go +++ b/vendor/github.com/blevesearch/bleve/v2/document/field_boolean.go @@ -18,8 +18,9 @@ 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" ) var reflectStaticSizeBooleanField int @@ -29,14 +30,16 @@ 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 + frequencies index.TokenFrequencies } func (b *BooleanField) Size() int { @@ -54,11 +57,11 @@ func (b *BooleanField) ArrayPositions() []uint64 { return b.arrayPositions } -func (b *BooleanField) Options() IndexingOptions { +func (b *BooleanField) Options() index.FieldIndexingOptions { 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) } func (b *BooleanField) Value() []byte { @@ -92,6 +94,18 @@ func (b *BooleanField) NumPlainTextBytes() uint64 { return b.numPlainTextBytes } +func (b *BooleanField) EncodedFieldType() byte { + return 'b' +} + +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, @@ -106,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/vendor/github.com/blevesearch/bleve/document/field_composite.go b/vendor/github.com/blevesearch/bleve/v2/document/field_composite.go index a8285880fd..8c47643f5b 100644 --- a/vendor/github.com/blevesearch/bleve/document/field_composite.go +++ b/vendor/github.com/blevesearch/bleve/v2/document/field_composite.go @@ -17,8 +17,8 @@ package document import ( "reflect" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/size" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeCompositeField int @@ -28,30 +28,30 @@ 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 analysis.TokenFrequencies + compositeFrequencies index.TokenFrequencies } func NewCompositeField(name string, defaultInclude bool, include []string, exclude []string) *CompositeField { 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, 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 { @@ -87,12 +87,11 @@ func (c *CompositeField) ArrayPositions() []uint64 { return []uint64{} } -func (c *CompositeField) Options() IndexingOptions { +func (c *CompositeField) Options() index.FieldIndexingOptions { 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,21 @@ 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) AnalyzedLength() int { + return c.totalLength +} + +func (c *CompositeField) AnalyzedTokenFrequencies() index.TokenFrequencies { + return c.compositeFrequencies +} diff --git a/vendor/github.com/blevesearch/bleve/document/field_datetime.go b/vendor/github.com/blevesearch/bleve/v2/document/field_datetime.go index 583b44cdeb..6506405501 100644 --- a/vendor/github.com/blevesearch/bleve/document/field_datetime.go +++ b/vendor/github.com/blevesearch/bleve/v2/document/field_datetime.go @@ -20,9 +20,10 @@ 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" ) var reflectStaticSizeDateTimeField int @@ -32,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) @@ -41,9 +42,11 @@ 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 + frequencies index.TokenFrequencies } func (n *DateTimeField) Size() int { @@ -60,11 +63,23 @@ func (n *DateTimeField) ArrayPositions() []uint64 { return n.arrayPositions } -func (n *DateTimeField) Options() IndexingOptions { +func (n *DateTimeField) Options() index.FieldIndexingOptions { return n.options } -func (n *DateTimeField) Analyze() (int, analysis.TokenFrequencies) { +func (n *DateTimeField) EncodedFieldType() byte { + return 'd' +} + +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 +110,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) } func (n *DateTimeField) Value() []byte { @@ -134,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/vendor/github.com/blevesearch/bleve/document/field_geopoint.go b/vendor/github.com/blevesearch/bleve/v2/document/field_geopoint.go index 91fe23f96e..89de4e3bfa 100644 --- a/vendor/github.com/blevesearch/bleve/document/field_geopoint.go +++ b/vendor/github.com/blevesearch/bleve/v2/document/field_geopoint.go @@ -18,10 +18,11 @@ 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" ) var reflectStaticSizeGeoPointField int @@ -36,9 +37,11 @@ var GeoPrecisionStep uint = 9 type GeoPointField struct { name string arrayPositions []uint64 - options IndexingOptions + options index.FieldIndexingOptions value numeric.PrefixCoded numPlainTextBytes uint64 + length int + frequencies index.TokenFrequencies } func (n *GeoPointField) Size() int { @@ -55,11 +58,23 @@ func (n *GeoPointField) ArrayPositions() []uint64 { return n.arrayPositions } -func (n *GeoPointField) Options() IndexingOptions { +func (n *GeoPointField) Options() index.FieldIndexingOptions { return n.options } -func (n *GeoPointField) Analyze() (int, analysis.TokenFrequencies) { +func (n *GeoPointField) EncodedFieldType() byte { + return 'g' +} + +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 +105,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) } func (n *GeoPointField) Value() []byte { @@ -137,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/vendor/github.com/blevesearch/bleve/document/field_numeric.go b/vendor/github.com/blevesearch/bleve/v2/document/field_numeric.go index 46c685e84e..a54b082b48 100644 --- a/vendor/github.com/blevesearch/bleve/document/field_numeric.go +++ b/vendor/github.com/blevesearch/bleve/v2/document/field_numeric.go @@ -18,9 +18,10 @@ 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" ) var reflectStaticSizeNumericField int @@ -30,16 +31,18 @@ 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 + frequencies index.TokenFrequencies } func (n *NumericField) Size() int { @@ -56,11 +59,23 @@ func (n *NumericField) ArrayPositions() []uint64 { return n.arrayPositions } -func (n *NumericField) Options() IndexingOptions { +func (n *NumericField) Options() index.FieldIndexingOptions { return n.options } -func (n *NumericField) Analyze() (int, analysis.TokenFrequencies) { +func (n *NumericField) EncodedFieldType() byte { + return 'n' +} + +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 +106,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) } func (n *NumericField) Value() []byte { @@ -130,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/vendor/github.com/blevesearch/bleve/document/field_text.go b/vendor/github.com/blevesearch/bleve/v2/document/field_text.go index 6bd74c7127..924de532c0 100644 --- a/vendor/github.com/blevesearch/bleve/document/field_text.go +++ b/vendor/github.com/blevesearch/bleve/v2/document/field_text.go @@ -18,8 +18,9 @@ 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" ) var reflectStaticSizeTextField int @@ -29,15 +30,17 @@ 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 + length int + frequencies index.TokenFrequencies } func (t *TextField) Size() int { @@ -55,11 +58,23 @@ func (t *TextField) ArrayPositions() []uint64 { return t.arrayPositions } -func (t *TextField) Options() IndexingOptions { +func (t *TextField) Options() index.FieldIndexingOptions { return t.options } -func (t *TextField) Analyze() (int, analysis.TokenFrequencies) { +func (t *TextField) EncodedFieldType() byte { + return 't' +} + +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 +96,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) } func (t *TextField) Analyzer() *analysis.Analyzer { @@ -94,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) } @@ -106,7 +124,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, @@ -127,7 +145,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/vendor/github.com/blevesearch/bleve/error.go b/vendor/github.com/blevesearch/bleve/v2/error.go index 7402dfcf40..7dd21194c8 100644 --- a/vendor/github.com/blevesearch/bleve/error.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/geo/README.md b/vendor/github.com/blevesearch/bleve/v2/geo/README.md index 43bcd98fed..43bcd98fed 100644 --- a/vendor/github.com/blevesearch/bleve/geo/README.md +++ b/vendor/github.com/blevesearch/bleve/v2/geo/README.md diff --git a/vendor/github.com/blevesearch/bleve/geo/geo.go b/vendor/github.com/blevesearch/bleve/v2/geo/geo.go index b18ace4337..55eace1df0 100644 --- a/vendor/github.com/blevesearch/bleve/geo/geo.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/geo/geo_dist.go b/vendor/github.com/blevesearch/bleve/v2/geo/geo_dist.go index d3ae0ed9e3..d3ae0ed9e3 100644 --- a/vendor/github.com/blevesearch/bleve/geo/geo_dist.go +++ b/vendor/github.com/blevesearch/bleve/v2/geo/geo_dist.go diff --git a/vendor/github.com/blevesearch/bleve/geo/geohash.go b/vendor/github.com/blevesearch/bleve/v2/geo/geohash.go index d3d4dfa8b5..d3d4dfa8b5 100644 --- a/vendor/github.com/blevesearch/bleve/geo/geohash.go +++ b/vendor/github.com/blevesearch/bleve/v2/geo/geohash.go diff --git a/vendor/github.com/blevesearch/bleve/geo/parse.go b/vendor/github.com/blevesearch/bleve/v2/geo/parse.go index 8286805ff7..8286805ff7 100644 --- a/vendor/github.com/blevesearch/bleve/geo/parse.go +++ b/vendor/github.com/blevesearch/bleve/v2/geo/parse.go diff --git a/vendor/github.com/blevesearch/bleve/geo/sloppy.go b/vendor/github.com/blevesearch/bleve/v2/geo/sloppy.go index 0ce646d74a..0ce646d74a 100644 --- a/vendor/github.com/blevesearch/bleve/geo/sloppy.go +++ b/vendor/github.com/blevesearch/bleve/v2/geo/sloppy.go diff --git a/vendor/github.com/blevesearch/bleve/go.mod b/vendor/github.com/blevesearch/bleve/v2/go.mod index 6300aea17f..3ba4ec6549 100644 --- a/vendor/github.com/blevesearch/bleve/go.mod +++ b/vendor/github.com/blevesearch/bleve/v2/go.mod @@ -1,18 +1,20 @@ -module github.com/blevesearch/bleve +module github.com/blevesearch/bleve/v2 go 1.13 require ( github.com/RoaringBitmap/roaring v0.4.23 - github.com/blevesearch/blevex v1.0.0 + github.com/blevesearch/bleve_index_api v1.0.0 github.com/blevesearch/go-porterstemmer v1.0.3 + 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/zap/v11 v11.0.14 - github.com/blevesearch/zap/v12 v12.0.14 - github.com/blevesearch/zap/v13 v13.0.6 - github.com/blevesearch/zap/v14 v14.0.5 - github.com/blevesearch/zap/v15 v15.0.3 + 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/vendor/github.com/blevesearch/bleve/v2/go.sum b/vendor/github.com/blevesearch/bleve/v2/go.sum new file mode 100644 index 0000000000..f411283ba0 --- /dev/null +++ b/vendor/github.com/blevesearch/bleve/v2/go.sum @@ -0,0 +1,128 @@ +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/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +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 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 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= +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 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= +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 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/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= +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 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= +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 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/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= +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/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/sync v0.0.0-20180314180146-1d60e4601c6f/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-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +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/vendor/github.com/blevesearch/bleve/index.go b/vendor/github.com/blevesearch/bleve/v2/index.go index 974358b81e..e08271e511 100644 --- a/vendor/github.com/blevesearch/bleve/index.go +++ b/vendor/github.com/blevesearch/bleve/v2/index.go @@ -16,12 +16,12 @@ package bleve import ( "context" + "github.com/blevesearch/bleve/v2/index/upsidedown" - "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" + "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" ) // 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) @@ -245,9 +245,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. @@ -263,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/vendor/github.com/blevesearch/bleve/index/scorch/README.md b/vendor/github.com/blevesearch/bleve/v2/index/scorch/README.md index 9794aed707..9794aed707 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/README.md +++ b/vendor/github.com/blevesearch/bleve/v2/index/scorch/README.md diff --git a/vendor/github.com/blevesearch/bleve/index/scorch/builder.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/builder.go index 1f4b41d639..455c535787 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/builder.go +++ b/vendor/github.com/blevesearch/bleve/v2/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" ) @@ -40,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) { @@ -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() @@ -135,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.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) + analyze(doc) + analysisResults = append(analysisResults, doc) } } diff --git a/vendor/github.com/blevesearch/bleve/index/store/multiget.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/empty.go index 635bcd4116..7bda01aa4f 100644 --- a/vendor/github.com/blevesearch/bleve/index/store/multiget.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/scorch/empty.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 Couchbase, Inc. +// 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. @@ -12,22 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -package store +package scorch -// 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)) +import segment "github.com/blevesearch/scorch_segment_api" - for i, key := range keys { - val, err := kvreader.Get(key) - if err != nil { - return nil, err - } +type emptyPostingsIterator struct{} - vals[i] = val - } +func (e *emptyPostingsIterator) Next() (segment.Posting, error) { + return nil, nil +} + +func (e *emptyPostingsIterator) Advance(uint64) (segment.Posting, error) { + return nil, nil +} - return vals, nil +func (e *emptyPostingsIterator) Size() int { + return 0 } + +var anEmptyPostingsIterator = &emptyPostingsIterator{} diff --git a/vendor/github.com/blevesearch/bleve/index/scorch/event.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/event.go index 8f3fc1914d..8f3fc1914d 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/event.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/scorch/event.go diff --git a/vendor/github.com/blevesearch/bleve/v2/index/scorch/int.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/int.go new file mode 100644 index 0000000000..4fa6d7f71f --- /dev/null +++ b/vendor/github.com/blevesearch/bleve/v2/index/scorch/int.go @@ -0,0 +1,92 @@ +// 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 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/vendor/github.com/blevesearch/bleve/index/scorch/introducer.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/introducer.go index 7770c41c52..4f71048fd1 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/introducer.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/index/scorch/merge.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/merge.go index 56c0953f46..5cd41ae8ab 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/merge.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/scorch/merge.go @@ -24,8 +24,8 @@ import ( "time" "github.com/RoaringBitmap/roaring" - "github.com/blevesearch/bleve/index/scorch/mergeplan" - "github.com/blevesearch/bleve/index/scorch/segment" + "github.com/blevesearch/bleve/v2/index/scorch/mergeplan" + segment "github.com/blevesearch/scorch_segment_api" ) func (s *Scorch) mergerLoop() { diff --git a/vendor/github.com/blevesearch/bleve/index/scorch/mergeplan/merge_plan.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/mergeplan/merge_plan.go index 7523506626..7523506626 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/mergeplan/merge_plan.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/scorch/mergeplan/merge_plan.go diff --git a/vendor/github.com/blevesearch/bleve/index/scorch/mergeplan/sort.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/mergeplan/sort.go index d044b8d7c9..d044b8d7c9 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/mergeplan/sort.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/scorch/mergeplan/sort.go diff --git a/vendor/github.com/blevesearch/bleve/index/scorch/optimize.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/optimize.go index 658354cd71..8575613b5e 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/optimize.go +++ b/vendor/github.com/blevesearch/bleve/v2/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" ) @@ -174,9 +174,9 @@ 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] = 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,14 +221,14 @@ 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 } } // 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 } @@ -236,13 +236,13 @@ 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 } 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/vendor/github.com/blevesearch/bleve/index/scorch/persister.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/persister.go index 498378a4f8..d58a4b8e72 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/persister.go +++ b/vendor/github.com/blevesearch/bleve/v2/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" ) @@ -429,12 +429,12 @@ 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 } - 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/vendor/github.com/blevesearch/bleve/index/scorch/segment/regexp.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/regexp.go index 3a31f41498..6c43d99e2d 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/segment/regexp.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/scorch/regexp.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Couchbase, Inc. +// 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. @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package segment +package scorch import ( "regexp/syntax" @@ -20,7 +20,7 @@ import ( "github.com/couchbase/vellum/regexp" ) -func ParseRegexp(pattern string) (a *regexp.Regexp, prefixBeg, prefixEnd []byte, err error) { +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) @@ -33,10 +33,10 @@ func ParseRegexp(pattern string) (a *regexp.Regexp, prefixBeg, prefixEnd []byte, return nil, nil, nil, err } - prefix := LiteralPrefix(parsed) + prefix := literalPrefix(parsed) if prefix != "" { prefixBeg := []byte(prefix) - prefixEnd := IncrementBytes(prefixBeg) + prefixEnd := calculateExclusiveEndFromPrefix(prefixBeg) return re, prefixBeg, prefixEnd, nil } @@ -44,7 +44,7 @@ func ParseRegexp(pattern string) (a *regexp.Regexp, prefixBeg, prefixEnd []byte, } // Returns the literal prefix given the parse tree for a regexp -func LiteralPrefix(s *syntax.Regexp) string { +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 { @@ -61,15 +61,3 @@ func LiteralPrefix(s *syntax.Regexp) string { 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/vendor/github.com/blevesearch/bleve/index/scorch/rollback.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/rollback.go index 7cc87bdea0..067220e6ff 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/rollback.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/scorch/rollback.go @@ -19,7 +19,6 @@ import ( "log" "os" - "github.com/blevesearch/bleve/index/scorch/segment" 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 } diff --git a/vendor/github.com/blevesearch/bleve/index/scorch/scorch.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/scorch.go index fccff67ab5..5e6304f351 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/scorch.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/scorch/scorch.go @@ -24,12 +24,9 @@ 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" + "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" ) @@ -75,7 +72,7 @@ type Scorch struct { forceMergeRequestCh chan *mergerCtrl - segPlugin segment.Plugin + segPlugin SegmentPlugin } type internalStats struct { @@ -293,7 +290,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) @@ -313,7 +310,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 @@ -322,7 +319,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 { @@ -335,18 +332,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 { @@ -566,37 +566,23 @@ func (s *Scorch) StatsMap() map[string]interface{} { return m } -func (s *Scorch) Analyze(d *document.Document) *index.AnalysisResult { - return analyze(d) +func (s *Scorch) Analyze(d index.Document) { + analyze(d) } -func analyze(d *document.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 { +func analyze(d index.Document) { + d.VisitFields(func(field index.Field) { if field.Options().IsIndexed() { - fieldLength, tokenFreqs := field.Analyze() - rv.Analyzed[i] = tokenFreqs - rv.Length[i] = fieldLength + 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 -} - -func (s *Scorch) Advanced() (store.KVStore, error) { - return nil, nil + }) } func (s *Scorch) AddEligibleForRemoval(epoch uint64) { diff --git a/vendor/github.com/blevesearch/bleve/v2/index/scorch/segment_plugin.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/segment_plugin.go new file mode 100644 index 0000000000..99c3b9c891 --- /dev/null +++ b/vendor/github.com/blevesearch/bleve/v2/index/scorch/segment_plugin.go @@ -0,0 +1,133 @@ +// Copyright (c) 2019 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" + "github.com/RoaringBitmap/roaring" + index "github.com/blevesearch/bleve_index_api" + + segment "github.com/blevesearch/scorch_segment_api" + + 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" +) + +// 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() { + ResetSegmentPlugins() + RegisterSegmentPlugin(&zapv15.ZapPlugin{}, true) + RegisterSegmentPlugin(&zapv14.ZapPlugin{}, false) + RegisterSegmentPlugin(&zapv13.ZapPlugin{}, false) + RegisterSegmentPlugin(&zapv12.ZapPlugin{}, false) + RegisterSegmentPlugin(&zapv11.ZapPlugin{}, false) +} + +func ResetSegmentPlugins() { + supportedSegmentPlugins = map[string]map[uint32]SegmentPlugin{} +} + +func RegisterSegmentPlugin(plugin SegmentPlugin, makeDefault bool) { + if _, ok := supportedSegmentPlugins[plugin.Type()]; !ok { + supportedSegmentPlugins[plugin.Type()] = map[uint32]SegmentPlugin{} + } + supportedSegmentPlugins[plugin.Type()][plugin.Version()] = plugin + if makeDefault { + defaultSegmentPlugin = plugin + } +} + +func SupportedSegmentTypes() (rv []string) { + for k := range supportedSegmentPlugins { + rv = append(rv, k) + } + return +} + +func SupportedSegmentTypeVersions(typ string) (rv []uint32) { + for k := range supportedSegmentPlugins[typ] { + rv = append(rv, k) + } + return rv +} + +func chooseSegmentPlugin(forcedSegmentType string, + forcedSegmentVersion uint32) (SegmentPlugin, error) { + if versions, ok := supportedSegmentPlugins[forcedSegmentType]; ok { + if segPlugin, ok := versions[uint32(forcedSegmentVersion)]; ok { + return segPlugin, nil + } + return nil, fmt.Errorf( + "unsupported version %d for segment type: %s, supported: %v", + forcedSegmentVersion, forcedSegmentType, + SupportedSegmentTypeVersions(forcedSegmentType)) + } + return nil, fmt.Errorf("unsupported segment type: %s, supported: %v", + forcedSegmentType, SupportedSegmentTypes()) +} + +func (s *Scorch) loadSegmentPlugin(forcedSegmentType string, + forcedSegmentVersion uint32) error { + segPlugin, err := chooseSegmentPlugin(forcedSegmentType, + forcedSegmentVersion) + if err != nil { + return err + } + s.segPlugin = segPlugin + return nil +} diff --git a/vendor/github.com/blevesearch/bleve/index/scorch/snapshot_index.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/snapshot_index.go index 61204ebbca..7c8353c8bf 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/snapshot_index.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/scorch/snapshot_index.go @@ -24,9 +24,9 @@ import ( "sync/atomic" "github.com/RoaringBitmap/roaring" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/scorch/segment" + "github.com/blevesearch/bleve/v2/document" + index "github.com/blevesearch/bleve_index_api" + segment "github.com/blevesearch/scorch_segment_api" "github.com/couchbase/vellum" lev "github.com/couchbase/vellum/levenshtein" ) @@ -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) } @@ -213,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 } @@ -243,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 { @@ -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) } @@ -349,7 +383,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 +411,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 +423,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 +440,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) { @@ -563,40 +597,15 @@ 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) ( + 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 { @@ -627,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 } @@ -662,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/vendor/github.com/blevesearch/bleve/index/scorch/snapshot_index_dict.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/snapshot_index_dict.go index 47486c2554..90e5a56772 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/snapshot_index_dict.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/index/scorch/snapshot_index_doc.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/snapshot_index_doc.go index 27da208655..fe174e7e3e 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/snapshot_index_doc.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/scorch/snapshot_index_doc.go @@ -19,8 +19,8 @@ import ( "reflect" "github.com/RoaringBitmap/roaring" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/size" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeIndexSnapshotDocIDReader int diff --git a/vendor/github.com/blevesearch/bleve/index/scorch/snapshot_index_tfr.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/snapshot_index_tfr.go index 239f68fbe7..07b56605a1 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/snapshot_index_tfr.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/scorch/snapshot_index_tfr.go @@ -20,9 +20,9 @@ import ( "reflect" "sync/atomic" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/scorch/segment" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/size" + index "github.com/blevesearch/bleve_index_api" + segment "github.com/blevesearch/scorch_segment_api" ) var reflectStaticSizeIndexSnapshotTermFieldReader int diff --git a/vendor/github.com/blevesearch/bleve/index/scorch/snapshot_segment.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/snapshot_segment.go index 96742b4f94..3170b76212 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/snapshot_segment.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/scorch/snapshot_segment.go @@ -20,9 +20,9 @@ import ( "sync/atomic" "github.com/RoaringBitmap/roaring" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/scorch/segment" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/size" + index "github.com/blevesearch/bleve_index_api" + segment "github.com/blevesearch/scorch_segment_api" ) var TermSeparator byte = 0xff @@ -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) { @@ -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 @@ -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/vendor/github.com/blevesearch/bleve/index/scorch/stats.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/stats.go index 626fff2e47..626fff2e47 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/stats.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/scorch/stats.go diff --git a/vendor/github.com/blevesearch/bleve/index/scorch/segment/unadorned.go b/vendor/github.com/blevesearch/bleve/v2/index/scorch/unadorned.go index db06562df1..bc7ca4e311 100644 --- a/vendor/github.com/blevesearch/bleve/index/scorch/segment/unadorned.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/scorch/unadorned.go @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -package segment +package scorch import ( "github.com/RoaringBitmap/roaring" + segment "github.com/blevesearch/scorch_segment_api" "math" "reflect" ) @@ -25,28 +26,28 @@ var reflectStaticSizeUnadornedPostingsIterator1Hit int var reflectStaticSizeUnadornedPosting int func init() { - var pib UnadornedPostingsIteratorBitmap + var pib unadornedPostingsIteratorBitmap reflectStaticSizeUnadornedPostingsIteratorBitmap = int(reflect.TypeOf(pib).Size()) - var pi1h UnadornedPostingsIterator1Hit + var pi1h unadornedPostingsIterator1Hit reflectStaticSizeUnadornedPostingsIterator1Hit = int(reflect.TypeOf(pi1h).Size()) var up UnadornedPosting reflectStaticSizeUnadornedPosting = int(reflect.TypeOf(up).Size()) } -type UnadornedPostingsIteratorBitmap struct { +type unadornedPostingsIteratorBitmap struct { actual roaring.IntPeekable actualBM *roaring.Bitmap } -func (i *UnadornedPostingsIteratorBitmap) Next() (Posting, error) { +func (i *unadornedPostingsIteratorBitmap) Next() (segment.Posting, error) { return i.nextAtOrAfter(0) } -func (i *UnadornedPostingsIteratorBitmap) Advance(docNum uint64) (Posting, error) { +func (i *unadornedPostingsIteratorBitmap) Advance(docNum uint64) (segment.Posting, error) { return i.nextAtOrAfter(docNum) } -func (i *UnadornedPostingsIteratorBitmap) nextAtOrAfter(atOrAfter uint64) (Posting, error) { +func (i *unadornedPostingsIteratorBitmap) nextAtOrAfter(atOrAfter uint64) (segment.Posting, error) { docNum, exists := i.nextDocNumAtOrAfter(atOrAfter) if !exists { return nil, nil @@ -54,7 +55,7 @@ func (i *UnadornedPostingsIteratorBitmap) nextAtOrAfter(atOrAfter uint64) (Posti return UnadornedPosting(docNum), nil } -func (i *UnadornedPostingsIteratorBitmap) nextDocNumAtOrAfter(atOrAfter uint64) (uint64, bool) { +func (i *unadornedPostingsIteratorBitmap) nextDocNumAtOrAfter(atOrAfter uint64) (uint64, bool) { if i.actual == nil || !i.actual.HasNext() { return 0, false } @@ -67,25 +68,25 @@ func (i *UnadornedPostingsIteratorBitmap) nextDocNumAtOrAfter(atOrAfter uint64) return uint64(i.actual.Next()), true } -func (i *UnadornedPostingsIteratorBitmap) Size() int { +func (i *unadornedPostingsIteratorBitmap) Size() int { return reflectStaticSizeUnadornedPostingsIteratorBitmap } -func (i *UnadornedPostingsIteratorBitmap) ActualBitmap() *roaring.Bitmap { +func (i *unadornedPostingsIteratorBitmap) ActualBitmap() *roaring.Bitmap { return i.actualBM } -func (i *UnadornedPostingsIteratorBitmap) DocNum1Hit() (uint64, bool) { +func (i *unadornedPostingsIteratorBitmap) DocNum1Hit() (uint64, bool) { return 0, false } -func (i *UnadornedPostingsIteratorBitmap) ReplaceActual(actual *roaring.Bitmap) { +func (i *unadornedPostingsIteratorBitmap) ReplaceActual(actual *roaring.Bitmap) { i.actualBM = actual i.actual = actual.Iterator() } -func NewUnadornedPostingsIteratorFromBitmap(bm *roaring.Bitmap) PostingsIterator { - return &UnadornedPostingsIteratorBitmap{ +func newUnadornedPostingsIteratorFromBitmap(bm *roaring.Bitmap) segment.PostingsIterator { + return &unadornedPostingsIteratorBitmap{ actualBM: bm, actual: bm.Iterator(), } @@ -93,19 +94,19 @@ func NewUnadornedPostingsIteratorFromBitmap(bm *roaring.Bitmap) PostingsIterator const docNum1HitFinished = math.MaxUint64 -type UnadornedPostingsIterator1Hit struct { +type unadornedPostingsIterator1Hit struct { docNum uint64 } -func (i *UnadornedPostingsIterator1Hit) Next() (Posting, error) { +func (i *unadornedPostingsIterator1Hit) Next() (segment.Posting, error) { return i.nextAtOrAfter(0) } -func (i *UnadornedPostingsIterator1Hit) Advance(docNum uint64) (Posting, error) { +func (i *unadornedPostingsIterator1Hit) Advance(docNum uint64) (segment.Posting, error) { return i.nextAtOrAfter(docNum) } -func (i *UnadornedPostingsIterator1Hit) nextAtOrAfter(atOrAfter uint64) (Posting, error) { +func (i *unadornedPostingsIterator1Hit) nextAtOrAfter(atOrAfter uint64) (segment.Posting, error) { docNum, exists := i.nextDocNumAtOrAfter(atOrAfter) if !exists { return nil, nil @@ -113,7 +114,7 @@ func (i *UnadornedPostingsIterator1Hit) nextAtOrAfter(atOrAfter uint64) (Posting return UnadornedPosting(docNum), nil } -func (i *UnadornedPostingsIterator1Hit) nextDocNumAtOrAfter(atOrAfter uint64) (uint64, bool) { +func (i *unadornedPostingsIterator1Hit) nextDocNumAtOrAfter(atOrAfter uint64) (uint64, bool) { if i.docNum == docNum1HitFinished { return 0, false } @@ -127,12 +128,12 @@ func (i *UnadornedPostingsIterator1Hit) nextDocNumAtOrAfter(atOrAfter uint64) (u return docNum, true } -func (i *UnadornedPostingsIterator1Hit) Size() int { +func (i *unadornedPostingsIterator1Hit) Size() int { return reflectStaticSizeUnadornedPostingsIterator1Hit } -func NewUnadornedPostingsIteratorFrom1Hit(docNum1Hit uint64) PostingsIterator { - return &UnadornedPostingsIterator1Hit{ +func newUnadornedPostingsIteratorFrom1Hit(docNum1Hit uint64) segment.PostingsIterator { + return &unadornedPostingsIterator1Hit{ docNum1Hit, } } @@ -151,7 +152,7 @@ func (p UnadornedPosting) Norm() float64 { return 0 } -func (p UnadornedPosting) Locations() []Location { +func (p UnadornedPosting) Locations() []segment.Location { return nil } diff --git a/vendor/github.com/blevesearch/bleve/index/upsidedown/analysis.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/analysis.go index d1b1fd5965..1ebd1918ee 100644 --- a/vendor/github.com/blevesearch/bleve/index/upsidedown/analysis.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/analysis.go @@ -15,29 +15,46 @@ 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 { - rv := &index.AnalysisResult{ - DocID: d.ID, - Rows: make([]index.IndexRow, 0, 100), +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 { + return udc.analyze(d) +} + +func (udc *UpsideDownCouch) analyze(d index.Document) *AnalysisResult { + rv := &AnalysisResult{ + DocID: d.ID(), + Rows: make([]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) @@ -45,7 +62,9 @@ func (udc *UpsideDownCouch) Analyze(d *document.Document) *index.AnalysisResult fieldNames[fieldIndex] = field.Name() if field.Options().IsIndexed() { - fieldLength, tokenFreqs := field.Analyze() + field.Analyze() + fieldLength := field.AnalyzedLength() + tokenFreqs := field.AnalyzedTokenFrequencies() existingFreqs := fieldTermFreqs[fieldIndex] if existingFreqs == nil { fieldTermFreqs[fieldIndex] = tokenFreqs @@ -66,21 +85,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 @@ -88,7 +107,7 @@ func (udc *UpsideDownCouch) Analyze(d *document.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/vendor/github.com/blevesearch/bleve/index/upsidedown/benchmark_all.sh b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/benchmark_all.sh index 079fef1865..079fef1865 100644 --- a/vendor/github.com/blevesearch/bleve/index/upsidedown/benchmark_all.sh +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/benchmark_all.sh diff --git a/vendor/github.com/blevesearch/bleve/index/upsidedown/dump.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/dump.go index cb045d2493..64ebb1b265 100644 --- a/vendor/github.com/blevesearch/bleve/index/upsidedown/dump.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/dump.go @@ -18,7 +18,7 @@ import ( "bytes" "sort" - "github.com/blevesearch/bleve/index/store" + "github.com/blevesearch/upsidedown_store_api" ) // the functions in this file are only intended to be used by diff --git a/vendor/github.com/blevesearch/bleve/index/field_cache.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/field_cache.go index 9354081f1d..1f68b71dd6 100644 --- a/vendor/github.com/blevesearch/bleve/index/field_cache.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/field_cache.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package index +package upsidedown import ( "sync" diff --git a/vendor/github.com/blevesearch/bleve/index/upsidedown/field_dict.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/field_dict.go index 20d4eb34f2..c4be577403 100644 --- a/vendor/github.com/blevesearch/bleve/index/upsidedown/field_dict.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/upsidedown_store_api" ) type UpsideDownCouchFieldDict struct { diff --git a/vendor/github.com/blevesearch/bleve/index/upsidedown/index_reader.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/index_reader.go index ea7243eaa6..ff0986d57e 100644 --- a/vendor/github.com/blevesearch/bleve/index/upsidedown/index_reader.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/index_reader.go @@ -17,9 +17,9 @@ package upsidedown import ( "reflect" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/store" + "github.com/blevesearch/bleve/v2/document" + index "github.com/blevesearch/bleve_index_api" + "github.com/blevesearch/upsidedown_store_api" ) 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,24 +93,23 @@ 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 { +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) @@ -221,6 +220,6 @@ type DocValueReader struct { } func (dvr *DocValueReader) VisitDocValues(id index.IndexInternalID, - visitor index.DocumentFieldTermVisitor) error { - return dvr.i.DocumentVisitFieldTerms(id, dvr.fields, visitor) + visitor index.DocValueVisitor) error { + return dvr.i.documentVisitFieldTerms(id, dvr.fields, visitor) } diff --git a/vendor/github.com/blevesearch/bleve/index/upsidedown/reader.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/reader.go index bc0fef1199..68b15318e1 100644 --- a/vendor/github.com/blevesearch/bleve/index/upsidedown/reader.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/reader.go @@ -20,9 +20,9 @@ import ( "sort" "sync/atomic" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/index/store" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/size" + index "github.com/blevesearch/bleve_index_api" + "github.com/blevesearch/upsidedown_store_api" ) var reflectStaticSizeUpsideDownCouchTermFieldReader int diff --git a/vendor/github.com/blevesearch/bleve/index/upsidedown/row.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/row.go index 531e0a0d33..901a4bcb06 100644 --- a/vendor/github.com/blevesearch/bleve/index/upsidedown/row.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/index/upsidedown/row_merge.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/row_merge.go index 39172ade66..39172ade66 100644 --- a/vendor/github.com/blevesearch/bleve/index/upsidedown/row_merge.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/row_merge.go diff --git a/vendor/github.com/blevesearch/bleve/index/upsidedown/stats.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/stats.go index a148ab7048..c1b4ddc018 100644 --- a/vendor/github.com/blevesearch/bleve/index/upsidedown/stats.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/stats.go @@ -18,7 +18,7 @@ import ( "encoding/json" "sync/atomic" - "github.com/blevesearch/bleve/index/store" + "github.com/blevesearch/upsidedown_store_api" ) type indexStat struct { diff --git a/vendor/github.com/blevesearch/bleve/index/store/boltdb/iterator.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb/iterator.go index cf4da87c35..cf4da87c35 100644 --- a/vendor/github.com/blevesearch/bleve/index/store/boltdb/iterator.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb/iterator.go diff --git a/vendor/github.com/blevesearch/bleve/index/store/boltdb/reader.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb/reader.go index 7977ebbe56..79513f600c 100644 --- a/vendor/github.com/blevesearch/bleve/index/store/boltdb/reader.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb/reader.go @@ -15,7 +15,7 @@ package boltdb import ( - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/upsidedown_store_api" bolt "go.etcd.io/bbolt" ) diff --git a/vendor/github.com/blevesearch/bleve/index/store/boltdb/stats.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb/stats.go index e50e552745..e50e552745 100644 --- a/vendor/github.com/blevesearch/bleve/index/store/boltdb/stats.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb/stats.go diff --git a/vendor/github.com/blevesearch/bleve/index/store/boltdb/store.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb/store.go index 3c749693c0..bc99275e17 100644 --- a/vendor/github.com/blevesearch/bleve/index/store/boltdb/store.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb/store.go @@ -28,8 +28,8 @@ import ( "fmt" "os" - "github.com/blevesearch/bleve/index/store" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/registry" + store "github.com/blevesearch/upsidedown_store_api" bolt "go.etcd.io/bbolt" ) diff --git a/vendor/github.com/blevesearch/bleve/index/store/boltdb/writer.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb/writer.go index f09357457b..c25583cab7 100644 --- a/vendor/github.com/blevesearch/bleve/index/store/boltdb/writer.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/boltdb/writer.go @@ -17,7 +17,7 @@ package boltdb import ( "fmt" - "github.com/blevesearch/bleve/index/store" + store "github.com/blevesearch/upsidedown_store_api" ) type Writer struct { diff --git a/vendor/github.com/blevesearch/bleve/index/store/gtreap/iterator.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap/iterator.go index 092ccf240e..092ccf240e 100644 --- a/vendor/github.com/blevesearch/bleve/index/store/gtreap/iterator.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap/iterator.go diff --git a/vendor/github.com/blevesearch/bleve/index/store/gtreap/reader.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap/reader.go index 98254d347b..34df81302b 100644 --- a/vendor/github.com/blevesearch/bleve/index/store/gtreap/reader.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap/reader.go @@ -18,7 +18,7 @@ package gtreap import ( - "github.com/blevesearch/bleve/index/store" + "github.com/blevesearch/upsidedown_store_api" "github.com/steveyen/gtreap" ) diff --git a/vendor/github.com/blevesearch/bleve/index/store/gtreap/store.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap/store.go index 3e6c5fec1a..8d1f5887d6 100644 --- a/vendor/github.com/blevesearch/bleve/index/store/gtreap/store.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap/store.go @@ -24,8 +24,8 @@ import ( "os" "sync" - "github.com/blevesearch/bleve/index/store" - "github.com/blevesearch/bleve/registry" + "github.com/blevesearch/bleve/v2/registry" + "github.com/blevesearch/upsidedown_store_api" "github.com/steveyen/gtreap" ) diff --git a/vendor/github.com/blevesearch/bleve/index/store/gtreap/writer.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap/writer.go index 777aab406d..80aa15b193 100644 --- a/vendor/github.com/blevesearch/bleve/index/store/gtreap/writer.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/store/gtreap/writer.go @@ -21,7 +21,7 @@ import ( "fmt" "math/rand" - "github.com/blevesearch/bleve/index/store" + "github.com/blevesearch/upsidedown_store_api" ) type Writer struct { diff --git a/vendor/github.com/blevesearch/bleve/index/upsidedown/upsidedown.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/upsidedown.go index 8e915c6ad5..d67ee03fb0 100644 --- a/vendor/github.com/blevesearch/bleve/index/upsidedown/upsidedown.go +++ b/vendor/github.com/blevesearch/bleve/v2/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" + "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" "github.com/golang/protobuf/proto" ) @@ -49,13 +48,15 @@ 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 storeName string storeConfig map[string]interface{} store store.KVStore - fieldCache *index.FieldCache + fieldCache *FieldCache analysisQueue *index.AnalysisQueue stats *indexStat @@ -68,14 +69,14 @@ 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 } 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, @@ -300,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 } @@ -412,14 +413,16 @@ 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) - 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 @@ -439,7 +442,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,8 +457,8 @@ func (udc *UpsideDownCouch) Update(doc *document.Document) (err error) { return udc.UpdateWithAnalysis(doc, result, backIndexRow) } -func (udc *UpsideDownCouch) UpdateWithAnalysis(doc *document.Document, - result *index.AnalysisResult, backIndexRow *BackIndexRow) (err error) { +func (udc *UpsideDownCouch) UpdateWithAnalysis(doc index.Document, + result *AnalysisResult, backIndexRow *BackIndexRow) (err error) { // start a writer for this update indexStart := time.Now() var kvwriter store.KVWriter @@ -501,7 +504,7 @@ func (udc *UpsideDownCouch) UpdateWithAnalysis(doc *document.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 { @@ -587,8 +590,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 []IndexRow, backIndexStoredEntries []*BackIndexStoreEntry) ([]IndexRow, []*BackIndexStoreEntry) { + fieldType := field.EncodedFieldType() storedRow := NewStoredRow(docID, fieldIndex, field.ArrayPositions(), fieldType, field.Value()) // record the back index entry @@ -597,26 +600,7 @@ func (udc *UpsideDownCouch) storeField(docID []byte, field document.Field, field 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 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 []IndexRow, backIndexTermsEntries []*BackIndexTermsEntry) ([]IndexRow, []*BackIndexTermsEntry) { fieldNorm := float32(1.0 / math.Sqrt(float64(fieldLength))) termFreqRows := make([]TermFrequencyRow, len(tokenFreqs)) @@ -747,11 +731,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 []IndexRow) ([]*TermVector, []IndexRow) { a := make([]TermVector, len(tf.Locations)) rv := make([]*TermVector, len(tf.Locations)) @@ -807,7 +791,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 @@ -823,9 +807,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 + }) } } }() @@ -866,7 +852,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 diff --git a/vendor/github.com/blevesearch/bleve/index/upsidedown/upsidedown.pb.go b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/upsidedown.pb.go index c161e1ccfb..c161e1ccfb 100644 --- a/vendor/github.com/blevesearch/bleve/index/upsidedown/upsidedown.pb.go +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/upsidedown.pb.go diff --git a/vendor/github.com/blevesearch/bleve/index/upsidedown/upsidedown.proto b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/upsidedown.proto index cf0492a2db..cf0492a2db 100644 --- a/vendor/github.com/blevesearch/bleve/index/upsidedown/upsidedown.proto +++ b/vendor/github.com/blevesearch/bleve/v2/index/upsidedown/upsidedown.proto diff --git a/vendor/github.com/blevesearch/bleve/index_alias.go b/vendor/github.com/blevesearch/bleve/v2/index_alias.go index 7a85d72131..7a85d72131 100644 --- a/vendor/github.com/blevesearch/bleve/index_alias.go +++ b/vendor/github.com/blevesearch/bleve/v2/index_alias.go diff --git a/vendor/github.com/blevesearch/bleve/index_alias_impl.go b/vendor/github.com/blevesearch/bleve/v2/index_alias_impl.go index 5aa57d8ac8..5a4dc5a480 100644 --- a/vendor/github.com/blevesearch/bleve/index_alias_impl.go +++ b/vendor/github.com/blevesearch/bleve/v2/index_alias_impl.go @@ -19,11 +19,9 @@ import ( "sync" "time" - "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/search" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + index "github.com/blevesearch/bleve_index_api" ) type indexAliasImpl struct { @@ -110,7 +108,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() @@ -369,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/vendor/github.com/blevesearch/bleve/index_impl.go b/vendor/github.com/blevesearch/bleve/v2/index_impl.go index 0520fe43bf..879a366347 100644 --- a/vendor/github.com/blevesearch/bleve/index_impl.go +++ b/vendor/github.com/blevesearch/bleve/v2/index_impl.go @@ -23,16 +23,15 @@ import ( "sync/atomic" "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" - "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" ) type indexImpl struct { @@ -107,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) { @@ -177,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) { @@ -228,14 +221,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 @@ -271,7 +259,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 +311,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,28 +605,28 @@ 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) { - 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() @@ -651,7 +639,7 @@ func LoadAndHighlightFields(hit *search.DocumentMatch, req *SearchRequest, hit.AddFieldValue(docF.Name(), value) } } - } + }) } } if highlighter != nil { diff --git a/vendor/github.com/blevesearch/bleve/index_meta.go b/vendor/github.com/blevesearch/bleve/v2/index_meta.go index d814799a89..fe0ddebac3 100644 --- a/vendor/github.com/blevesearch/bleve/index_meta.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/index_stats.go b/vendor/github.com/blevesearch/bleve/v2/index_stats.go index 2d303f6ebf..2d303f6ebf 100644 --- a/vendor/github.com/blevesearch/bleve/index_stats.go +++ b/vendor/github.com/blevesearch/bleve/v2/index_stats.go diff --git a/vendor/github.com/blevesearch/bleve/mapping.go b/vendor/github.com/blevesearch/bleve/v2/mapping.go index 76238dc153..54753073a6 100644 --- a/vendor/github.com/blevesearch/bleve/mapping.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/mapping/analysis.go b/vendor/github.com/blevesearch/bleve/v2/mapping/analysis.go index 03e3cd01be..03e3cd01be 100644 --- a/vendor/github.com/blevesearch/bleve/mapping/analysis.go +++ b/vendor/github.com/blevesearch/bleve/v2/mapping/analysis.go diff --git a/vendor/github.com/blevesearch/bleve/mapping/document.go b/vendor/github.com/blevesearch/bleve/v2/mapping/document.go index dd42fab960..44911de77c 100644 --- a/vendor/github.com/blevesearch/bleve/mapping/document.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/mapping/field.go b/vendor/github.com/blevesearch/bleve/v2/mapping/field.go index 278faa1a92..7ad1744d4e 100644 --- a/vendor/github.com/blevesearch/bleve/mapping/field.go +++ b/vendor/github.com/blevesearch/bleve/v2/mapping/field.go @@ -19,9 +19,11 @@ import ( "fmt" "time" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/geo" + index "github.com/blevesearch/bleve_index_api" + + "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) @@ -59,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 @@ -150,19 +158,22 @@ 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 + } + if fm.SkipFreqNorm { + rv |= index.SkipFreqNorm } return rv } @@ -330,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) } diff --git a/vendor/github.com/blevesearch/bleve/mapping/index.go b/vendor/github.com/blevesearch/bleve/v2/mapping/index.go index 319ba949c8..c343433857 100644 --- a/vendor/github.com/blevesearch/bleve/mapping/index.go +++ b/vendor/github.com/blevesearch/bleve/v2/mapping/index.go @@ -17,12 +17,13 @@ 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" - "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 @@ -106,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() @@ -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/vendor/github.com/blevesearch/bleve/mapping/mapping.go b/vendor/github.com/blevesearch/bleve/v2/mapping/mapping.go index 4a47281126..bcf6749a44 100644 --- a/vendor/github.com/blevesearch/bleve/mapping/mapping.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/mapping/reflect.go b/vendor/github.com/blevesearch/bleve/v2/mapping/reflect.go index 6500a70592..6500a70592 100644 --- a/vendor/github.com/blevesearch/bleve/mapping/reflect.go +++ b/vendor/github.com/blevesearch/bleve/v2/mapping/reflect.go diff --git a/vendor/github.com/blevesearch/bleve/numeric/bin.go b/vendor/github.com/blevesearch/bleve/v2/numeric/bin.go index 368952a2cb..368952a2cb 100644 --- a/vendor/github.com/blevesearch/bleve/numeric/bin.go +++ b/vendor/github.com/blevesearch/bleve/v2/numeric/bin.go diff --git a/vendor/github.com/blevesearch/bleve/numeric/float.go b/vendor/github.com/blevesearch/bleve/v2/numeric/float.go index 2bb14d7e8f..2bb14d7e8f 100644 --- a/vendor/github.com/blevesearch/bleve/numeric/float.go +++ b/vendor/github.com/blevesearch/bleve/v2/numeric/float.go diff --git a/vendor/github.com/blevesearch/bleve/numeric/prefix_coded.go b/vendor/github.com/blevesearch/bleve/v2/numeric/prefix_coded.go index 29bd0fc5c1..29bd0fc5c1 100644 --- a/vendor/github.com/blevesearch/bleve/numeric/prefix_coded.go +++ b/vendor/github.com/blevesearch/bleve/v2/numeric/prefix_coded.go diff --git a/vendor/github.com/blevesearch/bleve/query.go b/vendor/github.com/blevesearch/bleve/v2/query.go index 523db5ec05..91d2d5f421 100644 --- a/vendor/github.com/blevesearch/bleve/query.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/registry/analyzer.go b/vendor/github.com/blevesearch/bleve/v2/registry/analyzer.go index 340e349dc0..6c0d73b315 100644 --- a/vendor/github.com/blevesearch/bleve/registry/analyzer.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/registry/cache.go b/vendor/github.com/blevesearch/bleve/v2/registry/cache.go index b0ce852a20..b0ce852a20 100644 --- a/vendor/github.com/blevesearch/bleve/registry/cache.go +++ b/vendor/github.com/blevesearch/bleve/v2/registry/cache.go diff --git a/vendor/github.com/blevesearch/bleve/registry/char_filter.go b/vendor/github.com/blevesearch/bleve/v2/registry/char_filter.go index 4696713cc7..aa400be682 100644 --- a/vendor/github.com/blevesearch/bleve/registry/char_filter.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/registry/datetime_parser.go b/vendor/github.com/blevesearch/bleve/v2/registry/datetime_parser.go index 2cd46e5acf..a2d8ac24ab 100644 --- a/vendor/github.com/blevesearch/bleve/registry/datetime_parser.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/registry/fragment_formatter.go b/vendor/github.com/blevesearch/bleve/v2/registry/fragment_formatter.go index d0121d9679..6699f53bab 100644 --- a/vendor/github.com/blevesearch/bleve/registry/fragment_formatter.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/registry/fragmenter.go b/vendor/github.com/blevesearch/bleve/v2/registry/fragmenter.go index 18ab2ac070..cd1e32d28d 100644 --- a/vendor/github.com/blevesearch/bleve/registry/fragmenter.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/registry/highlighter.go b/vendor/github.com/blevesearch/bleve/v2/registry/highlighter.go index b84219ca11..8eb210fb3c 100644 --- a/vendor/github.com/blevesearch/bleve/registry/highlighter.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/registry/index_type.go b/vendor/github.com/blevesearch/bleve/v2/registry/index_type.go index 4da07c82e7..67938c4afa 100644 --- a/vendor/github.com/blevesearch/bleve/registry/index_type.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/registry/registry.go b/vendor/github.com/blevesearch/bleve/v2/registry/registry.go index a0ea69c8b8..02125e64fa 100644 --- a/vendor/github.com/blevesearch/bleve/registry/registry.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/registry/store.go b/vendor/github.com/blevesearch/bleve/v2/registry/store.go index 83187763d6..02ebd888cc 100644 --- a/vendor/github.com/blevesearch/bleve/registry/store.go +++ b/vendor/github.com/blevesearch/bleve/v2/registry/store.go @@ -17,7 +17,7 @@ package registry import ( "fmt" - "github.com/blevesearch/bleve/index/store" + "github.com/blevesearch/upsidedown_store_api" ) func RegisterKVStore(name string, constructor KVStoreConstructor) { diff --git a/vendor/github.com/blevesearch/bleve/registry/token_filter.go b/vendor/github.com/blevesearch/bleve/v2/registry/token_filter.go index e202e15fc7..df39411ae3 100644 --- a/vendor/github.com/blevesearch/bleve/registry/token_filter.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/registry/token_maps.go b/vendor/github.com/blevesearch/bleve/v2/registry/token_maps.go index 66ca08fdfd..08c9956eb1 100644 --- a/vendor/github.com/blevesearch/bleve/registry/token_maps.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/registry/tokenizer.go b/vendor/github.com/blevesearch/bleve/v2/registry/tokenizer.go index cb9af64388..eb954287c3 100644 --- a/vendor/github.com/blevesearch/bleve/registry/tokenizer.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search.go b/vendor/github.com/blevesearch/bleve/v2/search.go index f67450779a..a9d00b9356 100644 --- a/vendor/github.com/blevesearch/bleve/search.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/collector.go b/vendor/github.com/blevesearch/bleve/v2/search/collector.go index df3ff9c5ab..38e34fe7c0 100644 --- a/vendor/github.com/blevesearch/bleve/search/collector.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/collector/heap.go b/vendor/github.com/blevesearch/bleve/v2/search/collector/heap.go index 05502d5dfa..9503f00603 100644 --- a/vendor/github.com/blevesearch/bleve/search/collector/heap.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/collector/list.go b/vendor/github.com/blevesearch/bleve/v2/search/collector/list.go index f01d205c9c..20d4c9d01b 100644 --- a/vendor/github.com/blevesearch/bleve/search/collector/list.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/collector/slice.go b/vendor/github.com/blevesearch/bleve/v2/search/collector/slice.go index 85fe73c408..b38d9abc4f 100644 --- a/vendor/github.com/blevesearch/bleve/search/collector/slice.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/collector/topn.go b/vendor/github.com/blevesearch/bleve/v2/search/collector/topn.go index 8d4afb63a0..aa1d65bd17 100644 --- a/vendor/github.com/blevesearch/bleve/search/collector/topn.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/collector/topn.go @@ -20,9 +20,9 @@ import ( "strconv" "time" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/size" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeTopNCollector int @@ -68,7 +68,7 @@ type TopNCollector struct { cachedDesc []bool lowestMatchOutsideResults *search.DocumentMatch - updateFieldVisitor index.DocumentFieldTermVisitor + updateFieldVisitor index.DocValueVisitor dvReader index.DocValueReader searchAfter *search.DocumentMatch } diff --git a/vendor/github.com/blevesearch/bleve/search/explanation.go b/vendor/github.com/blevesearch/bleve/v2/search/explanation.go index 3b81737b50..b1ac29aa84 100644 --- a/vendor/github.com/blevesearch/bleve/search/explanation.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/facet/benchmark_data.txt b/vendor/github.com/blevesearch/bleve/v2/search/facet/benchmark_data.txt index b012f78ce5..b012f78ce5 100644 --- a/vendor/github.com/blevesearch/bleve/search/facet/benchmark_data.txt +++ b/vendor/github.com/blevesearch/bleve/v2/search/facet/benchmark_data.txt diff --git a/vendor/github.com/blevesearch/bleve/search/facet/facet_builder_datetime.go b/vendor/github.com/blevesearch/bleve/v2/search/facet/facet_builder_datetime.go index c45442e4d8..a316ee4da8 100644 --- a/vendor/github.com/blevesearch/bleve/search/facet/facet_builder_datetime.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/facet/facet_builder_numeric.go b/vendor/github.com/blevesearch/bleve/v2/search/facet/facet_builder_numeric.go index c1692b5498..6d0c6c9d13 100644 --- a/vendor/github.com/blevesearch/bleve/search/facet/facet_builder_numeric.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/facet/facet_builder_terms.go b/vendor/github.com/blevesearch/bleve/v2/search/facet/facet_builder_terms.go index 5b5901e01c..1b378db7cd 100644 --- a/vendor/github.com/blevesearch/bleve/search/facet/facet_builder_terms.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/facets_builder.go b/vendor/github.com/blevesearch/bleve/v2/search/facets_builder.go index 7fc0bedf30..9822257f7e 100644 --- a/vendor/github.com/blevesearch/bleve/search/facets_builder.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/facets_builder.go @@ -18,8 +18,8 @@ import ( "reflect" "sort" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/size" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeFacetsBuilder int diff --git a/vendor/github.com/blevesearch/bleve/search/highlight/format/html/html.go b/vendor/github.com/blevesearch/bleve/v2/search/highlight/format/html/html.go index 259a03795c..a0658d9c7f 100644 --- a/vendor/github.com/blevesearch/bleve/search/highlight/format/html/html.go +++ b/vendor/github.com/blevesearch/bleve/v2/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" @@ -60,7 +60,7 @@ func (a *FragmentFormatter) Format(f *highlight.Fragment, orderedTermLocations h // start the <mark> tag rv += a.before // add the term itself - rv += string(f.Orig[termLocation.Start:termLocation.End]) + rv += html.EscapeString(string(f.Orig[termLocation.Start:termLocation.End])) // end the <mark> tag rv += a.after // update current diff --git a/vendor/github.com/blevesearch/bleve/search/highlight/fragmenter/simple/simple.go b/vendor/github.com/blevesearch/bleve/v2/search/highlight/fragmenter/simple/simple.go index 9c63f7fb6c..348dc1ce34 100644 --- a/vendor/github.com/blevesearch/bleve/search/highlight/fragmenter/simple/simple.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/highlight/highlighter.go b/vendor/github.com/blevesearch/bleve/v2/search/highlight/highlighter.go index 8077985d41..3dd9ce0531 100644 --- a/vendor/github.com/blevesearch/bleve/search/highlight/highlighter.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/highlight/highlighter.go @@ -15,8 +15,8 @@ package highlight import ( - "github.com/blevesearch/bleve/document" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/highlight/highlighter/html/html.go b/vendor/github.com/blevesearch/bleve/v2/search/highlight/highlighter/html/html.go index 928589c477..ceb686dce5 100644 --- a/vendor/github.com/blevesearch/bleve/search/highlight/highlighter/html/html.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/highlight/highlighter/simple/fragment_scorer_simple.go b/vendor/github.com/blevesearch/bleve/v2/search/highlight/highlighter/simple/fragment_scorer_simple.go index 3ec4c3d28e..786e33cb3a 100644 --- a/vendor/github.com/blevesearch/bleve/search/highlight/highlighter/simple/fragment_scorer_simple.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/highlight/highlighter/simple/highlighter_simple.go b/vendor/github.com/blevesearch/bleve/v2/search/highlight/highlighter/simple/highlighter_simple.go index 4849516bad..19949687d2 100644 --- a/vendor/github.com/blevesearch/bleve/search/highlight/highlighter/simple/highlighter_simple.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/highlight/highlighter/simple/highlighter_simple.go @@ -17,11 +17,11 @@ package simple import ( "container/heap" "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" + "github.com/blevesearch/bleve/v2/registry" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/highlight" ) const Name = "simple" @@ -65,7 +65,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 +73,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,9 +81,9 @@ 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) + _, ok := f.(index.TextField) if ok { termLocationsSameArrayPosition := make(highlight.TermLocations, 0) for _, otl := range orderedTermLocations { @@ -101,7 +101,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/vendor/github.com/blevesearch/bleve/search/highlight/term_locations.go b/vendor/github.com/blevesearch/bleve/v2/search/highlight/term_locations.go index 6d2cb133ee..6bf385c05c 100644 --- a/vendor/github.com/blevesearch/bleve/search/highlight/term_locations.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/levenshtein.go b/vendor/github.com/blevesearch/bleve/v2/search/levenshtein.go index 687608d3ff..687608d3ff 100644 --- a/vendor/github.com/blevesearch/bleve/search/levenshtein.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/levenshtein.go diff --git a/vendor/github.com/blevesearch/bleve/search/pool.go b/vendor/github.com/blevesearch/bleve/v2/search/pool.go index ba8be8fc27..ba8be8fc27 100644 --- a/vendor/github.com/blevesearch/bleve/search/pool.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/pool.go diff --git a/vendor/github.com/blevesearch/bleve/search/query/bool_field.go b/vendor/github.com/blevesearch/bleve/v2/search/query/bool_field.go index b7b5a3d363..0272a2feb6 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/bool_field.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/bool_field.go @@ -15,10 +15,10 @@ package query import ( - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) type BoolFieldQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/boolean.go b/vendor/github.com/blevesearch/bleve/v2/search/query/boolean.go index 3cfa1d99f3..b9c504f856 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/boolean.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/boolean.go @@ -18,10 +18,10 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) type BooleanQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/boost.go b/vendor/github.com/blevesearch/bleve/v2/search/query/boost.go index 13659945db..13659945db 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/boost.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/boost.go diff --git a/vendor/github.com/blevesearch/bleve/search/query/conjunction.go b/vendor/github.com/blevesearch/bleve/v2/search/query/conjunction.go index 1a7ed1bc05..7d647646e9 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/conjunction.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/conjunction.go @@ -17,10 +17,10 @@ package query import ( "encoding/json" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) type ConjunctionQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/date_range.go b/vendor/github.com/blevesearch/bleve/v2/search/query/date_range.go index 3ac0322f55..290786ddb3 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/date_range.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/date_range.go @@ -20,13 +20,13 @@ import ( "math" "time" - "github.com/blevesearch/bleve/analysis/datetime/optional" - "github.com/blevesearch/bleve/index" - "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/analysis/datetime/optional" + "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" + index "github.com/blevesearch/bleve_index_api" ) // QueryDateTimeParser controls the default query date time parser diff --git a/vendor/github.com/blevesearch/bleve/search/query/disjunction.go b/vendor/github.com/blevesearch/bleve/v2/search/query/disjunction.go index a1fc1439a6..50957fa672 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/disjunction.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/disjunction.go @@ -18,10 +18,10 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) type DisjunctionQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/docid.go b/vendor/github.com/blevesearch/bleve/v2/search/query/docid.go index 3b865f93ac..1d273394d6 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/docid.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/docid.go @@ -15,10 +15,10 @@ package query import ( - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) type DocIDQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/fuzzy.go b/vendor/github.com/blevesearch/bleve/v2/search/query/fuzzy.go index f18982d407..aceaa802d8 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/fuzzy.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/fuzzy.go @@ -15,10 +15,10 @@ package query import ( - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) type FuzzyQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/geo_boundingbox.go b/vendor/github.com/blevesearch/bleve/v2/search/query/geo_boundingbox.go index de6be4a583..be4b5a8b92 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/geo_boundingbox.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/geo_boundingbox.go @@ -18,11 +18,11 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/geo" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/geo" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" + index "github.com/blevesearch/bleve_index_api" ) type GeoBoundingBoxQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/geo_boundingpolygon.go b/vendor/github.com/blevesearch/bleve/v2/search/query/geo_boundingpolygon.go index 41c7f7f3ab..abb8ccd7cc 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/geo_boundingpolygon.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/geo_boundingpolygon.go @@ -18,11 +18,11 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/geo" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/geo" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" + index "github.com/blevesearch/bleve_index_api" ) type GeoBoundingPolygonQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/geo_distance.go b/vendor/github.com/blevesearch/bleve/v2/search/query/geo_distance.go index ef3aa88c99..d5174c227f 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/geo_distance.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/geo_distance.go @@ -18,11 +18,11 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/geo" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/search/searcher" + "github.com/blevesearch/bleve/v2/geo" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/search/searcher" + index "github.com/blevesearch/bleve_index_api" ) type GeoDistanceQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/match.go b/vendor/github.com/blevesearch/bleve/v2/search/query/match.go index 36c9ee4a47..da1dc091fb 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/match.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/match.go @@ -18,9 +18,9 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/index" - "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" ) type MatchQuery struct { @@ -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/vendor/github.com/blevesearch/bleve/search/query/match_all.go b/vendor/github.com/blevesearch/bleve/v2/search/query/match_all.go index 7fbe1f99db..a31f25abcf 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/match_all.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/match_all.go @@ -17,10 +17,10 @@ package query import ( "encoding/json" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) type MatchAllQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/match_none.go b/vendor/github.com/blevesearch/bleve/v2/search/query/match_none.go index dc2ea780c1..69b44186c3 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/match_none.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/match_none.go @@ -17,10 +17,10 @@ package query import ( "encoding/json" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) type MatchNoneQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/match_phrase.go b/vendor/github.com/blevesearch/bleve/v2/search/query/match_phrase.go index 51be35526f..057245fbc1 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/match_phrase.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/match_phrase.go @@ -17,10 +17,10 @@ package query import ( "fmt" - "github.com/blevesearch/bleve/analysis" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/mapping" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/analysis" + "github.com/blevesearch/bleve/v2/mapping" + "github.com/blevesearch/bleve/v2/search" + index "github.com/blevesearch/bleve_index_api" ) type MatchPhraseQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/multi_phrase.go b/vendor/github.com/blevesearch/bleve/v2/search/query/multi_phrase.go index 8a7c9b6ade..d75dc0c89f 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/multi_phrase.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/multi_phrase.go @@ -18,10 +18,10 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) type MultiPhraseQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/numeric_range.go b/vendor/github.com/blevesearch/bleve/v2/search/query/numeric_range.go index ea3f068862..a1fe7b6c16 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/numeric_range.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/numeric_range.go @@ -17,10 +17,10 @@ package query import ( "fmt" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) type NumericRangeQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/phrase.go b/vendor/github.com/blevesearch/bleve/v2/search/query/phrase.go index dff1a02d4b..d6da11853c 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/phrase.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/phrase.go @@ -18,10 +18,10 @@ import ( "encoding/json" "fmt" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) type PhraseQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/prefix.go b/vendor/github.com/blevesearch/bleve/v2/search/query/prefix.go index 4f5be2b26e..05dc40c04a 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/prefix.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/prefix.go @@ -15,10 +15,10 @@ package query import ( - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) type PrefixQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/query.go b/vendor/github.com/blevesearch/bleve/v2/search/query/query.go index 18aca228d4..7f2781c37f 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/query.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/query.go @@ -20,9 +20,9 @@ import ( "io/ioutil" "log" - "github.com/blevesearch/bleve/index" - "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" ) var logger = log.New(ioutil.Discard, "bleve mapping ", log.LstdFlags) diff --git a/vendor/github.com/blevesearch/bleve/search/query/query_string.go b/vendor/github.com/blevesearch/bleve/v2/search/query/query_string.go index ecafe6bc05..fe1680c528 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/query_string.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/query_string.go @@ -15,9 +15,9 @@ package query import ( - "github.com/blevesearch/bleve/index" - "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" ) type QueryStringQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/query_string.y b/vendor/github.com/blevesearch/bleve/v2/search/query/query_string.y index d3e5ac9d7e..aeec85600b 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/query_string.y +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/query_string.y @@ -28,10 +28,11 @@ tEQUAL tTILDE %type <s> tPHRASE %type <s> tNUMBER %type <s> posOrNegNumber +%type <s> fieldName %type <s> tTILDE %type <s> tBOOST %type <q> searchBase -%type <pf> searchSuffix +%type <pf> searchSuffix %type <n> searchPrefix %% @@ -111,7 +112,7 @@ tSTRING tTILDE { $$ = q } | -tSTRING tCOLON tSTRING tTILDE { +fieldName tCOLON tSTRING tTILDE { field := $1 str := $3 fuzziness, err := strconv.ParseFloat($4, 64) @@ -147,7 +148,7 @@ tPHRASE { $$ = q } | -tSTRING tCOLON tSTRING { +fieldName tCOLON tSTRING { field := $1 str := $3 logDebugGrammar("FIELD - %s STRING - %s", field, str) @@ -163,7 +164,7 @@ tSTRING tCOLON tSTRING { $$ = q } | -tSTRING tCOLON posOrNegNumber { +fieldName tCOLON posOrNegNumber { field := $1 str := $3 logDebugGrammar("FIELD - %s STRING - %s", field, str) @@ -181,7 +182,7 @@ tSTRING tCOLON posOrNegNumber { $$ = q } | -tSTRING tCOLON tPHRASE { +fieldName tCOLON tPHRASE { field := $1 phrase := $3 logDebugGrammar("FIELD - %s PHRASE - %s", field, phrase) @@ -190,7 +191,7 @@ tSTRING tCOLON tPHRASE { $$ = q } | -tSTRING tCOLON tGREATER posOrNegNumber { +fieldName tCOLON tGREATER posOrNegNumber { field := $1 min, err := strconv.ParseFloat($4, 64) if err != nil { @@ -203,7 +204,7 @@ tSTRING tCOLON tGREATER posOrNegNumber { $$ = q } | -tSTRING tCOLON tGREATER tEQUAL posOrNegNumber { +fieldName tCOLON tGREATER tEQUAL posOrNegNumber { field := $1 min, err := strconv.ParseFloat($5, 64) if err != nil { @@ -216,7 +217,7 @@ tSTRING tCOLON tGREATER tEQUAL posOrNegNumber { $$ = q } | -tSTRING tCOLON tLESS posOrNegNumber { +fieldName tCOLON tLESS posOrNegNumber { field := $1 max, err := strconv.ParseFloat($4, 64) if err != nil { @@ -229,7 +230,7 @@ tSTRING tCOLON tLESS posOrNegNumber { $$ = q } | -tSTRING tCOLON tLESS tEQUAL posOrNegNumber { +fieldName tCOLON tLESS tEQUAL posOrNegNumber { field := $1 max, err := strconv.ParseFloat($5, 64) if err != nil { @@ -242,7 +243,7 @@ tSTRING tCOLON tLESS tEQUAL posOrNegNumber { $$ = q } | -tSTRING tCOLON tGREATER tPHRASE { +fieldName tCOLON tGREATER tPHRASE { field := $1 minInclusive := false phrase := $4 @@ -257,7 +258,7 @@ tSTRING tCOLON tGREATER tPHRASE { $$ = q } | -tSTRING tCOLON tGREATER tEQUAL tPHRASE { +fieldName tCOLON tGREATER tEQUAL tPHRASE { field := $1 minInclusive := true phrase := $5 @@ -272,7 +273,7 @@ tSTRING tCOLON tGREATER tEQUAL tPHRASE { $$ = q } | -tSTRING tCOLON tLESS tPHRASE { +fieldName tCOLON tLESS tPHRASE { field := $1 maxInclusive := false phrase := $4 @@ -287,7 +288,7 @@ tSTRING tCOLON tLESS tPHRASE { $$ = q } | -tSTRING tCOLON tLESS tEQUAL tPHRASE { +fieldName tCOLON tLESS tEQUAL tPHRASE { field := $1 maxInclusive := true phrase := $5 @@ -326,3 +327,12 @@ tNUMBER { tMINUS tNUMBER { $$ = "-" + $2 }; + +fieldName: +tPHRASE { + $$ = $1 +} +| +tSTRING { + $$ = $1 +}; diff --git a/vendor/github.com/blevesearch/bleve/search/query/query_string.y.go b/vendor/github.com/blevesearch/bleve/v2/search/query/query_string.y.go index ac2d322263..3a2abc1320 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/query_string.y.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/query_string.y.go @@ -1,3 +1,6 @@ +// Code generated by goyacc -o query_string.y.go query_string.y. DO NOT EDIT. + +//line query_string.y:2 package query import __yyfmt__ "fmt" @@ -54,6 +57,7 @@ var yyToknames = [...]string{ "tEQUAL", "tTILDE", } + var yyStatenames = [...]string{} const yyEofCode = 1 @@ -68,70 +72,72 @@ var yyExca = [...]int{ -1, 3, 1, 3, -2, 5, + -1, 9, + 8, 29, + -2, 8, + -1, 12, + 8, 28, + -2, 12, } -const yyNprod = 28 const yyPrivate = 57344 -var yyTokenNames []string -var yyStates []string - -const yyLast = 42 +const yyLast = 43 var yyAct = [...]int{ - - 17, 16, 18, 23, 22, 30, 3, 21, 19, 20, - 29, 26, 22, 22, 1, 21, 21, 15, 28, 25, - 24, 27, 34, 14, 22, 13, 31, 21, 32, 33, - 22, 9, 11, 21, 5, 6, 2, 10, 4, 12, - 7, 8, + 18, 17, 19, 24, 23, 15, 31, 22, 20, 21, + 30, 27, 23, 23, 3, 22, 22, 14, 29, 26, + 16, 25, 28, 35, 33, 23, 23, 32, 22, 22, + 34, 9, 12, 1, 5, 6, 2, 11, 4, 13, + 7, 8, 10, } -var yyPact = [...]int{ - 28, -1000, -1000, 28, 27, -1000, -1000, -1000, 16, 9, - -1000, -1000, -1000, -1000, -1000, -3, -11, -1000, -1000, 6, - 5, -1000, -5, -1000, -1000, 23, -1000, -1000, 17, -1000, - -1000, -1000, -1000, -1000, -1000, +var yyPact = [...]int{ + 28, -1000, -1000, 28, 27, -1000, -1000, -1000, 8, -9, + 12, -1000, -1000, -1000, -1000, -1000, -3, -11, -1000, -1000, + 6, 5, -1000, -4, -1000, -1000, 19, -1000, -1000, 18, + -1000, -1000, -1000, -1000, -1000, -1000, } -var yyPgo = [...]int{ - 0, 0, 41, 39, 38, 14, 36, 6, +var yyPgo = [...]int{ + 0, 0, 42, 41, 39, 38, 33, 36, 14, } -var yyR1 = [...]int{ - 0, 5, 6, 6, 7, 4, 4, 4, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 3, 3, 1, 1, +var yyR1 = [...]int{ + 0, 6, 7, 7, 8, 5, 5, 5, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 4, 4, 1, 1, 2, 2, } -var yyR2 = [...]int{ +var yyR2 = [...]int{ 0, 1, 2, 1, 3, 0, 1, 1, 1, 2, 4, 1, 1, 3, 3, 3, 4, 5, 4, 5, - 4, 5, 4, 5, 0, 1, 1, 2, + 4, 5, 4, 5, 0, 1, 1, 2, 1, 1, } -var yyChk = [...]int{ - -1000, -5, -6, -7, -4, 6, 7, -6, -2, 4, - 10, 5, -3, 9, 14, 8, 4, -1, 5, 11, - 12, 10, 7, 14, -1, 13, 5, -1, 13, 5, - 10, -1, 5, -1, 5, +var yyChk = [...]int{ + -1000, -6, -7, -8, -5, 6, 7, -7, -3, 4, + -2, 10, 5, -4, 9, 14, 8, 4, -1, 5, + 11, 12, 10, 7, 14, -1, 13, 5, -1, 13, + 5, 10, -1, 5, -1, 5, } -var yyDef = [...]int{ - 5, -2, 1, -2, 0, 6, 7, 2, 24, 8, - 11, 12, 4, 25, 9, 0, 13, 14, 15, 0, - 0, 26, 0, 10, 16, 0, 20, 18, 0, 22, - 27, 17, 21, 19, 23, +var yyDef = [...]int{ + 5, -2, 1, -2, 0, 6, 7, 2, 24, -2, + 0, 11, -2, 4, 25, 9, 0, 13, 14, 15, + 0, 0, 26, 0, 10, 16, 0, 20, 18, 0, + 22, 27, 17, 21, 19, 23, } -var yyTok1 = [...]int{ +var yyTok1 = [...]int{ 1, } -var yyTok2 = [...]int{ +var yyTok2 = [...]int{ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, } + var yyTok3 = [...]int{ 0, } @@ -475,25 +481,25 @@ yydefault: case 1: yyDollar = yyS[yypt-1 : yypt+1] - //line query_string.y:40 +//line query_string.y:41 { logDebugGrammar("INPUT") } case 2: yyDollar = yyS[yypt-2 : yypt+1] - //line query_string.y:45 +//line query_string.y:46 { logDebugGrammar("SEARCH PARTS") } case 3: yyDollar = yyS[yypt-1 : yypt+1] - //line query_string.y:49 +//line query_string.y:50 { logDebugGrammar("SEARCH PART") } case 4: yyDollar = yyS[yypt-3 : yypt+1] - //line query_string.y:54 +//line query_string.y:55 { query := yyDollar[2].q if yyDollar[3].pf != nil { @@ -512,27 +518,27 @@ yydefault: } case 5: yyDollar = yyS[yypt-0 : yypt+1] - //line query_string.y:73 +//line query_string.y:74 { yyVAL.n = queryShould } case 6: yyDollar = yyS[yypt-1 : yypt+1] - //line query_string.y:77 +//line query_string.y:78 { logDebugGrammar("PLUS") yyVAL.n = queryMust } case 7: yyDollar = yyS[yypt-1 : yypt+1] - //line query_string.y:82 +//line query_string.y:83 { logDebugGrammar("MINUS") yyVAL.n = queryMustNot } case 8: yyDollar = yyS[yypt-1 : yypt+1] - //line query_string.y:88 +//line query_string.y:89 { str := yyDollar[1].s logDebugGrammar("STRING - %s", str) @@ -548,7 +554,7 @@ yydefault: } case 9: yyDollar = yyS[yypt-2 : yypt+1] - //line query_string.y:102 +//line query_string.y:103 { str := yyDollar[1].s fuzziness, err := strconv.ParseFloat(yyDollar[2].s, 64) @@ -562,7 +568,7 @@ yydefault: } case 10: yyDollar = yyS[yypt-4 : yypt+1] - //line query_string.y:114 +//line query_string.y:115 { field := yyDollar[1].s str := yyDollar[3].s @@ -578,7 +584,7 @@ yydefault: } case 11: yyDollar = yyS[yypt-1 : yypt+1] - //line query_string.y:128 +//line query_string.y:129 { str := yyDollar[1].s logDebugGrammar("STRING - %s", str) @@ -595,7 +601,7 @@ yydefault: } case 12: yyDollar = yyS[yypt-1 : yypt+1] - //line query_string.y:143 +//line query_string.y:144 { phrase := yyDollar[1].s logDebugGrammar("PHRASE - %s", phrase) @@ -604,7 +610,7 @@ yydefault: } case 13: yyDollar = yyS[yypt-3 : yypt+1] - //line query_string.y:150 +//line query_string.y:151 { field := yyDollar[1].s str := yyDollar[3].s @@ -622,7 +628,7 @@ yydefault: } case 14: yyDollar = yyS[yypt-3 : yypt+1] - //line query_string.y:166 +//line query_string.y:167 { field := yyDollar[1].s str := yyDollar[3].s @@ -642,7 +648,7 @@ yydefault: } case 15: yyDollar = yyS[yypt-3 : yypt+1] - //line query_string.y:184 +//line query_string.y:185 { field := yyDollar[1].s phrase := yyDollar[3].s @@ -653,7 +659,7 @@ yydefault: } case 16: yyDollar = yyS[yypt-4 : yypt+1] - //line query_string.y:193 +//line query_string.y:194 { field := yyDollar[1].s min, err := strconv.ParseFloat(yyDollar[4].s, 64) @@ -668,7 +674,7 @@ yydefault: } case 17: yyDollar = yyS[yypt-5 : yypt+1] - //line query_string.y:206 +//line query_string.y:207 { field := yyDollar[1].s min, err := strconv.ParseFloat(yyDollar[5].s, 64) @@ -683,7 +689,7 @@ yydefault: } case 18: yyDollar = yyS[yypt-4 : yypt+1] - //line query_string.y:219 +//line query_string.y:220 { field := yyDollar[1].s max, err := strconv.ParseFloat(yyDollar[4].s, 64) @@ -698,7 +704,7 @@ yydefault: } case 19: yyDollar = yyS[yypt-5 : yypt+1] - //line query_string.y:232 +//line query_string.y:233 { field := yyDollar[1].s max, err := strconv.ParseFloat(yyDollar[5].s, 64) @@ -713,7 +719,7 @@ yydefault: } case 20: yyDollar = yyS[yypt-4 : yypt+1] - //line query_string.y:245 +//line query_string.y:246 { field := yyDollar[1].s minInclusive := false @@ -730,7 +736,7 @@ yydefault: } case 21: yyDollar = yyS[yypt-5 : yypt+1] - //line query_string.y:260 +//line query_string.y:261 { field := yyDollar[1].s minInclusive := true @@ -747,7 +753,7 @@ yydefault: } case 22: yyDollar = yyS[yypt-4 : yypt+1] - //line query_string.y:275 +//line query_string.y:276 { field := yyDollar[1].s maxInclusive := false @@ -764,7 +770,7 @@ yydefault: } case 23: yyDollar = yyS[yypt-5 : yypt+1] - //line query_string.y:290 +//line query_string.y:291 { field := yyDollar[1].s maxInclusive := true @@ -781,13 +787,13 @@ yydefault: } case 24: yyDollar = yyS[yypt-0 : yypt+1] - //line query_string.y:306 +//line query_string.y:307 { yyVAL.pf = nil } case 25: yyDollar = yyS[yypt-1 : yypt+1] - //line query_string.y:310 +//line query_string.y:311 { yyVAL.pf = nil boost, err := strconv.ParseFloat(yyDollar[1].s, 64) @@ -800,16 +806,28 @@ yydefault: } case 26: yyDollar = yyS[yypt-1 : yypt+1] - //line query_string.y:322 +//line query_string.y:323 { yyVAL.s = yyDollar[1].s } case 27: yyDollar = yyS[yypt-2 : yypt+1] - //line query_string.y:326 +//line query_string.y:327 { yyVAL.s = "-" + yyDollar[2].s } + case 28: + yyDollar = yyS[yypt-1 : yypt+1] +//line query_string.y:332 + { + yyVAL.s = yyDollar[1].s + } + case 29: + yyDollar = yyS[yypt-1 : yypt+1] +//line query_string.y:336 + { + yyVAL.s = yyDollar[1].s + } } goto yystack /* stack new state and value */ } diff --git a/vendor/github.com/blevesearch/bleve/search/query/query_string_lex.go b/vendor/github.com/blevesearch/bleve/v2/search/query/query_string_lex.go index 3a9cf23983..3a9cf23983 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/query_string_lex.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/query_string_lex.go diff --git a/vendor/github.com/blevesearch/bleve/search/query/query_string_parser.go b/vendor/github.com/blevesearch/bleve/v2/search/query/query_string_parser.go index 3fb7731b88..3fb7731b88 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/query_string_parser.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/query_string_parser.go diff --git a/vendor/github.com/blevesearch/bleve/search/query/regexp.go b/vendor/github.com/blevesearch/bleve/v2/search/query/regexp.go index 0c87a6f92e..ba744ec15a 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/regexp.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/regexp.go @@ -17,10 +17,10 @@ package query import ( "strings" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) type RegexpQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/term.go b/vendor/github.com/blevesearch/bleve/v2/search/query/term.go index 2eeb5a37a4..82958bb02f 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/term.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/term.go @@ -15,10 +15,10 @@ package query import ( - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) type TermQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/term_range.go b/vendor/github.com/blevesearch/bleve/v2/search/query/term_range.go index 8f8ca8444f..3edfa6954a 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/term_range.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/term_range.go @@ -17,10 +17,10 @@ package query import ( "fmt" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) type TermRangeQuery struct { diff --git a/vendor/github.com/blevesearch/bleve/search/query/wildcard.go b/vendor/github.com/blevesearch/bleve/v2/search/query/wildcard.go index 747dfe76ff..7713a9acb5 100644 --- a/vendor/github.com/blevesearch/bleve/search/query/wildcard.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/query/wildcard.go @@ -17,10 +17,10 @@ package query import ( "strings" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) var wildcardRegexpReplacer = strings.NewReplacer( diff --git a/vendor/github.com/blevesearch/bleve/search/scorer/scorer_conjunction.go b/vendor/github.com/blevesearch/bleve/v2/search/scorer/scorer_conjunction.go index 48cdf3ae90..f3c81a78c8 100644 --- a/vendor/github.com/blevesearch/bleve/search/scorer/scorer_conjunction.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/scorer/scorer_constant.go b/vendor/github.com/blevesearch/bleve/v2/search/scorer/scorer_constant.go index dc10fdaa4e..fc36fd5bfa 100644 --- a/vendor/github.com/blevesearch/bleve/search/scorer/scorer_constant.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/scorer/scorer_constant.go @@ -18,9 +18,9 @@ import ( "fmt" "reflect" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/size" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeConstantScorer int diff --git a/vendor/github.com/blevesearch/bleve/search/scorer/scorer_disjunction.go b/vendor/github.com/blevesearch/bleve/v2/search/scorer/scorer_disjunction.go index 7a955e168e..054e76fd42 100644 --- a/vendor/github.com/blevesearch/bleve/search/scorer/scorer_disjunction.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/scorer/scorer_term.go b/vendor/github.com/blevesearch/bleve/v2/search/scorer/scorer_term.go index 718de2ea5e..ca268648b3 100644 --- a/vendor/github.com/blevesearch/bleve/search/scorer/scorer_term.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/scorer/scorer_term.go @@ -19,9 +19,9 @@ import ( "math" "reflect" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/size" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeTermQueryScorer int diff --git a/vendor/github.com/blevesearch/bleve/search/scorer/sqrt_cache.go b/vendor/github.com/blevesearch/bleve/v2/search/scorer/sqrt_cache.go index e26d33d93d..e26d33d93d 100644 --- a/vendor/github.com/blevesearch/bleve/search/scorer/sqrt_cache.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/scorer/sqrt_cache.go diff --git a/vendor/github.com/blevesearch/bleve/search/search.go b/vendor/github.com/blevesearch/bleve/v2/search/search.go index 8ed23de454..9277d52959 100644 --- a/vendor/github.com/blevesearch/bleve/search/search.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/search.go @@ -19,8 +19,8 @@ import ( "reflect" "sort" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/size" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeDocumentMatch int diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/ordered_searchers_list.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/ordered_searchers_list.go index 536c593cd7..f3e646e9da 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/ordered_searchers_list.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/searcher/search_boolean.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_boolean.go index 7f0bfa4246..ef9093c20f 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_boolean.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_boolean.go @@ -18,10 +18,10 @@ import ( "math" "reflect" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeBooleanSearcher int diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_conjunction.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_conjunction.go index ac737bccd0..5fe59b900f 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_conjunction.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_conjunction.go @@ -19,10 +19,10 @@ import ( "reflect" "sort" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeConjunctionSearcher int diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_disjunction.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_disjunction.go index f47da27c4f..4cee468419 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_disjunction.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_disjunction.go @@ -16,8 +16,8 @@ package searcher import ( "fmt" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" + index "github.com/blevesearch/bleve_index_api" ) // DisjunctionMaxClauseCount is a compile time setting that applications can diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_disjunction_heap.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_disjunction_heap.go index 7f0a5a00e3..bf945976d2 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_disjunction_heap.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_disjunction_heap.go @@ -20,10 +20,10 @@ import ( "math" "reflect" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeDisjunctionHeapSearcher int diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_disjunction_slice.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_disjunction_slice.go index dc566ade57..79fee9f4da 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_disjunction_slice.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_disjunction_slice.go @@ -19,10 +19,10 @@ import ( "reflect" "sort" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeDisjunctionSliceSearcher int diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_docid.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_docid.go index 3b258a580a..2d90ae166b 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_docid.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_docid.go @@ -17,10 +17,10 @@ package searcher import ( "reflect" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeDocIDSearcher int diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_filter.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_filter.go index 7c95fb41c6..9cab0f78bd 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_filter.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_filter.go @@ -17,9 +17,9 @@ package searcher import ( "reflect" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/size" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeFilteringSearcher int diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_fuzzy.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_fuzzy.go index aca8a7d9fa..aab67010ca 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_fuzzy.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_fuzzy.go @@ -17,8 +17,8 @@ package searcher import ( "fmt" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" + index "github.com/blevesearch/bleve_index_api" ) var MaxFuzziness = 2 diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_geoboundingbox.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_geoboundingbox.go index 76157f01a1..a23151466e 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_geoboundingbox.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/index" - "github.com/blevesearch/bleve/numeric" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/document" + "github.com/blevesearch/bleve/v2/geo" + "github.com/blevesearch/bleve/v2/numeric" + "github.com/blevesearch/bleve/v2/search" + index "github.com/blevesearch/bleve_index_api" ) type filterFunc func(key []byte) bool @@ -100,6 +100,7 @@ func NewGeoBoundingBoxSearcher(indexReader index.IndexReader, minLon, minLat, var geoMaxShift = document.GeoPrecisionStep * 4 var geoDetailLevel = ((geo.GeoBits << 1) - geoMaxShift) / 2 + type closeFunc func() error func ComputeGeoRange(term uint64, shift uint, @@ -156,16 +157,16 @@ func buildIsIndexedFunc(indexReader index.IndexReader, field string) (isIndexed } } else if indexReader != nil { isIndexed = func(term []byte) bool { - reader, err := indexReader.TermFieldReader(term, field, false, false, false) - if err != nil || reader == nil { - return false - } - if reader.Count() == 0 { - _ = reader.Close() - return false - } + reader, err := indexReader.TermFieldReader(term, field, false, false, false) + if err != nil || reader == nil { + return false + } + if reader.Count() == 0 { _ = reader.Close() - return true + return false + } + _ = reader.Close() + return true } } else { @@ -209,12 +210,12 @@ func buildRectFilter(dvReader index.DocValueReader, field string, } type geoRangeCompute struct { - preallocBytesLen int - preallocBytes []byte + preallocBytesLen int + preallocBytes []byte sminLon, sminLat, smaxLon, smaxLat float64 - checkBoundaries bool - onBoundary, notOnBoundary [][]byte - isIndexed func(term []byte) bool + checkBoundaries bool + onBoundary, notOnBoundary [][]byte + isIndexed func(term []byte) bool } func (grc *geoRangeCompute) makePrefixCoded(in int64, shift uint) (rv numeric.PrefixCoded) { @@ -269,4 +270,4 @@ func (grc *geoRangeCompute) relateAndRecurse(start, end uint64, res uint) { grc.sminLon, grc.sminLat, grc.smaxLon, grc.smaxLat) { grc.computeGeoRange(start, res-1) } -}
\ No newline at end of file +} diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_geopointdistance.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_geopointdistance.go index b6f2932445..c62a2a5b79 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_geopointdistance.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_geopointdistance.go @@ -15,10 +15,10 @@ package searcher import ( - "github.com/blevesearch/bleve/geo" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/numeric" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/geo" + "github.com/blevesearch/bleve/v2/numeric" + "github.com/blevesearch/bleve/v2/search" + index "github.com/blevesearch/bleve_index_api" ) func NewGeoPointDistanceSearcher(indexReader index.IndexReader, centerLon, diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_geopolygon.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_geopolygon.go index 5f16aa8d26..9f7e61d9eb 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_geopolygon.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_geopolygon.go @@ -16,10 +16,10 @@ package searcher import ( "fmt" - "github.com/blevesearch/bleve/geo" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/numeric" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/geo" + "github.com/blevesearch/bleve/v2/numeric" + "github.com/blevesearch/bleve/v2/search" + index "github.com/blevesearch/bleve_index_api" "math" ) diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_match_all.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_match_all.go index bb66401229..db8306eee5 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_match_all.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_match_all.go @@ -17,10 +17,10 @@ package searcher import ( "reflect" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeMatchAllSearcher int diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_match_none.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_match_none.go index a345e17f77..b7f76941ec 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_match_none.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_match_none.go @@ -17,9 +17,9 @@ package searcher import ( "reflect" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/size" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeMatchNoneSearcher int diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_multi_term.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_multi_term.go index 70a2fa38c0..523bf4b557 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_multi_term.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_multi_term.go @@ -16,8 +16,8 @@ package searcher import ( "fmt" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" + index "github.com/blevesearch/bleve_index_api" ) func NewMultiTermSearcher(indexReader index.IndexReader, terms []string, diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_numeric_range.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_numeric_range.go index 48d6226e11..6ab5147bee 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_numeric_range.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_numeric_range.go @@ -19,9 +19,9 @@ import ( "math" "sort" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/numeric" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/numeric" + "github.com/blevesearch/bleve/v2/search" + index "github.com/blevesearch/bleve_index_api" ) func NewNumericRangeSearcher(indexReader index.IndexReader, @@ -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 diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_phrase.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_phrase.go index 51b7e5bd8a..c262fd9145 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_phrase.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_phrase.go @@ -19,9 +19,9 @@ import ( "math" "reflect" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/search" - "github.com/blevesearch/bleve/size" + "github.com/blevesearch/bleve/v2/search" + "github.com/blevesearch/bleve/v2/size" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizePhraseSearcher int diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_regexp.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_regexp.go index 11a44f159f..81b1cf734a 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_regexp.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_regexp.go @@ -17,10 +17,21 @@ package searcher import ( "regexp" - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" + index "github.com/blevesearch/bleve_index_api" ) +// 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 { diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_term.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_term.go index e07d25333a..55c18d1634 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_term.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_term.go @@ -17,10 +17,10 @@ package searcher import ( "reflect" - "github.com/blevesearch/bleve/index" - "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" + index "github.com/blevesearch/bleve_index_api" ) var reflectStaticSizeTermSearcher int diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_term_prefix.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_term_prefix.go index 2a8f22cff1..a01b18690a 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_term_prefix.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_term_prefix.go @@ -15,8 +15,8 @@ package searcher import ( - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" + index "github.com/blevesearch/bleve_index_api" ) func NewTermPrefixSearcher(indexReader index.IndexReader, prefix string, diff --git a/vendor/github.com/blevesearch/bleve/search/searcher/search_term_range.go b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_term_range.go index 90be1e11a2..5ef58f76f7 100644 --- a/vendor/github.com/blevesearch/bleve/search/searcher/search_term_range.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/searcher/search_term_range.go @@ -15,8 +15,8 @@ package searcher import ( - "github.com/blevesearch/bleve/index" - "github.com/blevesearch/bleve/search" + "github.com/blevesearch/bleve/v2/search" + index "github.com/blevesearch/bleve_index_api" ) func NewTermRangeSearcher(indexReader index.IndexReader, diff --git a/vendor/github.com/blevesearch/bleve/search/sort.go b/vendor/github.com/blevesearch/bleve/v2/search/sort.go index dca422ebd4..496db47fc0 100644 --- a/vendor/github.com/blevesearch/bleve/search/sort.go +++ b/vendor/github.com/blevesearch/bleve/v2/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/vendor/github.com/blevesearch/bleve/search/util.go b/vendor/github.com/blevesearch/bleve/v2/search/util.go index 19dd5d68bd..19dd5d68bd 100644 --- a/vendor/github.com/blevesearch/bleve/search/util.go +++ b/vendor/github.com/blevesearch/bleve/v2/search/util.go diff --git a/vendor/github.com/blevesearch/bleve/size/sizes.go b/vendor/github.com/blevesearch/bleve/v2/size/sizes.go index 0990bf86ec..0990bf86ec 100644 --- a/vendor/github.com/blevesearch/bleve/size/sizes.go +++ b/vendor/github.com/blevesearch/bleve/v2/size/sizes.go |