Replies: 1 comment 4 replies
-
I think I may have been thinking about this entirely the wrong way, and that a custom FilterBinder will do what I'm after. Talk about getting tunnel vision... |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This may seem like a bit of an odd one, but it could have a huge impact on performance for me, so may be useful for others.
For one of my entities I'm using a SQL full text index contains. As (to my knowledge at least) there's no way of specifying this using standard OData functions, I'm using a custom query string parameter.
Currently I effectively have something like this:
ctx.SomeEntity.Where(e => EF.Functions.Contains(e.Text, someText)).GetQuery(mapper, opts);
This gets me the results I'm after, but the issue with this is that the translated SQL query performs the full text search before everything else, resulting in a huge performance hit.
Now, I can do something like this:
However the issue is that pagination has already been applied, so it will only only be searching within the current page of results.
I haven't been able to find away to modify what's in the ODataQueryOptions to allow me to split things up (eg: apply ODataQueryOptions's select/expand/filter via one GetQuery, make my own modifications, then apply another ODataQueryOptions's take/skip/count via another GetQuery), nor am I aware of a way to extend the OData functions to allow me to specify usage of a full text index contains.
I'm not really sure what the best way of supplying a query modification would be (eg: Does it make sense to have some options in the QuerySettings?), or if there's a better way to achieve what I'm after, so hoping to start this discussion to see what approaches we can come up with.
Beta Was this translation helpful? Give feedback.
All reactions