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

Add support for conversations & analytics APIs, allow specification of dirty values behaviors and export option #171

Merged
merged 19 commits into from
Oct 6, 2024

Conversation

phiHero
Copy link
Contributor

@phiHero phiHero 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

@phiHero phiHero marked this pull request as draft July 10, 2024 11:17
@phiHero phiHero 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
@phiHero phiHero 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