In addition to my previous mail : Now I tried sorting on another field 'companyname' as follows : , BaseObject as obj, StringProperty as prop, StringProperty as otherprop where doc.web='Companies' and obj.name=doc.fullName and obj.className='Companyprofiles.companyprofilesClass' and obj.id=prop.id.id and prop.id.name='companytags' and ( prop.value like '%oil%' or prop.value like '%transportation%') and otherprop.id.id=obj.id and otherprop.id.name='companyname' order by otherprop.value desc It did give me all the results which has the specified 'companytags' but _not_ in the sorted order. Some information that might help identify the problem. When I tried sorting by 'rating' there were no results at all. Rating is a property that I added recently to the 'companyprofilesClass'. And I am feeding in the rating value programatically as follows $doc.getObject("Companyprofiles.companyprofilesClass",0).set("rating", $score) Regards Roopesh Sergiu Dumitriu wrote:
Indeed. This gives:
, BaseObject as obj, StringProperty as prop, StringProperty as otherprop where obj.name=doc.fullName and obj.className='Users.UserClass' and obj.id=prop.id.id and prop.id.name='address' and prop.value like '%someaddress%' and otherprop.id.id=obj.id and otherprop.id.name='username' order by otherprop.value
On 7/12/07, THOMAS, BRIAN M (ATTSI) <[email protected]> wrote:
Do you get a syntax error on that 'join' expression? I don't think that's legal HQL, and whether it is or not you can get the desired result by putting the obj.id = otherprop.id.id expression in the "where" clause with the other qualifiers (note that the same thing is done with the 'prop' alias, which is also a join to get the address field).
brain[sic]
-----Original Message----- From: [email protected] [mailto:[email protected]] Sent: Thursday, July 12, 2007 8:01 AM To: [email protected] Subject: [xwiki-users] Sorting by property of a class
Hi,
I am doing a search for all the users whose address is matching a particular pattern. (Suppose there is an "address" property in the UserClass). Also I want the results to be sorted by another property, say, "username".
I found a similar query in this mailing list thread : http://www.nabble.com/select-objects-by-class-and-sort-by-prop erty-tf710844.html#a1871554
I tried forming the following query but it is wrong. , BaseObject as obj, StringProperty as prop, StringProperty as otherprop join obj.id=otherprop.id.id and otherprop.id.name='username' where obj.name=doc.fullName and obj.className='Users.UserClass' and obj.id=prop.id.id and prop.id.name='address' and prop.value like '%someaddress%' order by otherprop.value
Can anyone tell me what the correct query should be like.
Thanks in advance Roopesh
Sergiu ------------------------------------------------------------------------
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
------------------ DigitalGlue, India