Hi Vincent,
CC'ing user@gora for visibility. I've been on vacation (and still am) so
apologies for slow response.

I am not sure that the example AND query you've provided is actually an AND
query! It reads as an OR conditional query to me.
Never-the-less, in order to satisfy your Query conditions you could use the
FilterList.Operator.MUST_PASS_ONE syntax over the compiled list of
SingleFieldValueFilter's. The AND and OR Enum's can be located here.
https://github.com/apache/gora/blob/master/gora-core/src/main/java/org/apache/gora/filter/FilterList.java#L33-L38

Right now I _think_ that it is not possible to do BETWEEN queries. You can
see the list of Operands currently available here
https://github.com/apache/gora/blob/master/gora-core/src/main/java/org/apache/gora/filter/FilterOp.java

Finally, you can always check out the tests we currently have in the test
suite for Gora
https://github.com/apache/gora/tree/master/gora-core/src/test/java/org/apache/gora/filter
If you think that any filter should include better/more tests then by all
means please log a Jira ticket and send us a pull request. They are always
appreciated.
If you have some further queries on this topic then please get in touch and
we can help you out.
hth
Lewis

On Mon, Dec 21, 2015 at 12:26 AM, Vincent Reniers <
vincent.reni...@cs.kuleuven.be> wrote:

> Dear Mr. McGibbney,
>
> I saw on GitHub you have quite the experience with Apache Gora.
>
> Maybe you can help me out as I’m trying to figure something out which
> isn’t clearly documented.
>
> I’m trying to do an AND query in Apache Gora. For example in SQL this
> would be:
> "Select p from Person p WHERE p.firstName = :firstname OR p.lastName =
> :last name”
>
> Right now I’ve managed to do a query on a single secondary field by making
> use of the
> SingleFieldValueFilter and executing the Query. But I can’t find out if it
> is possible to apply
> a filter on multiple fields at the same time or even do a BETWEEN query.
>
> Here’s an excerpt of my code:
> Query<String, Person> query = dataStore.newQuery();
> SingleFieldValueFilter<String, Person> filter = new
> SingleFieldValueFilter<String, Person>();
>
>
> filter.setFieldName(Person.Field.EMAIL.toString());
> filter.setFilterOp(FilterOp.EQUALS);
> filter.setFilterIfMissing(true);
> filter.getOperands().add(new Utf8(person.getEmail().toString()));
>
>
> query.setFilter(filter);
> Result<String, Person> people = query.execute();
>
> Is this possible in Apache Gora in it’s current state?
>
> I’d appreciate the help.
>
> Kind regards,
> Vincent Reniers
>
>
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm for more
> information.
>



-- 
*Lewis*

Reply via email to