jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From juanpa...@apache.org
Subject svn commit: r1363142 - in /incubator/jspwiki/trunk: ./ ChangeLog build.properties build.properties.win src/org/apache/wiki/Release.java src/org/apache/wiki/search/LuceneSearchProvider.java tests/ tests/org/apache/wiki/search/SearchManagerTest.java
Date Wed, 18 Jul 2012 22:04:30 GMT
Author: juanpablo
Date: Wed Jul 18 22:04:29 2012
New Revision: 1363142

URL: http://svn.apache.org/viewvc?rev=1363142&view=rev
Log:
* 2.9.0-incubating-7

* JSPWIKI-738: Dependencies should not be distributed with source archive

* Small refactor in LuceneSearchProvider

Modified:
    incubator/jspwiki/trunk/   (props changed)
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/build.properties
    incubator/jspwiki/trunk/build.properties.win
    incubator/jspwiki/trunk/src/org/apache/wiki/Release.java
    incubator/jspwiki/trunk/src/org/apache/wiki/search/LuceneSearchProvider.java
    incubator/jspwiki/trunk/tests/   (props changed)
    incubator/jspwiki/trunk/tests/org/apache/wiki/search/SearchManagerTest.java

Propchange: incubator/jspwiki/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Jul 18 22:04:29 2012
@@ -1,10 +1,11 @@
-releases
-build
-jspwiki.properties
-tests_build
-rss.rdf
-classes
 .fbwarnings
+@logfile@
 WebRoot
+build
+classes
+jspwiki.properties
+lib
+releases
 repository
-@logfile@
+rss.rdf
+tests_build

Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=1363142&r1=1363141&r2=1363142&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Wed Jul 18 22:04:29 2012
@@ -1,3 +1,11 @@
+2012-07-18  Juan Pablo Santos (juanpablo AT apache DOT org)
+       
+       * 2.9.0-incubating-7
+       
+       * JSPWIKI-738: Dependencies should not be distributed with source archive
+       
+       * Small refactor in LuceneSearchProvider
+
 2012-07-16  Florian Holeczek (florianh AT apache DOT org)
 
        * no version bump

Modified: incubator/jspwiki/trunk/build.properties
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/build.properties?rev=1363142&r1=1363141&r2=1363142&view=diff
==============================================================================
--- incubator/jspwiki/trunk/build.properties (original)
+++ incubator/jspwiki/trunk/build.properties Wed Jul 18 22:04:29 2012
@@ -39,7 +39,7 @@ jks.password = jspwiki
 #  JDBC testing properties
 #
 jdbc.driver.id=hsql
-jdbc.driver.jar=tests/lib/hsqldb.jar
+jdbc.driver.jar=tests/lib/hsqldb-1.8.0.jar
 jdbc.driver.class=org.hsqldb.jdbcDriver
 jdbc.driver.url=jdbc:hsqldb:hsql://localhost/jspwiki
 jdbc.admin.id=SA

Modified: incubator/jspwiki/trunk/build.properties.win
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/build.properties.win?rev=1363142&r1=1363141&r2=1363142&view=diff
==============================================================================
--- incubator/jspwiki/trunk/build.properties.win (original)
+++ incubator/jspwiki/trunk/build.properties.win Wed Jul 18 22:04:29 2012
@@ -42,7 +42,7 @@ jks.password = jspwiki
 #  JDBC testing properties
 #
 jdbc.driver.id=hsql
-jdbc.driver.jar=tests/lib/hsqldb.jar
+jdbc.driver.jar=tests/lib/hsqldb-1.8.0.jar
 jdbc.driver.class=org.hsqldb.jdbcDriver
 jdbc.driver.url=jdbc:hsqldb:hsql://localhost/jspwiki
 jdbc.admin.id=SA

Modified: incubator/jspwiki/trunk/src/org/apache/wiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/Release.java?rev=1363142&r1=1363141&r2=1363142&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/Release.java Wed Jul 18 22:04:29 2012
@@ -77,7 +77,7 @@ public final class Release
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "6";
+    public static final String     BUILD         = "7";
     
     /**
      *  This is the generic version string you should use

Modified: incubator/jspwiki/trunk/src/org/apache/wiki/search/LuceneSearchProvider.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/search/LuceneSearchProvider.java?rev=1363142&r1=1363141&r2=1363142&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/search/LuceneSearchProvider.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/search/LuceneSearchProvider.java Wed Jul 18
22:04:29 2012
@@ -41,6 +41,7 @@ import org.apache.lucene.search.ScoreDoc
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.highlight.*;
 import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.LockObtainFailedException;
 import org.apache.lucene.store.SimpleFSDirectory;
 import org.apache.lucene.util.Version;
 import org.apache.wiki.*;
@@ -191,9 +192,7 @@ public class LuceneSearchProvider implem
                 
                 try
                 {
-                    IndexWriterConfig writerConfig = new IndexWriterConfig( Version.LUCENE_36,
getLuceneAnalyzer());
-                    writerConfig.setOpenMode( OpenMode.CREATE_OR_APPEND );
-                    writer = new IndexWriter( luceneDir, writerConfig);
+                    writer = getIndexWriter( luceneDir );
                     Collection allPages = m_engine.getPageManager().getAllPages();
 
                     for( Iterator iterator = allPages.iterator(); iterator.hasNext(); )
@@ -231,13 +230,7 @@ public class LuceneSearchProvider implem
                 }
                 finally
                 {
-                    try
-                    {
-                        if( writer != null ) writer.close();
-                    }
-                    catch( IOException e ) 
-                    {
-                    }
+                    close( writer );
                 }
 
                 Date end = new Date();
@@ -363,32 +356,32 @@ public class LuceneSearchProvider implem
 
         log.debug("Updating Lucene index for page '" + page.getName() + "'...");
 
+        Directory luceneDir = null;
         try
         {
-            pageRemoved(page);
+            pageRemoved( page );
 
             // Now add back the new version.
-            Directory luceneDir = new SimpleFSDirectory(new File(m_luceneDirectory), null);
-            IndexWriterConfig writerConfig = new IndexWriterConfig( Version.LUCENE_36, getLuceneAnalyzer());
-            writerConfig.setOpenMode( OpenMode.CREATE_OR_APPEND);
-            writer = new IndexWriter(luceneDir, writerConfig);
-            luceneIndexPage(page, text, writer);
+            luceneDir = new SimpleFSDirectory(new File(m_luceneDirectory), null);
+            writer = getIndexWriter( luceneDir );
+            
+            luceneIndexPage( page, text, writer );
         }
         catch ( IOException e )
         {
             log.error("Unable to update page '" + page.getName() + "' from Lucene index",
e);
+            System.out.println( "ioe: " + e.getMessage() );
+            // reindexPage( page );
         }
         catch( Exception e )
         {
             log.error("Unexpected Lucene exception - please check configuration!",e);
+            System.out.println( "e: " + e.getMessage() );
+            // reindexPage( page );
         }
         finally
         {
-            try
-            {
-                if( writer != null ) writer.close();
-            }
-            catch( IOException e ) {}
+            close( writer );
         }
 
         log.debug("Done updating Lucene index for page '" + page.getName() + "'.");
@@ -494,27 +487,46 @@ public class LuceneSearchProvider implem
         try
         {
             Directory luceneDir = new SimpleFSDirectory(new File(m_luceneDirectory), null);
-            IndexWriterConfig writerConfig = new IndexWriterConfig( Version.LUCENE_36, getLuceneAnalyzer());
-            writerConfig.setOpenMode( OpenMode.CREATE_OR_APPEND);
-            writer = new IndexWriter( luceneDir, writerConfig);
+            writer = getIndexWriter( luceneDir );
             Query query = new TermQuery( new Term( LUCENE_ID, page.getName() ) );
             writer.deleteDocuments( query );
         }
         catch ( Exception e )
         {
             log.error("Unable to remove page '" + page.getName() + "' from Lucene index",
e);
+            System.out.println( m_luceneDirectory + "pre: " + e.getMessage() );
         }
         finally
         {
-            try
-            {
-                if( writer != null ) writer.close();
-            }
-            catch( IOException e )
+            close( writer );
+        }
+    }
+    
+    IndexWriter getIndexWriter( Directory luceneDir ) throws CorruptIndexException, 
+            LockObtainFailedException, IOException, ProviderException 
+    {
+        IndexWriter writer = null;
+        IndexWriterConfig writerConfig = new IndexWriterConfig( Version.LUCENE_36, getLuceneAnalyzer()
);
+        writerConfig.setOpenMode( OpenMode.CREATE_OR_APPEND );
+        writer = new IndexWriter( luceneDir, writerConfig );
+        
+        // writer.setInfoStream( System.out );
+        return writer;
+    }
+    
+    void close( IndexWriter writer ) 
+    {
+        try
+        {
+            if( writer != null ) 
             {
-                log.error( e );
+                writer.close( true );
             }
         }
+        catch( IOException e )
+        {
+            log.error( e );
+        }
     }
 
 

Propchange: incubator/jspwiki/trunk/tests/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jul 18 22:04:29 2012
@@ -0,0 +1 @@
+lib

Modified: incubator/jspwiki/trunk/tests/org/apache/wiki/search/SearchManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/org/apache/wiki/search/SearchManagerTest.java?rev=1363142&r1=1363141&r2=1363142&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/org/apache/wiki/search/SearchManagerTest.java (original)
+++ incubator/jspwiki/trunk/tests/org/apache/wiki/search/SearchManagerTest.java Wed Jul 18
22:04:29 2012
@@ -47,7 +47,8 @@ public class SearchManagerTest extends T
         
         props.setProperty( SearchManager.PROP_SEARCHPROVIDER, "LuceneSearchProvider" );
         props.setProperty( "jspwiki.lucene.initialdelay", "1" );
-
+        props.setProperty( "jspwiki.workDir", System.getProperty( "java.io.tmpdir" ) );
+        
         TestEngine.emptyWorkDir();
         
         m_engine = new TestEngine( props );



Mime
View raw message