You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by pf...@apache.org on 2012/05/12 20:03:12 UTC

svn commit: r1337602 - in /incubator/ooo/trunk: ext_sources/ main/ main/helpcontent2/ main/l10ntools/source/help/ main/lucene/ main/scp2/source/ooo/ main/solenv/inc/ main/xmlhelp/source/com/sun/star/help/

Author: pfg
Date: Sat May 12 18:03:10 2012
New Revision: 1337602

URL: http://svn.apache.org/viewvc?rev=1337602&view=rev
Log:
Update Apache Lucene core to version 2.9.4.

The new version brings in many bugfixes and performance
improvements. Unfortunately this also means we lose the
Windows specific enhancements in the long_path.patch but
it must be expected the newer versions of Lucene will
have much better portability.

We also bring in support for using preinstalled version 3
from BZ i115241 (author: bero@arklinux).

Added:
    incubator/ooo/trunk/ext_sources/17960f35b2239654ba608cf1f3e256b3-lucene-2.9.4-src.tar.gz   (with props)
Removed:
    incubator/ooo/trunk/ext_sources/48d8169acc35f97e05d8dcdfd45be7f2-lucene-2.3.2.tar.gz
    incubator/ooo/trunk/main/lucene/long_path.patch
Modified:
    incubator/ooo/trunk/main/configure.in
    incubator/ooo/trunk/main/helpcontent2/settings.pmk
    incubator/ooo/trunk/main/l10ntools/source/help/HelpFileDocument.java
    incubator/ooo/trunk/main/l10ntools/source/help/HelpIndexerTool.java
    incubator/ooo/trunk/main/l10ntools/source/help/makefile.mk
    incubator/ooo/trunk/main/lucene/lucene.patch
    incubator/ooo/trunk/main/lucene/makefile.mk
    incubator/ooo/trunk/main/scp2/source/ooo/file_ooo.scp
    incubator/ooo/trunk/main/solenv/inc/extension_helplink.mk
    incubator/ooo/trunk/main/xmlhelp/source/com/sun/star/help/HelpIndexer.java
    incubator/ooo/trunk/main/xmlhelp/source/com/sun/star/help/HelpSearch.java
    incubator/ooo/trunk/main/xmlhelp/source/com/sun/star/help/makefile.mk

Added: incubator/ooo/trunk/ext_sources/17960f35b2239654ba608cf1f3e256b3-lucene-2.9.4-src.tar.gz
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/ext_sources/17960f35b2239654ba608cf1f3e256b3-lucene-2.9.4-src.tar.gz?rev=1337602&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/ooo/trunk/ext_sources/17960f35b2239654ba608cf1f3e256b3-lucene-2.9.4-src.tar.gz
------------------------------------------------------------------------------
    svn:mime-type = application/x-gzip

Modified: incubator/ooo/trunk/main/configure.in
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/configure.in?rev=1337602&r1=1337601&r2=1337602&view=diff
==============================================================================
--- incubator/ooo/trunk/main/configure.in (original)
+++ incubator/ooo/trunk/main/configure.in Sat May 12 18:03:10 2012
@@ -4102,7 +4102,22 @@ if test -n "$with_system_lucene" -o -n "
             }'; then
             AC_MSG_RESULT([yes])
          else
-            AC_MSG_ERROR([no, you need lucene 2])
+            AC_MSG_RESULT([no])
+            AC_MSG_CHECKING([whether lucene is version 3.x])
+
+            if $PERL -e 'use Archive::Zip;
+                my $file = "$ENV{'LUCENE_CORE_JAR'}";
+                my $zip = Archive::Zip->new( $file );
+                my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
+                if ( $mf =~ m/Specification-Version: 3.*/ ) {
+                    exit 0;
+                } else {
+                    exit 1;
+                }'; then
+                AC_MSG_RESULT([yes])
+             else
+                AC_MSG_ERROR([no, you need lucene 2 or 3])
+             fi
          fi
 
 else

Modified: incubator/ooo/trunk/main/helpcontent2/settings.pmk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/helpcontent2/settings.pmk?rev=1337602&r1=1337601&r2=1337602&view=diff
==============================================================================
--- incubator/ooo/trunk/main/helpcontent2/settings.pmk (original)
+++ incubator/ooo/trunk/main/helpcontent2/settings.pmk Sat May 12 18:03:10 2012
@@ -26,7 +26,7 @@ my_cp:=$(CLASSPATH)$(PATH_SEPERATOR)$(SO
 .IF "$(SYSTEM_LUCENE)" == "YES"
 my_cp!:=$(my_cp)$(PATH_SEPERATOR)$(LUCENE_CORE_JAR)$(PATH_SEPERATOR)$(LUCENE_ANALYZERS_JAR)
 .ELSE
-my_cp!:=$(my_cp)$(PATH_SEPERATOR)$(SOLARBINDIR)/lucene-core-2.3.jar$(PATH_SEPERATOR)$(SOLARBINDIR)/lucene-analyzers-2.3.jar
+my_cp!:=$(my_cp)$(PATH_SEPERATOR)$(SOLARBINDIR)/lucene-core-2.9.4-dev.jar$(PATH_SEPERATOR)$(SOLARBINDIR)/lucene-analyzers-2.9.4-dev.jar
 .ENDIF
  
 aux_alllangiso:=$(foreach,i,$(alllangiso) $(foreach,j,$(aux_langdirs) $(eq,$i,$j  $i $(NULL))))

Modified: incubator/ooo/trunk/main/l10ntools/source/help/HelpFileDocument.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/l10ntools/source/help/HelpFileDocument.java?rev=1337602&r1=1337601&r2=1337602&view=diff
==============================================================================
--- incubator/ooo/trunk/main/l10ntools/source/help/HelpFileDocument.java (original)
+++ incubator/ooo/trunk/main/l10ntools/source/help/HelpFileDocument.java Sat May 12 18:03:10 2012
@@ -63,7 +63,7 @@ public class HelpFileDocument
 		if( aFile != null )
 		{
 			String aPath = "#HLP#" + aModule + "/" + aFile.getName();
-			doc.add(new Field("path", aPath, Field.Store.YES, Field.Index.UN_TOKENIZED));
+			doc.add(new Field("path", aPath, Field.Store.YES, Field.Index.NOT_ANALYZED));
 		}
 		
 		// Add the caption of the file to a field named "caption".  Specify a Reader,

Modified: incubator/ooo/trunk/main/l10ntools/source/help/HelpIndexerTool.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/l10ntools/source/help/HelpIndexerTool.java?rev=1337602&r1=1337601&r2=1337602&view=diff
==============================================================================
--- incubator/ooo/trunk/main/l10ntools/source/help/HelpIndexerTool.java (original)
+++ incubator/ooo/trunk/main/l10ntools/source/help/HelpIndexerTool.java Sat May 12 18:03:10 2012
@@ -35,21 +35,14 @@ import org.apache.lucene.analysis.standa
 import org.apache.lucene.analysis.cjk.CJKAnalyzer;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.util.Version;
+import org.apache.lucene.store.NIOFSDirectory;
 
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.Date;
 
-
-/**
-   When this tool is used with long path names on Windows, that is paths which start
-   with \\?\, then the caller must make sure that the path is unique. This is achieved
-   by removing '.' and '..' from the path. Paths which are created by
-   osl_getSystemPathFromFileURL fulfill this requirement. This is necessary because
-   lucene is patched to not use File.getCanonicalPath. See long_path.patch in the lucene
-   module.
- */
 public class HelpIndexerTool
 {
     public HelpIndexerTool()
@@ -182,8 +175,8 @@ public class HelpIndexerTool
         try
 		{
             Date start = new Date();
-            Analyzer analyzer = aLanguageStr.equals("ja") ? (Analyzer)new CJKAnalyzer() : (Analyzer)new StandardAnalyzer();
-            IndexWriter writer = new IndexWriter( aIndexDir, analyzer, true );
+	    Analyzer analyzer = aLanguageStr.equals("ja") ? (Analyzer)new CJKAnalyzer(Version.LUCENE_29) : (Analyzer)new StandardAnalyzer(Version.LUCENE_29);
+	    IndexWriter writer = new IndexWriter( NIOFSDirectory.open(aIndexDir), analyzer, true, IndexWriter.MaxFieldLength.LIMITED );
 			if( !bExtensionMode )
 	            System.out.println( "Lucene: Indexing to directory '" + aIndexDir + "'..." );
             int nRet = indexDocs( writer, aModule, bExtensionMode, aCaptionFilesDir, aContentFilesDir );

Modified: incubator/ooo/trunk/main/l10ntools/source/help/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/l10ntools/source/help/makefile.mk?rev=1337602&r1=1337601&r2=1337602&view=diff
==============================================================================
--- incubator/ooo/trunk/main/l10ntools/source/help/makefile.mk (original)
+++ incubator/ooo/trunk/main/l10ntools/source/help/makefile.mk Sat May 12 18:03:10 2012
@@ -95,7 +95,7 @@ JAVACLASSFILES = \
 .IF "$(SYSTEM_LUCENE)" == "YES"
 EXTRAJARFILES += $(LUCENE_CORE_JAR) $(LUCENE_ANALYZERS_JAR)
 .ELSE
-JARFILES += lucene-core-2.3.jar lucene-analyzers-2.3.jar
+JARFILES += lucene-core-2.9.4-dev.jar lucene-analyzers-2.9.4-dev.jar
 .ENDIF
 JAVAFILES = $(subst,$(CLASSDIR)$/$(PACKAGE)$/, $(subst,.class,.java $(JAVACLASSFILES)))
 

Modified: incubator/ooo/trunk/main/lucene/lucene.patch
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/lucene/lucene.patch?rev=1337602&r1=1337601&r2=1337602&view=diff
==============================================================================
--- incubator/ooo/trunk/main/lucene/lucene.patch (original)
+++ incubator/ooo/trunk/main/lucene/lucene.patch Sat May 12 18:03:10 2012
@@ -1,12 +1,24 @@
---- lucene-2.3.2/common-build.xml	2008-05-01 22:28:56.000000000 +0200
-+++ misc/build/lucene-2.3.2/common-build.xml	2008-06-16 16:01:28.812500000 +0200
-@@ -280 +280 @@
--		           value="${version} ${svnversion} - ${user.name} - ${DSTAMP} ${TSTAMP}"/>
+--- lucene-2.9.4/common-build.xml	2012-05-11 17:34:48.000000000 -0500
++++ misc/build/lucene-2.9.4/common-build.xml	2012-05-11 17:37:20.000000000 -0500
+@@ -304,7 +304,7 @@
+ 		<attribute name="Implementation-Title" value="org.apache.lucene"/>
+ 		<!-- impl version can be any string -->
+ 		<attribute name="Implementation-Version"
+-		           value="${version} ${svnversion} - ${DSTAMP} ${TSTAMP}"/>
 +		           value="${version}"/>
-@@ -297,6 +296,0 @@
+ 		<attribute name="Implementation-Vendor"
+ 		           value="The Apache Software Foundation"/>
+ 		<attribute name="X-Compile-Source-JDK" 
+@@ -321,12 +321,6 @@
+     <element name="manifest-attributes" optional="yes"/>
+   	<element name="metainf-includes" optional="yes"/>
+     <sequential>
 -      <!-- If possible, include the svnversion -->
--      <exec dir="." executable="svnversion"
+-      <exec dir="." executable="${svnversion.exe}"
 -            outputproperty="svnversion" failifexecutionfails="false">
 -        <arg line="."/>
 -      </exec>
 -      
+       <build-manifest/>
+     	
+       <jar

Modified: incubator/ooo/trunk/main/lucene/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/lucene/makefile.mk?rev=1337602&r1=1337601&r2=1337602&view=diff
==============================================================================
--- incubator/ooo/trunk/main/lucene/makefile.mk (original)
+++ incubator/ooo/trunk/main/lucene/makefile.mk Sat May 12 18:03:10 2012
@@ -36,27 +36,24 @@ TARGET=so_lucene
 .IF "$(SOLAR_JAVA)" != ""
 
 LUCENE_MAJOR=2
-LUCENE_MINOR=3
-LUCENE_MICRO=2
+LUCENE_MINOR=9
+LUCENE_MICRO=4
 
 LUCENE_NAME=lucene-$(LUCENE_MAJOR).$(LUCENE_MINOR).$(LUCENE_MICRO)
 # NOTE that the jar names do not contain the micro version
-LUCENE_CORE_JAR=lucene-core-$(LUCENE_MAJOR).$(LUCENE_MINOR).jar
-LUCENE_ANALYZERS_JAR=lucene-analyzers-$(LUCENE_MAJOR).$(LUCENE_MINOR).jar
+LUCENE_CORE_JAR=lucene-core-$(LUCENE_MAJOR).$(LUCENE_MINOR).$(LUCENE_MICRO)-dev.jar
+LUCENE_ANALYZERS_JAR=lucene-analyzers-$(LUCENE_MAJOR).$(LUCENE_MINOR).$(LUCENE_MICRO)-dev.jar
 
-TARFILE_NAME=$(LUCENE_NAME)
-TARFILE_MD5=48d8169acc35f97e05d8dcdfd45be7f2
-PATCH_FILES=lucene.patch 
-
-.IF "$(OS)" == "WNT"
-PATCH_FILES+= long_path.patch
-.ENDIF
+TARFILE_NAME=$(LUCENE_NAME)-src
+TARFILE_MD5=17960f35b2239654ba608cf1f3e256b3
+TARFILE_ROOTDIR=$(LUCENE_NAME)
 
+PATCH_FILES=lucene.patch 
 
 BUILD_DIR=.
 BUILD_ACTION= ${ANT} -buildfile .$/contrib$/analyzers$/build.xml
 
-OUT2BIN=.$/build$/$(LUCENE_CORE_JAR) .$/build$/contrib$/analyzers$/$(LUCENE_ANALYZERS_JAR)
+OUT2BIN=.$/build$/$(LUCENE_CORE_JAR) .$/build$/contrib$/analyzers/common$/$(LUCENE_ANALYZERS_JAR)
 
 .ENDIF
 

Modified: incubator/ooo/trunk/main/scp2/source/ooo/file_ooo.scp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/scp2/source/ooo/file_ooo.scp?rev=1337602&r1=1337601&r2=1337602&view=diff
==============================================================================
--- incubator/ooo/trunk/main/scp2/source/ooo/file_ooo.scp (original)
+++ incubator/ooo/trunk/main/scp2/source/ooo/file_ooo.scp Sat May 12 18:03:10 2012
@@ -373,8 +373,8 @@ STD_JAR_FILE( gid_File_Jar_Bsh, bsh )
 #endif
 
 #if defined SOLAR_JAVA && ! defined SYSTEM_LUCENE
-STD_JAR_FILE( gid_File_Jar_Lucene_Core, lucene-core-2.3 )
-STD_JAR_FILE( gid_File_Jar_Lucene_Analyzers, lucene-analyzers-2.3 )
+STD_JAR_FILE( gid_File_Jar_Lucene_Core, lucene-core-2.9.4-dev )
+STD_JAR_FILE( gid_File_Jar_Lucene_Analyzers, lucene-analyzers-2.9.4-dev )
 #endif
 
 

Modified: incubator/ooo/trunk/main/solenv/inc/extension_helplink.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/solenv/inc/extension_helplink.mk?rev=1337602&r1=1337601&r2=1337602&view=diff
==============================================================================
--- incubator/ooo/trunk/main/solenv/inc/extension_helplink.mk (original)
+++ incubator/ooo/trunk/main/solenv/inc/extension_helplink.mk Sat May 12 18:03:10 2012
@@ -26,7 +26,7 @@ my_cp:=$(CLASSPATH)$(PATH_SEPERATOR)$(SO
 .IF "$(SYSTEM_LUCENE)" == "YES"
 my_cp!:=$(my_cp)$(PATH_SEPERATOR)$(LUCENE_CORE_JAR)$(PATH_SEPERATOR)$(LUCENE_ANALYZERS_JAR)
 .ELSE
-my_cp!:=$(my_cp)$(PATH_SEPERATOR)$(SOLARBINDIR)/lucene-core-2.3.jar$(PATH_SEPERATOR)$(SOLARBINDIR)/lucene-analyzers-2.3.jar
+my_cp!:=$(my_cp)$(PATH_SEPERATOR)$(SOLARBINDIR)/lucene-core-2.9.4-dev.jar$(PATH_SEPERATOR)$(SOLARBINDIR)/lucene-analyzers-2.9.4-dev.jar
 .ENDIF
  
 #aux_alllangiso*:=$(foreach,i,$(alllangiso) $(foreach,j,$(aux_langdirs) $(eq,$i,$j  $i $(NULL))))

Modified: incubator/ooo/trunk/main/xmlhelp/source/com/sun/star/help/HelpIndexer.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmlhelp/source/com/sun/star/help/HelpIndexer.java?rev=1337602&r1=1337601&r2=1337602&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmlhelp/source/com/sun/star/help/HelpIndexer.java (original)
+++ incubator/ooo/trunk/main/xmlhelp/source/com/sun/star/help/HelpIndexer.java Sat May 12 18:03:10 2012
@@ -36,14 +36,6 @@ import java.io.IOException;
 import java.util.Date;
 import java.util.zip.ZipOutputStream;
 
-/**
-   When this tool is used with long path names on Windows, that is paths which start
-   with \\?\, then the caller must make sure that the path is unique. This is achieved
-   by removing '.' and '..' from the path. Paths which are created by
-   osl_getSystemPathFromFileURL fulfill this requirement. This is necessary because
-   lucene is patched to not use File.getCanonicalPath. See long_path.patch in the lucene
-   module.
- */
 public class HelpIndexer extends WeakBase
     implements XServiceInfo, XInvocation
 {

Modified: incubator/ooo/trunk/main/xmlhelp/source/com/sun/star/help/HelpSearch.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmlhelp/source/com/sun/star/help/HelpSearch.java?rev=1337602&r1=1337601&r2=1337602&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmlhelp/source/com/sun/star/help/HelpSearch.java (original)
+++ incubator/ooo/trunk/main/xmlhelp/source/com/sun/star/help/HelpSearch.java Sat May 12 18:03:10 2012
@@ -40,16 +40,21 @@ import org.apache.lucene.analysis.cjk.CJ
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
-import org.apache.lucene.search.Hits;
+import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.Searcher;
+import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.search.WildcardQuery;
+import org.apache.lucene.util.Version;
+import org.apache.lucene.store.NIOFSDirectory;
 
 import com.sun.star.script.XInvocation;
 import com.sun.star.beans.XIntrospectionAccess;
 
+import java.io.File;
+
 /** This class capsulates the class, that implements the minimal component and a
  * factory for creating the service (<CODE>__getComponentFactory</CODE>).
  */
@@ -249,9 +254,10 @@ public class HelpSearch
 		private static String[] queryImpl( String aLanguageStr, String aIndexStr, String aQueryStr, 
 			boolean bCaptionOnly, Object[] aScoreOutArray ) throws Exception
 		{
-			IndexReader reader = IndexReader.open( aIndexStr );
+			File aIndexFile = new File( aIndexStr );
+			IndexReader reader = IndexReader.open( NIOFSDirectory.open( aIndexFile ), true );
 			Searcher searcher = new IndexSearcher( reader );
-            Analyzer analyzer = aLanguageStr.equals("ja") ? (Analyzer)new CJKAnalyzer() : (Analyzer)new StandardAnalyzer();
+			Analyzer analyzer = aLanguageStr.equals("ja") ? (Analyzer)new CJKAnalyzer(Version.LUCENE_29) : (Analyzer)new StandardAnalyzer(Version.LUCENE_29);
 
 			String aField;
 			if( bCaptionOnly )
@@ -266,18 +272,18 @@ public class HelpSearch
 				aQuery = new TermQuery( new Term( aField, aQueryStr ) );
 
 			// Perform search
-			Hits aHits = searcher.search( aQuery );
-			int nHitCount = aHits.length();
+			TopDocs aHits = searcher.search( aQuery, 100 );
+			int nHitCount = aHits.totalHits;
 
 			String aDocs[] = new String[nHitCount];	
 			float aScores[] = null;
 			aScores = new float[nHitCount];
 			for( int iHit = 0 ; iHit < nHitCount ; iHit++ )
 			{
-				Document aDoc = aHits.doc( iHit );
-				String aPath = aDoc.get( "path" );
+				ScoreDoc aDoc = aHits.scoreDocs[iHit];
+				String aPath = searcher.doc(aDoc.doc).get( "path" );
 				aDocs[iHit] = ( aPath != null ) ? aPath : "";
-				aScores[iHit] = aHits.score( iHit );
+				aScores[iHit] = aDoc.score;
 			}
 			aScoreOutArray[0] = aScores;
 

Modified: incubator/ooo/trunk/main/xmlhelp/source/com/sun/star/help/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmlhelp/source/com/sun/star/help/makefile.mk?rev=1337602&r1=1337601&r2=1337602&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmlhelp/source/com/sun/star/help/makefile.mk (original)
+++ incubator/ooo/trunk/main/xmlhelp/source/com/sun/star/help/makefile.mk Sat May 12 18:03:10 2012
@@ -47,8 +47,8 @@ JARFILES  = ridl.jar jurt.jar unoil.jar 
 EXTRAJARFILES = $(LUCENE_CORE_JAR) $(LUCENE_ANALYZERS_JAR)
 JARCLASSPATH = $(EXTRAJARFILES)
 .ELSE
-JARFILES += lucene-core-2.3.jar lucene-analyzers-2.3.jar
-JARCLASSPATH = lucene-core-2.3.jar lucene-analyzers-2.3.jar
+JARFILES += lucene-core-2.9.4-dev.jar lucene-analyzers-2.9.4-dev.jar
+JARCLASSPATH = lucene-core-2.9.4-dev.jar lucene-analyzers-2.9.4-dev.jar
 .ENDIF
   
 JARTARGET	   	   = LuceneHelpWrapper.jar