Skip to content

Commit

Permalink
feat: [2.4]add page retain order for range search (#816)
Browse files Browse the repository at this point in the history
issue: milvus-io/milvus#35464

Signed-off-by: Patrick Weizhi Xu <[email protected]>
(cherry picked from commit a1f6fff)

Signed-off-by: Patrick Weizhi Xu <[email protected]>
  • Loading branch information
PwzXxm authored Nov 27, 2024
1 parent 564e928 commit c00ec06
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 c00ec06

Please sign in to comment.