Skip to content

Commit

Permalink
feat: add page retain order
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Weizhi Xu <weizhi.xu@zilliz.com>
  • Loading branch information
PwzXxm committed Aug 30, 2024
1 parent bd99cd1 commit ba88354
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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

0 comments on commit ba88354

Please sign in to comment.