Skip to content

Remove collection_name field when indexing or updating#78

Merged
jaeyson merged 3 commits into
mainfrom
77-updating-document-from-map-adds-collection_name-field-to-document
May 11, 2025
Merged

Remove collection_name field when indexing or updating#78
jaeyson merged 3 commits into
mainfrom
77-updating-document-from-map-adds-collection_name-field-to-document

Conversation

@jaeyson
Copy link
Copy Markdown
Owner

@jaeyson jaeyson commented May 10, 2025

Fixes #77

Summary by Sourcery

Ensure collection_name is not included in document data when indexing or updating, aligning with expected API behavior and preventing storage of extraneous fields.

Bug Fixes:

  • Remove collection_name field from documents before indexing or updating to prevent unintended data storage.

Tests:

  • Update tests to reflect removal of collection_name from indexed documents.

@jaeyson jaeyson self-assigned this May 10, 2025
@jaeyson jaeyson added the bug Something isn't working label May 10, 2025
@jaeyson jaeyson linked an issue May 10, 2025 that may be closed by this pull request
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 10, 2025

Reviewer's Guide

This PR ensures the 'collection_name' field is removed from document maps before indexing or updating, and updates related tests to match the new behavior.

File-Level Changes

Change Details Files
Remove 'collection_name' field from document bodies before indexing or updating.
  • Drop 'collection_name' (string or atom) from document map in index_document/4 before sending to API.
  • Drop 'collection_name' (string or atom) from document map in update_document/4 before sending to API.
lib/ex_typesense/document.ex
Update tests to reflect removal of 'collection_name' from indexed document response.
  • Adjust test assertions to no longer expect 'collection_name' in response from index_document.
  • Update get_document test to use original document's collection_name.
test/document_test.exs

Assessment against linked issues

Issue Objective Addressed Explanation
#77 When updating a document via a map, the collection_name field should not be added to the document if it wasn't there before.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @jaeyson - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@jaeyson jaeyson moved this to In Progress in ExTypesense May 11, 2025
@jaeyson jaeyson merged commit 90b2d05 into main May 11, 2025
10 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in ExTypesense May 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Updating document from map adds collection_name field to document

1 participant