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

feat: add total count to search responses #1232

Merged
merged 2 commits into from Nov 1, 2023
Merged

Conversation

eemmiillyy
Copy link
Contributor

@eemmiillyy eemmiillyy commented Oct 31, 2023

This PR adds the totalCount field to search responses (search,search.byTable, search.all, and vectorSearch)

It contains breaking changes to the search APIs as the response is no longer an array, but an object, for example:

{ records: [], totalCount: 1 }

Note that: search.byTable returns a records object rather than an records array. Each table name is a key pointing to an array, for example:

{ records: { users: [], posts: [] }, totalCount: 1 }

Resolves #1081

@eemmiillyy eemmiillyy requested a review from a team as a code owner October 31, 2023 10:39
@changeset-bot
Copy link

changeset-bot bot commented Oct 31, 2023

🦋 Changeset detected

Latest commit: ffcf6cb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@xata.io/client Minor
@xata.io/cli Patch
@xata.io/codegen Minor
@xata.io/importer Patch
@xata.io/plugin-client-cache Patch
@xata.io/plugin-client-cloudflare Patch
@xata.io/drizzle Patch
@xata.io/kysely Patch
@xata.io/netlify Patch
@xata.io/plugin-client-opentelemetry Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Oct 31, 2023

size-limit report 📦

Path Size
packages/client/dist/index.mjs 17.97 KB (+0.22% 🔺)
packages/client/dist/index.cjs 19.32 KB (+0.23% 🔺)
packages/codegen/dist/index.mjs 2.58 MB (+0.01% 🔺)
packages/codegen/dist/index.cjs 2.58 MB (+0.01% 🔺)

@github-actions
Copy link
Contributor

github-actions bot commented Oct 31, 2023

Your pull request has been published to npm.

You can install @xata.io/client by running:

npm install @xata.io/client@0.0.0-alpha.vbeea5f5

Other packages are published like this:

npm install @xata.io/mypackage@0.0.0-alpha.vbeea5f5

To test the CLI, run:

npx @xata.io/cli@0.0.0-alpha.vbeea5f5

@SferaDev
Copy link
Member

SferaDev commented Oct 31, 2023

I'll fully review it on Thursday when I'm back. Only concern is in byTable what happens if I have a table called totalCount?

@eemmiillyy
Copy link
Contributor Author

@SferaDev Yeah that's a good point, I've now nested under records: {...} to avoid this edge case

@eemmiillyy eemmiillyy added this pull request to the merge queue Nov 1, 2023
Merged via the queue into main with commit d282d18 Nov 1, 2023
6 checks passed
@eemmiillyy eemmiillyy deleted the feat/total-count branch November 1, 2023 08:43
@xata-bot xata-bot mentioned this pull request Nov 1, 2023
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.

Support totalCount in search response
2 participants