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

Support passing dict to add JSON field #158

Merged
merged 1 commit into from
Nov 21, 2023
Merged

Conversation

GodTamIt
Copy link
Contributor

This allows you to now do the following:

doc.add_json(
    "attributes",
    {
        "order": 1.2,
        "target": "submit-button",
        "cart": {"product_id": 133},
        "description": "das keyboard",
    },
)

It also fixes a panic that occurs when passing valid JSON that is not a map, originating here

cjrh
cjrh previously requested changes Nov 20, 2023
Copy link
Collaborator

@cjrh cjrh left a comment

Choose a reason for hiding this comment

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

This is great, I think it will be quite useful to be able to work with dicts directly. I'd prefer json and dict to be handled in separate methods though.

What do you think?

src/document.rs Show resolved Hide resolved
@GodTamIt GodTamIt changed the title Support passing dict to add_json_field() Support passing dict to add JSON field Nov 21, 2023
@GodTamIt GodTamIt requested a review from cjrh November 21, 2023 02:36
@cjrh cjrh dismissed their stale review November 21, 2023 11:59

My comment was invalid

Copy link
Collaborator

@cjrh cjrh left a comment

Choose a reason for hiding this comment

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

Thanks!

@cjrh cjrh merged commit adfdae0 into quickwit-oss:master Nov 21, 2023
10 checks passed
@GodTamIt GodTamIt deleted the json-dict branch November 21, 2023 20:22
Sidhant29 pushed a commit to Sidhant29/tantivy-py that referenced this pull request Mar 12, 2024
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Caleb Hattingh <caleb.hattingh@gmail.com>
Co-authored-by: Adam Reichold <adamreichold@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Justin Greene <justin.greene@intouchsol.com>
Co-authored-by: Paul Masurel <paul@quickwit.io>
Co-authored-by: Pratyush Mittal <pratyushmittal@gmail.com>
Co-authored-by: mukeshsahnis <er.mks89@gmail.com>
Co-authored-by: Stone <47559019+st1020@users.noreply.github.com>
Co-authored-by: Chris Tam <ohgodtamit@gmail.com>
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