On Mon, Apr 16, 2012 at 9:59 PM, Vincent Massol <vincent(a)massol.net> wrote:
Hi,
It's a little bit more complex. We did consider several filters when we added
setFilter()!! :)
We said that if we need more than one filter we could have an AndFilter() that takes a
list of Filters. And allow more complex filters should we need them, like OrFilter, etc.
#set($query = $services.query.xwql("").setFilter(new
AndFilter("unique", "hidden"))
Written with a fluent API that would give:
#set($query = $services.query.xwql("").setFilter(and("unique",
"hidden"))
Or even:
#set($query =
$services.query.xwql("").setFilter("unique").and("hidden")
Anyway I'm just mentioning this to explain what we thought about and an alternative
to addFilter(). The only problem with addFilter() is if you need more complex Filters
later on. It's not extensible whereas using AndFilter() and OrFilter() is more
extensible at the expense of a little bit more text if not using a fluent api.
Anyway I'm fine with either addFilter or setFilter.
Also +1 to use a QueryFilter for adding a "distinct" in the query.
Since we were ok I went for the easiest solution, ie. addFilter().
About the complex one I have the same questions as Jerome.
JV.