Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record number of successful kNN Search operations #1973

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions index/scorch/optimize_knn.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package scorch
import (
"fmt"
"sync"
"sync/atomic"

index "github.com/blevesearch/bleve_index_api"
segment_api "github.com/blevesearch/scorch_segment_api/v2"
Expand Down Expand Up @@ -75,6 +76,8 @@ func (o *OptimizeVR) Finish() error {
return
}

atomic.AddUint64(&o.snapshot.parent.stats.TotKNNSearches, uint64(1))

// postings and iterators are already alloc'ed when
// IndexSnapshotVectorReader is created
vr.postings[index] = pl
Expand Down
2 changes: 2 additions & 0 deletions index/scorch/scorch.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,8 @@ func (s *Scorch) StatsMap() map[string]interface{} {
m["index_time"] = m["TotIndexTime"]
m["term_searchers_started"] = m["TotTermSearchersStarted"]
m["term_searchers_finished"] = m["TotTermSearchersFinished"]
m["knn_searches"] = m["TotKNNSearches"]

m["num_bytes_read_at_query_time"] = m["TotBytesReadAtQueryTime"]
m["num_plain_text_bytes_indexed"] = m["TotIndexedPlainTextBytes"]
m["num_bytes_written_at_index_time"] = m["TotBytesWrittenAtIndexTime"]
Expand Down
2 changes: 2 additions & 0 deletions index/scorch/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ type Stats struct {
TotTermSearchersStarted uint64
TotTermSearchersFinished uint64

TotKNNSearches uint64

TotEventTriggerStarted uint64
TotEventTriggerCompleted uint64

Expand Down
Loading