Attempt to allow fuzzy-match filter in json-api #71
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
with regard to #60, I started implementing, or rather, looking for ways to implement extensions on the current filtering possibilities.
Some notes
General
Here, I wanted fuzzy text search on a String attribute. I validated this against the fortune-postgres, which needed to be extened too.
You may find the relevant commit here: cecemel/fortune-postgres@e804615. I didn't start a PR for this one yet. I just want first to make sure we agree on interface and how the query is passed down through all layers.
So I consider this PR a base for discussion.
Regarding integration into fortune.js
I am unsure what field of
request.options
may be used. The fortune-postgres seemed to already use thequery
field, of which at first sight seemed to be the wanted escape hatch, so I didn't feel like using this.So, as I understand it,
Adapter.find
leaves the possibility of extra fields on the options object unspecified. Therefore, I addedfuzzyMatch
on the options object.Regarding validity JSON:API
Filtering is relatively unspecified. As such, I assume the extra filter
type is legal.