diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bc81391..496c91e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,7 @@ jobs: test: strategy: matrix: - go-version: [1.19.x, 1.20.x, 1.21.x] + go-version: [1.20.x, 1.21.x, 1.22.x] platform: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.platform }} steps: diff --git a/go.mod b/go.mod index 26a78c4..8c0a530 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/blevesearch/bleve_index_api -go 1.20 +go 1.21 diff --git a/index.go b/index.go index 4d8ecd3..f792da5 100644 --- a/index.go +++ b/index.go @@ -240,6 +240,7 @@ type FieldDict interface { Next() (*DictEntry, error) Close() error + Cardinality() int BytesRead() uint64 } diff --git a/indexing_options.go b/indexing_options.go index 9724cca..a587ded 100644 --- a/indexing_options.go +++ b/indexing_options.go @@ -24,6 +24,21 @@ const ( SkipFreqNorm ) +const ( + BM25Scoring = "bm25" + TFIDFScoring = "tfidf" +) + +// Scoring model indicates the algorithm used to rank documents fetched +// for a query performed on a text field. +const DefaultScoringModel = TFIDFScoring + +// Supported similarity models +var SupportedScoringModels = map[string]struct{}{ + BM25Scoring: {}, + TFIDFScoring: {}, +} + func (o FieldIndexingOptions) IsIndexed() bool { return o&IndexField != 0 } diff --git a/vector.go b/vector.go index c1b5837..1057cf9 100644 --- a/vector.go +++ b/vector.go @@ -37,10 +37,10 @@ const ( CosineSimilarity = "cosine" ) -const DefaultSimilarityMetric = EuclideanDistance +const DefaultVectorSimilarityMetric = EuclideanDistance // Supported similarity metrics for vector fields -var SupportedSimilarityMetrics = map[string]struct{}{ +var SupportedVectorSimilarityMetrics = map[string]struct{}{ EuclideanDistance: {}, InnerProduct: {}, CosineSimilarity: {},