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 'not' queries with @search endpoint. #1752

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

maethu
Copy link

@maethu maethu commented Feb 20, 2024

This PR adds support to exclude certain items from the result set using not for DateIndex, FieldIndex and KeywordIndex.

Example request:

GET /Plone/@search?Subject.not=important&path.query=%2FPlone&path.depth=-1 HTTP/1.1

Returns all items not having the subject "important".

Only works with Plone 6

@mister-roboto
Copy link

@maethu thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

Copy link

netlify bot commented Feb 20, 2024

Deploy Preview for plone-restapi canceled.

Name Link
🔨 Latest commit 7c26758
🔍 Latest deploy log https://app.netlify.com/sites/plone-restapi/deploys/65d50902a57a6d00080c4ec1

@maethu maethu force-pushed the mle-support-not-queries-in-search branch from 35334f6 to 95834e9 Compare February 20, 2024 20:07
@maethu maethu force-pushed the mle-support-not-queries-in-search branch from 95834e9 to 7c26758 Compare February 20, 2024 20:18
Copy link
Sponsor Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

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

@maethu This is already supported by the @querystring-search endpoint using the isNot and none operations (see plone/plone.app.querystring#110). Is there a reason it's needed for the @search endpoint as well?

@maethu
Copy link
Author

maethu commented Feb 20, 2024

@maethu This is already supported by the @querystring-search endpoint using the isNot and none operations (see plone/plone.app.querystring#110). Is there a reason it's needed for the @search endpoint as well?

Thanks very much, @davisagli, I'm aware of that. On my project, I use the @search endpoint for my search form because the form state management requires much less code via @search endpoint than it does via @querystring-search. I also don't have to update a deeply nested state. On top, it's a way more readable URL, mostly because it's shorter.

No hard feelings if it does not make sense in plone.restapi. I can keep my patch in my project. I just thought maybe it would make sense to give this upstream.

@maethu maethu marked this pull request as ready for review February 20, 2024 20:30
@maethu
Copy link
Author

maethu commented Feb 20, 2024

@jenkins-plone-org please run jobs

@davisagli
Copy link
Sponsor Member

@maethu Thanks, I'll take another look and also ask @tisto for his opinion. If we do decide to add it, it will need documentation.

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.

None yet

3 participants