diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 460f0e7..b8847b1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest services: typesense: - image: typesense/typesense:26.0 + image: typesense/typesense:27.0 ports: - 8108:8108/tcp volumes: diff --git a/typesense/api/pointer/pointer.go b/typesense/api/pointer/pointer.go index 54195a0..d6feb14 100644 --- a/typesense/api/pointer/pointer.go +++ b/typesense/api/pointer/pointer.go @@ -33,6 +33,7 @@ func Interface(v interface{}) *interface{} { func String(v string) *string { return &v } + func Any[T any](v T) *T { return &v } diff --git a/typesense/overrides_test.go b/typesense/overrides_test.go index 3278fb1..14318a0 100644 --- a/typesense/overrides_test.go +++ b/typesense/overrides_test.go @@ -18,8 +18,8 @@ import ( func createNewSearchOverrideSchema() *api.SearchOverrideSchema { return &api.SearchOverrideSchema{ Rule: api.SearchOverrideRule{ - Query: "apple", - Match: "exact", + Query: pointer.String("apple"), + Match: pointer.Any(api.Exact), }, Includes: &[]api.SearchOverrideInclude{ { diff --git a/typesense/test/dbhelpers_test.go b/typesense/test/dbhelpers_test.go index ff695ee..e59b3f5 100644 --- a/typesense/test/dbhelpers_test.go +++ b/typesense/test/dbhelpers_test.go @@ -56,6 +56,7 @@ func expectedNewCollection(name string) *api.CollectionResponse { Locale: pointer.String(""), Sort: pointer.False(), Drop: nil, + Store: pointer.True(), }, { Name: "num_employees", @@ -67,6 +68,7 @@ func expectedNewCollection(name string) *api.CollectionResponse { Locale: pointer.String(""), Sort: pointer.True(), Drop: nil, + Store: pointer.True(), }, { Name: "country", @@ -78,6 +80,7 @@ func expectedNewCollection(name string) *api.CollectionResponse { Locale: pointer.String(""), Sort: pointer.False(), Drop: nil, + Store: pointer.True(), }, }, EnableNestedFields: pointer.False(), @@ -191,7 +194,7 @@ func newSearchOverrideSchema() *api.SearchOverrideSchema { schema := &api.SearchOverrideSchema{ Rule: api.SearchOverrideRule{ Query: pointer.String("apple"), - Match: (*api.SearchOverrideRuleMatch)(pointer.String("exact")), + Match: pointer.Any(api.Exact), }, Includes: &[]api.SearchOverrideInclude{ { @@ -209,6 +212,8 @@ func newSearchOverrideSchema() *api.SearchOverrideSchema { }, }, RemoveMatchedTokens: pointer.True(), + FilterCuratedHits: pointer.False(), + StopProcessing: pointer.True(), } return schema @@ -219,7 +224,7 @@ func newSearchOverride(overrideID string) *api.SearchOverride { Id: pointer.String(overrideID), Rule: api.SearchOverrideRule{ Query: pointer.String("apple"), - Match: (*api.SearchOverrideRuleMatch)(pointer.String("exact")), + Match: pointer.Any(api.Exact), }, Includes: &[]api.SearchOverrideInclude{ { @@ -237,6 +242,8 @@ func newSearchOverride(overrideID string) *api.SearchOverride { }, }, RemoveMatchedTokens: pointer.True(), + FilterCuratedHits: pointer.False(), + StopProcessing: pointer.True(), } } diff --git a/typesense/test/overrides_test.go b/typesense/test/overrides_test.go index 14e6abf..54cb7a0 100644 --- a/typesense/test/overrides_test.go +++ b/typesense/test/overrides_test.go @@ -10,6 +10,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/typesense/typesense-go/v2/typesense/api" + "github.com/typesense/typesense-go/v2/typesense/api/pointer" ) func TestSearchOverrideUpsertNewOverride(t *testing.T) { @@ -33,14 +34,14 @@ func TestSearchOverrideUpsertExistingOverride(t *testing.T) { collectionName := createNewCollection(t, "companies") overrideID := newUUIDName("customize-apple") expectedResult := newSearchOverride(overrideID) - expectedResult.Rule.Match = "contains" + expectedResult.Rule.Match = pointer.Any(api.Contains) body := newSearchOverrideSchema() - body.Rule.Match = "exact" + body.Rule.Match = pointer.Any(api.Exact) _, err := typesenseClient.Collection(collectionName).Overrides().Upsert(context.Background(), overrideID, body) require.NoError(t, err) - body.Rule.Match = "contains" + body.Rule.Match = pointer.Any(api.Contains) result, err := typesenseClient.Collection(collectionName).Overrides().Upsert(context.Background(), overrideID, body)