archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marti...@apache.org
Subject [4/4] archiva git commit: Changing JCR queries to new syntax
Date Mon, 02 Apr 2018 07:50:43 GMT
Changing JCR queries to new syntax


Project: http://git-wip-us.apache.org/repos/asf/archiva/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/d422c877
Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/d422c877
Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/d422c877

Branch: refs/heads/master
Commit: d422c877838b7893f7f34344e6a60665a2537073
Parents: 60bbe9d
Author: Martin Stockhammer <martin_s@apache.org>
Authored: Mon Apr 2 00:28:02 2018 +0200
Committer: Martin Stockhammer <martin_s@apache.org>
Committed: Mon Apr 2 00:28:02 2018 +0200

----------------------------------------------------------------------
 .../repository/jcr/JcrMetadataRepository.java        | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/archiva/blob/d422c877/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java
----------------------------------------------------------------------
diff --git a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java
b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java
index a4d5d5d..978602a 100644
--- a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java
+++ b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java
@@ -1722,14 +1722,15 @@ public class JcrMetadataRepository
         {
             QueryManager queryManager = session.getWorkspace().getQueryManager();
 
-            // TODO: JCR-SQL2 query will not complete on a large repo in Jackrabbit 2.2.0
- see JCR-2835
+            // TODO: Check, if this is still the case - Switched to Jackrabbit OAK with archiva
3.0
+            // Former statement: JCR-SQL2 query will not complete on a large repo in Jackrabbit
2.2.0 - see JCR-2835
             //    Using the JCR-SQL2 variants gives
             //      "org.apache.lucene.search.BooleanQuery$TooManyClauses: maxClauseCount
is set to 1024"
 //            String whereClause = "WHERE ISDESCENDANTNODE([/repositories/" + repositoryId
+ "/content])";
 //            Query query = queryManager.createQuery( "SELECT size FROM [archiva:artifact]
" + whereClause,
 //                                                    Query.JCR_SQL2 );
-            String whereClause = "WHERE jcr:path LIKE '/repositories/" + repositoryId + "/content/%'";
-            Query query = queryManager.createQuery( "SELECT size FROM archiva:artifact "
+ whereClause, Query.SQL );
+            String whereClause = "WHERE ISDESCENDANTNODE([/repositories/" + repositoryId
+ "/content])";
+            Query query = queryManager.createQuery( "SELECT size FROM [archiva:artifact]
" + whereClause, Query.JCR_SQL2 );
 
             QueryResult queryResult = query.execute();
 
@@ -1766,15 +1767,15 @@ public class JcrMetadataRepository
 
             // The query ordering is a trick to ensure that the size is correct, otherwise
due to lazy init it will be -1
 //            query = queryManager.createQuery( "SELECT * FROM [archiva:project] " + whereClause,
Query.JCR_SQL2 );
-            query = queryManager.createQuery( "SELECT * FROM archiva:project " + whereClause
+ " ORDER BY jcr:score",
-                                              Query.SQL );
+            query = queryManager.createQuery( "SELECT * FROM [archiva:project] " + whereClause
+ " ORDER BY [jcr:score]",
+                                              Query.JCR_SQL2 );
             repositoryStatistics.setTotalProjectCount( query.execute().getRows().getSize()
);
 
 //            query = queryManager.createQuery(
 //                "SELECT * FROM [archiva:namespace] " + whereClause + " AND namespace IS
NOT NULL", Query.JCR_SQL2 );
             query = queryManager.createQuery(
-                "SELECT * FROM archiva:namespace " + whereClause + " AND namespace IS NOT
NULL ORDER BY jcr:score",
-                Query.SQL );
+                "SELECT * FROM [archiva:namespace] " + whereClause + " AND namespace IS NOT
NULL ORDER BY [jcr:score]",
+                Query.JCR_SQL2 );
             repositoryStatistics.setTotalGroupCount( query.execute().getRows().getSize()
);
         }
         catch ( RepositoryException e )


Mime
View raw message