Skip to content

Commit

Permalink
MB-58901: BM25 related constructs and API changes (#59)
Browse files Browse the repository at this point in the history
Co-authored-by: Abhinav Dangeti <abhinav@couchbase.com>
  • Loading branch information
Thejas-bhat and abhinavdangeti authored Jan 7, 2025
1 parent bc5aa25 commit f54d76f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.19.x, 1.20.x, 1.21.x]
go-version: [1.20.x, 1.21.x, 1.22.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/blevesearch/bleve_index_api

go 1.20
go 1.21
1 change: 1 addition & 0 deletions index.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ type FieldDict interface {
Next() (*DictEntry, error)
Close() error

Cardinality() int
BytesRead() uint64
}

Expand Down
15 changes: 15 additions & 0 deletions indexing_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions vector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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: {},
Expand Down

0 comments on commit f54d76f

Please # to comment.