Comments (4)
Hi @sebdm,
I think this is not a bug, but rather a design choice; in this case, your parenthesis is redundant.
when you don't use any parenthesis by default you get something like the below query:
var query = list.Where(q => q.subList.Any(w=> w.field == value) && q.subList.Any(w=> w.field2 == value2) );
but sometimes we want both conditions inside the Any
function. like:
var query = list.Where(q => q.subList.Any(w=> w.field == value && w.field2 == value2) );
So we can use a pair of parenthesis to group two conditions in one expression. (field=value1,field2=value2)
.
if you want to have separate expressions with parenthesis you have to add another set of parenthesis around each part. (field=value1),(field2=value2)
PS. I didn't test this fully yet,
Let me know if you solved the problem or not.
from gridify.
First of all, thanks for your quick response (and for a great library :))
These do what I want:
field=value1,field=value2
(field=value1),(field=value2)
These don't:
(field=value1,field=value2)
((field=value1),(field=value2))
So basically this is limiting me a bit when it comes to some edge cases.
Maybe it would be more clear with a different operator for "IN", e g:
field IN value1,value2
Or perhaps even cleaner if I didn't need to map the nested field to the top-level at all, e g:
child.field IN value1,value2
Or for multiple where's on the same IN:
child.field as F IN f>lower,f<upper
These are just ideas off the top of my head. I realize that implementing this in expression trees is far from trivial (not my expertise anyway :/)
I can, for now, in this particular case, just remove the parentheses altogether, but I can see other potential cases when that wouldn't be a viable solution due to this ambiguity.
from gridify.
These are just ideas off the top of my head. I realize that implementing this in expression trees is far from trivial (not my expertise anyway :/)
I can, for now, in this particular case, just remove the parentheses altogether, but I can see other potential cases when that wouldn't be a viable solution due to this ambiguity.
To make the edge cases clear it would be great if you can provide a LINQ version of the query that is not supported by gridify,
because after all, I'm trying to convert a small query language to a LINQ expression, So far I managed to pass the tests of all possible scenarios that came to my mind but because it's the complexity I won't be surprised if still there are other edge cases that I missed.
Also, I should admit that parenthesis in sublists behaves differently, probably I should've documented it better.
In the end, If you found any edge case that is not supported yet, I'll be happy to add it to the library.
Thanks
from gridify.
Maybe it would be more clear with a different operator for "IN", e g:
field IN value1,value2
I forget this one. This is a good idea to somehow support parenthesis only for values ( filed=(value1,value2)
) but I haven't done that because this way you have to deal with a lot of escape characters.
although with the custom operators feature, you can implement your own IN
if you need it.
from gridify.
Related Issues (20)
- Update documentation site dependencies (Vuepress2)
- Gridify.Elasticsearch generate DSL query (non-generic) HOT 3
- JavaScript client library HOT 3
- Creating an Abstractions Layer for Gridify
- Error "Specified method is not supported" when querying the Nested List field in Elasticsearch HOT 2
- DateTime Kind and PostgreSQL HOT 13
- IN style operator HOT 5
- Support for. NET8 HOT 4
- NativeAOT support
- Why library can not resolve IGridifyMapper<T> default in DbContext.ServiceProvider if exists HOT 1
- GRPC Support HOT 2
- Comparing data between two fields rather than using hardcoded values
- Cleanup dependencies HOT 2
- Filtering based on IDictionary values
- Passing filter value on CustomOperator Expression creation - for ContainsAny operator HOT 10
- Support automatic mapping generation for list of primitives
- Filtering for null/empty case insensitive HOT 3
- EntityFramework filtering with Many to Many case
- Concurrently changing GridifyGlobalConfigurations causes inconsistent behavior
- Add support generating conditions with Index or Key in gridify-client
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gridify.