-
Notifications
You must be signed in to change notification settings - Fork 230
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
Feature Request: Default search parameter #2189
Comments
I had similar problem too. Below is what I have been doing:
This approach works well for me so far. |
This is what we do as well.
…On Sat, Jul 10, 2021 at 8:16 AM Thai Ngo ***@***.***> wrote:
I had similar problem too. Below is what I have been doing:
1. for each of the use-cases, implement a FilterExpressionCheck
2. combine these checks in respective entities' read permissions
This approach works well for me so far.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2189 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABVH6QMDTSCB3NJUGXBEPFDTXBB4HANCNFSM5ACJFHXQ>
.
|
How do you make the FilterExpressionCheck not apply if the user provides his own value? |
Not ideal, but the method: public abstract FilterExpression getFilterExpression(Type<?> entityClass, RequestScope requestScope); takes a RequestScope. If cast to the internal version of this class (https://github.com/yahoo/elide/blob/master/elide-core/src/main/java/com/yahoo/elide/core/RequestScope.java), you can access the EntityProjection which will include the client provided You can use this filter expression to determine whether to return an actual expression or just a This will only work in JSON-API as GraphQL has a more complex request structure and uses a different RequestScope class. Do you have any suggestions for how you would like this to work? |
From my "consumer" perspective I'd like to have an additional annotation |
I can see two ways this could work. The default filter expression is a templated RSQL expression: @DefaultFilter("book.title=='foo'") Or with templates: @DefaultFilter("book.createdDate=gt='{{dateMath \\"now\\" \\"-1y\\"}}'") Since we are filtering a collection, I'm not sure we need a context object here. The other alternative is for Thoughts? I think option 1 might be best. |
At FAForever are currently dealing with database load problems due to the increasing amount of data over the years and suboptimal queries from outside consumers (since our API is public).
A potential step for this solution would be predefined parameters (static or dynamic).
Here are few business cases to explain why this makes sense:
This would reduce the load on unoptimized queries and would also work well together with partitioning of tables. E.g. partition 50 million games by year, using a default parameter all queries would operate on the latest partition by default only.
PS: I know parts of that can be achieved by duplicating the hibernate entity and using @where clause, but I think that is less flexible in terms of querying and more complex for the developer.
Feedback is appreciated. Hints for implementations as well.
The text was updated successfully, but these errors were encountered: