Skip to content

Conversation

haydenhoang
Copy link
Contributor

@haydenhoang haydenhoang commented Jul 10, 2024

Change Summary

  • [Breaking Change] Single document index methods now have another parameter for specifying dirty values behavior.
client.Collection("companies").Documents().Create(context.Background(), document, &api.DocumentIndexParameters{DirtyValues: pointer.Any(api.CoerceOrDrop)})
client.Collection("companies").Documents().Upsert(context.Background(), document, &api.DocumentIndexParameters{DirtyValues: pointer.Any(api.CoerceOrDrop)})
client.Collection("companies").Document("123").Update(context.Background(), document, &api.DocumentIndexParameters{DirtyValues: pointer.Any(api.CoerceOrDrop)})
  • [Breaking Change] We can now control the result of the export through an additional parameter *api.ExportDocumentsParams.
client.Collection("companies").Documents().Export(context.Background(), &api.ExportDocumentsParams{
		FilterBy:      pointer.String("num_employees>:1000"),
		IncludeFields: pointer.String("name"),
		ExcludeFields: pointer.String("year"),
	})
  • [Breaking Change] The import Action type is now an enum instead of *string.
&api.ImportDocumentsParams{
	//	Action:    pointer.String("create"),
	Action:    pointer.Any(api.Create),
}
  • [Breaking Change] Override rule Query and Match field are now optional.
api.SearchOverrideRule{
    // before
    // Query: "apple",
    // Match: "exact",
    Query: pointer.String("apple"),
    Match: pointer.Any(api.Exact),
}

Features:

  • Added Analytics and Conversation APIs, update override and search parameters.
  • Added a generic pointer.Any() helper function which can turn any type into a pointer. This is especially useful when the param is of enum type.
// before
var upsertAction api.IndexDocumentParamsAction = "upsert"
&api.IndexDocumentParams{
		Action:      &upsertAction,
}
// after
&api.IndexDocumentParams{
		Action:      pointer.Any(api.Upsert),
}

PR Checklist

@haydenhoang haydenhoang marked this pull request as draft July 10, 2024 11:17
@haydenhoang haydenhoang changed the title Add support for conversations API Add support for conversations & analytics APIs, allow specification of dirty values behaviors and export option Oct 3, 2024
@haydenhoang haydenhoang marked this pull request as ready for review October 3, 2024 15:42
@kishorenc kishorenc merged commit f3e98fa into typesense:master Oct 6, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants