Hi Vincent, I think some tests are in order here I've created an issue which I'll address (unless you want to submit a patch yourself) in due course https://issues.apache.org/jira/browse/GORA-454 Thanks Lewis
On Mon, Jan 4, 2016 at 1:10 AM, Vincent Reniers < vincent.reni...@cs.kuleuven.be> wrote: > Hi Lewis, > > Thank you for your response, I hope you had a good vacation. > > I did accidentally write an OR query as an example. > However thank you for the information. > > I mainly went over the test cases to check for specific filter > functionality and thereby missed the FilterList. > Though it seems as if the filter method in FilterList is not yet > implemented. > So I believe that AND and OR queries are not yet possible? > > Kind regards, > Vincent > > On 29 Dec 2015, at 23:00, Lewis John Mcgibbney <lewis.mcgibb...@gmail.com> > wrote: > > 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* > > > > Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm for more > information. > -- *Lewis*