feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
15.03k stars 748 forks source link

memory - Allow custom sift options #2910

Open DaddyWarbucks opened 1 year ago

DaddyWarbucks commented 1 year ago

Sift allows a second argument of options which can include custom operators, etc. Similar to other database adapters that accept some database config, I think we should allows this adapter to accept params.matcher. Then Sift configuration can happen on each call.

I am aware that the service options takes a matcher option and I can use a custom Sift here. But that is statically set and cannot change per service call.

This should be as simple as updating https://github.com/feathersjs/feathers/blob/9f712bf5694ceb7b47e3c7ab68a30c8a8cec3faa/packages/memory/src/index.ts#L91 to

const matcher = this.options.matcher(query, params.matcher)
daffl commented 1 year ago

Sounds good to me, I'd merge a PR with those changes and according documentation updates.