Author: sergiykarpenko
Date: 2009-10-21 05:32:31 -0400 (Wed, 21 Oct 2009)
New Revision: 322
Modified:
jcr/trunk/component/core/src/main/javacc/sql/JCRSQL.jjt
jcr/trunk/component/core/src/test/java/org/exoplatform/services/jcr/impl/core/query/TestQueryUsecases.java
Log:
EXOJCR-180: order jcr:score as fuction fixed
Modified: jcr/trunk/component/core/src/main/javacc/sql/JCRSQL.jjt
===================================================================
--- jcr/trunk/component/core/src/main/javacc/sql/JCRSQL.jjt 2009-10-21 09:18:35 UTC (rev
321)
+++ jcr/trunk/component/core/src/main/javacc/sql/JCRSQL.jjt 2009-10-21 09:32:31 UTC (rev
322)
@@ -603,7 +603,7 @@
{
try {
String jcrName = t.image;
- if (pseudoProperty) {
+ if (pseudoProperty && !jcrName.equals("jcr:score")) {
jcrName += "()";
}
InternalQName internalQName =
locationFactory.parseJCRName(jcrName).getInternalName();
Modified:
jcr/trunk/component/core/src/test/java/org/exoplatform/services/jcr/impl/core/query/TestQueryUsecases.java
===================================================================
---
jcr/trunk/component/core/src/test/java/org/exoplatform/services/jcr/impl/core/query/TestQueryUsecases.java 2009-10-21
09:18:35 UTC (rev 321)
+++
jcr/trunk/component/core/src/test/java/org/exoplatform/services/jcr/impl/core/query/TestQueryUsecases.java 2009-10-21
09:32:31 UTC (rev 322)
@@ -1007,22 +1007,21 @@
QueryManager qman = this.workspace.getQueryManager();
Query q =
- qman.createQuery("SELECT * FROM mix:title WHERE CONTAINS(*, 'brown OR
fox OR jumps') ORDER BY SCORE ASC",
- Query.SQL);
+ qman.createQuery(
+ "SELECT * FROM mix:title WHERE CONTAINS(*, 'brown OR fox OR
jumps') ORDER BY jcr:score() ASC", Query.SQL);
QueryResult res = q.execute();
long sqlsize = res.getNodes().getSize();
assertEquals(3, sqlsize);
- checkOrder(res, new Node[]{doc1, doc2, doc3});
+ checkOrder(res, new Node[]{doc3, doc2, doc1});
//make XPath query
Query xq =
- qman.createQuery(
- "//element(*,mix:title)[jcr:contains(., 'brown OR fox OR
jumps')] order by jcr:score() ascending",
+ qman.createQuery("//element(*,mix:title)[jcr:contains(., 'brown OR fox
OR jumps')] order by jcr:score()",
Query.XPATH);
QueryResult xres = xq.execute();
long xpathsize = xres.getNodes().getSize();
assertEquals(3, xpathsize);
- checkOrder(res, new Node[]{doc1, doc2, doc3});
+ checkOrder(res, new Node[]{doc3, doc2, doc1});
}
public void testOrderByLongDesc() throws Exception
Show replies by date