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

Add support for OR #9

Closed
cmoralesweb opened this issue Aug 21, 2015 · 3 comments
Closed

Add support for OR #9

cmoralesweb opened this issue Aug 21, 2015 · 3 comments

Comments

@cmoralesweb
Copy link

Some of my models have translated fields, like so:

'title-es',
'title-en',
'text-es',
'text-en'

I put them all on the index config, but I want the search to be language-dependent (if the user has Spanish selected, only results matching title-es / text-es should appear, not the ones for -en

where()accepts a single field, and if you combine a couple of where() the query runs with AND. I'd need a OR in my case.

... or perhaps there's another way that I'm missing 😄

@nqxcode
Copy link
Owner

nqxcode commented Aug 21, 2015

You use 'query builder' to make query and 'query builder' has no orWhere method yet.
But you can use raw queries (Lucene queries) without using the 'query builder'.

For example: Search::rawQuery('field1:"value1" OR field2:"value2"')->get();

@cmoralesweb
Copy link
Author

OK! 👍

orWhere() would be a nice addition to the query builder, then.

@nqxcode nqxcode added wontfix and removed wontfix labels Sep 8, 2015
@nqxcode nqxcode closed this as completed Nov 8, 2015
@nqxcode nqxcode reopened this Nov 14, 2015
@nqxcode
Copy link
Owner

nqxcode commented Jan 24, 2016

Search by name OR description: Search::where(['name', 'description'], 'clock');

@nqxcode nqxcode closed this as completed Jan 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants