Skip to content
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

OR with different criteria #6

Open
sunflowerlab opened this issue Dec 6, 2015 · 4 comments
Open

OR with different criteria #6

sunflowerlab opened this issue Dec 6, 2015 · 4 comments

Comments

@sunflowerlab
Copy link

Hi, I have just started using your extension and let me tell you. Its working perfectly. You saved lots of my time. I have unique requirement and see if this can be achieve using your extension.

I want to do OR on same property but with different options like "StartsWith", "EndsWtih" etc.

for Example.

var result = queryableData.Search(x => x.Property1)
.StartsWith("abc")
.Containing("mno");

On above code get all property1 where its either startwith "abc" or contains "mno".

I think current implementation does AND. Is there any way i can achieve this?

Thanks

@ninjanye
Copy link
Owner

Hi @sunflowerlab

Really sorry it has taken me this long to reply, I completely missed this issue arrive. I will look into this and see what is possible as currently, as you rightly say, the code sample above will produce and AND join.

Speak soon

@ninjanye
Copy link
Owner

@sunflowerlab, As a workaround, you could implement something like:

var startsWith = TestModels.Search(p => p.StringOne)
                           .StartsWith("abc");
var contains = TestModels.Search(p => p.StringOne)
                         .Containing("xyz");

It does mean performing 2 queries which I know is not ideal, but i might get you over this hump.

I will look at how this could be properly supported in SearchExtensions.

@wouter-b
Copy link

Any news on this issue?

@eLPe21
Copy link

eLPe21 commented Mar 1, 2022

I came here looking for similar,
data = data.Search(x => x.StringProperty).Containing(list.Where(x => x.ToIntDef(0) == 0).ToArray());
data = data.Search(x => x.IntegerProperty).EqualTo(276, 1001);
I would like to OR that !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants