Skip to content

Conversation

@silverbackdan
Copy link
Contributor

@silverbackdan silverbackdan commented Dec 29, 2020

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tickets n/a
License MIT
Doc PR TBC (api-platform/docs#...)

This is a WIP to implement a search filter which will allow a user to query multiple fields of an entity using the syntax or[field1,field2]=searchValue

To do:

  • Tests
  • Docs PR
  • RFC on mapping fields and values.

The RFC part may end up as a separate PR. I my application I wanted to query a computed field and then map this back to a database query. The computed field is displayCurationStatus and the mapped database field is curationStatus. Internally the project I was working on needed to store more status levels, however for the external application this is reduced to just a few. For example if displayCurationStatus is queried with the value published, we wanted to be returning both statuses ready and published from the curationStatus field of the resource. I don't think how I've adjusted this in my first attempt of this PR is flexible or configurable without lots of effort.

I wanted to submit now as I find limited time and shows that the work has been started and a place for discussion.

@alanpoulain
Copy link
Member

alanpoulain commented Dec 29, 2020

Hello. Thank you for the PR but did you see #2400? The aim would be to have a general search filter, not just and/or.

@silverbackdan
Copy link
Contributor Author

I had not seen that, sorry for my oversight - looks like it'll be great!

@silverbackdan
Copy link
Contributor Author

While I've closed this because it is an alternative method to the linked issue, the issue appears to be stale in regards to the really nice flexible approach due to Doctrine not being 'composable'. This may be a useful feature while the issues there are resolved (?)

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