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

feat: [2.4]add page retain order for range search #816

Open
wants to merge 1 commit into
base: v2.4.x
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions entity/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ type SearchParam interface {
Params() map[string]interface{}
AddRadius(radius float64)
AddRangeFilter(rangeFilter float64)
AddPageRetainOrder(pageRetainOrder bool)
}

type baseSearchParams struct {
Expand All @@ -111,6 +112,10 @@ func (sp *baseSearchParams) AddRangeFilter(rangeFilter float64) {
sp.params["range_filter"] = rangeFilter
}

func (sp *baseSearchParams) AddPageRetainOrder(pageRetainOrder bool) {
sp.params["page_retain_order"] = pageRetainOrder
}

func newBaseSearchParams() baseSearchParams {
return baseSearchParams{
params: make(map[string]interface{}),
Expand Down
6 changes: 6 additions & 0 deletions entity/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ func TestAddRangeFilter(t *testing.T) {
assert.Equal(t, params.Params()["range_filter"], float64(20))
}

func TestPageRetainOrder(t *testing.T) {
params := newBaseSearchParams()
params.AddPageRetainOrder(true)
assert.Equal(t, params.Params()["page_retain_order"], true)
}

func TestIndexGPUCagra(t *testing.T) {
t.Run("index", func(t *testing.T) {
index, err := NewIndexGPUCagra(L2, 64, 64)
Expand Down
Loading