Collection filter for cache results

In order to improve performance on a larger collection with complex business rules for loading items, we thought about introducing in-memory cache.

But there’s a problem with frequent filter condition updates: any time user adds and/or removes search conditions, that changes results of SQL and leads to the database queries.

Is there’s a way to somehow translate collection filter into predicate usable in Array.filter() or something like that?

Hello @Vasilii !

Really great initiative. I’m currently making a Woodshop article on Elasticsearch. We had a similar use case: How to translate filters generated from the Front to some filters comestible by Elasticsearch queries.

In you’re case you will have use our custom filterTranslator by changing the Elasticsearch logic on you’re own logic (function comestible by Array.filter() I presume).

Since the article is not released yet. I propose you to update this thread once it’s released. Or let me know if you need a code snippet really soon I will be able to give you that.

Have a nice day