jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r794162 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java test/java/org/apache/jackrabbit/core/query/lucene/IndexingQueueTest.java
Date Wed, 15 Jul 2009 07:18:24 GMT
Author: mreutegg
Date: Wed Jul 15 07:18:24 2009
New Revision: 794162

URL: http://svn.apache.org/viewvc?rev=794162&view=rev
Log:
JCR-2082: Query does not work after logging into workspace with no indexes

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/IndexingQueueTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java?rev=794162&r1=794161&r2=794162&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
Wed Jul 15 07:18:24 2009
@@ -373,6 +373,7 @@
                 count = createIndex(rootState, rootPath, stateMgr, count);
                 executeAndLog(new Commit(getTransactionId()));
                 log.info("Created initial index for {} nodes", new Long(count));
+                releaseMultiReader();
                 scheduleFlushTask();
             } catch (Exception e) {
                 String msg = "Error indexing workspace";

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/IndexingQueueTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/IndexingQueueTest.java?rev=794162&r1=794161&r2=794162&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/IndexingQueueTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/IndexingQueueTest.java
Wed Jul 15 07:18:24 2009
@@ -152,6 +152,38 @@
         assertEquals(num, q.execute().getNodes().getSize());
     }
 
+    /*
+     * Test case for JCR-2082
+     */
+    public void testReaderUpToDate() throws Exception {
+        Extractor.sleepTime = 10;
+        SearchIndex index = (SearchIndex) getQueryHandler();
+        File indexDir = new File(index.getPath());
+
+        // shutdown workspace
+        RepositoryImpl repo = (RepositoryImpl) session.getRepository();
+        session.logout();
+        session = null;
+        superuser.logout();
+        superuser = null;
+        TestHelper.shutdownWorkspace(WORKSPACE_NAME, repo);
+
+        // delete index
+        try {
+            FileUtil.delete(indexDir);
+        } catch (IOException e) {
+            fail("Unable to delete index directory");
+        }
+
+        // start workspace again by getting a session
+        session = getHelper().getSuperuserSession(WORKSPACE_NAME);
+
+        qm = session.getWorkspace().getQueryManager();
+
+        Query q = qm.createQuery(testPath, Query.XPATH);
+        assertEquals(1, getSize(q.execute().getNodes()));
+    }
+
     private int createFiles(Node folder, byte[] data,
                             int filesPerLevel, int levels, int count)
             throws RepositoryException {



Mime
View raw message