Yes of course you can do queries based on properties. You have some queries example here:
http://platform.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples In XWiki 1.8 and further it will be even better with XWQL (which requires testing) http://dev.xwiki.org/xwiki/bin/view/Design/XWiki+Query+Language+Specification Ludovic Joshua Marks a écrit : > Forwarding this to xwiki devs for input. > > Joshua Marks > CTO > Curriki: The Global Education and Learning Community > [email protected] > www.curriki.org > US 831-685-3511 > > > > -----Original Message----- > From: [email protected] [mailto:[email protected]] > On Behalf Of Henri Lesourd > Sent: Tuesday, March 31, 2009 9:18 AM > To: [email protected] > Subject: [curriki-devs] XWiki HQL queries too slow > > Although it's not specific to Curriki per se, I start by posting my > question here, for perhaps somebody on the list met this problem before. > > My question is: I need to query documents containing an object from a > specific Java class, and to access the object. In Vincent Massol's XWiki > tutorial, examples of how to do this are exclusively described in the > following way: > > > (1) First, query the wiki for the names of all the documents having a > specific class, e.g.: > > #set ($hql = ", BaseObject as obj where obj.name=doc.fullName and > obj.className='XWiki.TodoClass'") > > for querying the names of all the documents having the class 'TodoClass'. > > > (2) and then, for each document, fetch the document with getDocument(), > and then > perform a getObject() for getting the related instance of the Java > class, which finally > can be accessed. Here is a typical snippet: > > #foreach ($todo in $todos) > #set ($todoDoc = $xwiki.getDocument($todo)) > #set ($todoObj = $todoDoc.getObject("XWiki.TodoClass")) > ........ { Code using $todoObj } .......... > #end > > > Problem is: in my version of the step (1) above I get 1800 documents, > but next, in step (2), I dismiss most of them by means of performing a > simple test on the slots of the object obtained from getObject(). > > Thus, as it is described above, the technique from the XWiki tutorial is > highly inefficient, because for the sake of performing the simple test > you need on the Java object contained in each document, you are forced > to fetch this document, then read the object with getObject(), and it's > only then that you can perform your simple test. > > ==> > Question: is there a possibility to perform the getObject() *inside* the > HQL query, in such a way that I can fetch and test the slots of a given > related Java object (e.g., an XWiki.XWikiUsers, or an XWiki.XWikiGroups) > directly inside the 'where' part of the HQL query ? > > For example, I'd like to be able to write something like: > #set ($hql = ", BaseObject as obj where obj.name=doc.fullName and > obj.className='XWiki.XWikiUsers' and > doc.getObject('XWiki.XWikiUsers').country='Papua New Guinea')") > > for fetching the names of the XWiki pages of all people from Papua New > Guinea. In such a case, if there are only few of them among several > hundreds of users from more common nationalities, I run exactly on the > problem described above. > > Of course, this example with the users is not very useful, and perhaps > you can do that in another way from inside Java, but the pattern is > typical. In practice, if you cannot perform simple tests to eliminate > unwanted items directly inside the HQL, then very easily, you obtain > programs performing queries lasting several dozens of seconds, which > quickly becomes unbearable for the users. > > With more users operating in the same time, the response time for a > simple Velocity program displaying a list of items can even reach > response times of several minutes, like it happened to us last week > during the presentation of Intergeo in a seminar in Spain (fortunately, > people understand that the system is under development, but...). > > Thus I'm looking for an approach to eradicate this problem once for all, > for otherwise, it will not be possible to build a web-based system > usable by more than a dozen users, and this would be, hem, annoying so > to say... > > Thank you in advance, > Henri > > _______________________________________________ > curriki-devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/curriki-devs > > _______________________________________________ > curriki-devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/curriki-devs > > -- Ludovic Dubost Blog: http://blog.ludovic.org/ XWiki: http://www.xwiki.com Skype: ldubost GTalk: ldubost _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

