Hi
I'm +1 to change setFilter by addFilter right away and have a fitler
to distinct on document names.
About having filters by default in QueryManagerScriptService ; why not
do it right away ?
Jerome
On Mon, Apr 16, 2012 at 8:10 PM, Jean-Vincent Drean <jv(a)xwiki.com> wrote:
Hi devs,
while replacing calls to xwiki#searchDocuments by calls to the query
manager script service I ran into the following query manager issue:
http://jira.xwiki.org/browse/XWIKI-7273 (XWQL short form queries
should distinct on document fullname.)
I think we could use the recent QueryFilter mechanism to handle the
addition of the "distinct" in the select statement.
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwi…
QueryFilters allow to:
- transform queries depending on a dynamic parameter (for example the
user preferences in HiddenDocumentFilter)
- transform the select part of a short query, without requiring
programming rights
Here's an example of what it could look like from a velocity script:
----------------------------------------------------8<----------------------------------------------------
#set($query =
$services.query.xwql("").addFilter("unique").addFilter("hidden"))
----------------------------------------------------8<----------------------------------------------------
Note that in the future we could decide that the Query wrapper we use
in the QueryManagerScriptService (ScriptQuery) have the "unique"
filter by default + a way to remove it from the script.
I wasn't expecting us to consider using multiple filters when I added
the new APIs in Query (4.0RC1).
If we agree that a QueryFilter would be a nice way to handle this, I'd
like to break those API before we release 4.0:
----------------------------------------------------8<----------------------------------------------------
- Query setFilter(QueryFilter filter);
+ Query addFilter(QueryFilter filter);
- QueryFilter getFilter();
+ List<QueryFilter> getFilters();
----------------------------------------------------8<----------------------------------------------------
WDYT ?
JV.
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
Jérôme Velociter
Winesquare
http://www.winesquare.net/