Do you intend to ultimately support Java Lucene with GCJ ?
This would be great as there are several problems with GCJ and Java Lucene that I have been maintaining patches for in the PyLucene project (http://pylucene.osafoundation.org).
I'm in the process of upgrading PyLucene to using the just-released Lucene 1.4.2 and noticed that if I started from the lucene 1.4.2 jar file instead of from the lucene 1.4.2 sources many of these patches are no longer necessary.
As a matter of fact, I'm down to 3 patches:
- GCJH cannot generate a header file from QueryParser.class because there are one static field and one static method which have the same name (down from two in Lucene 1.4.1)
- The delete(int) and delete(Term) methods on IndexReader clash with the 'delete' c++ keyword. GCJ will generate them as 'delete$' which is a neat workaround; the problem, however, is that the dynamic linker, at least on Mac OS X, doesn't then properly link to these symbols and fails to load the resulting shared library. So I defined two synonym methods deleteDocument(int) and deleteDocuments(Term) in a patch to IndexReader.
- Because of GCJ bug 15411, http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15411, Searcher.java needs to be patched to define the missing method definitions
None of these patches are specific for PyLucene, would you consider incorporating them into the Lucene sources ?
The actual patches are included in the attached patches.lucene file.
Andi..
On Thu, 16 Sep 2004, Doug Cutting wrote:
I replaced InputStream with IndexInput and BufferedIndexInput, so buffering is now optional. InputStream is now deprecated and one can also now subclass FSDirectory.
Still to do:
1. Replace OutputStream with IndexOutput and BufferedIndexOutput. This is not critical and mostly for consistency, as mmap makes more sense for read-only data.
2. Update RAMDirectory and FSDirectory to no longer use deprecated classes. This is done last, to make sure that the earlier steps to not break back-compatibility for existing Directory implementations.
Also, I've implemented an mmap-based subclass of FSDirectory in C++ using GCJ. Any objections to checking this in under src/gcj? It's not yet much faster than the pure Java implementation, but perhaps it can be made faster, and it also provides an example of how to extend Lucene with C++ in GCJ, which might eventually lead to some big speedups.
Doug
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--- lucene-1.4.2/src/java/org/apache/lucene/queryParser/QueryParser.java Fri Oct 1 08:55:58 2004 +++ lucene-1.4.2-patched/src/java/org/apache/lucene/queryParser/QueryParser.java Sat Oct 2 11:07:01 2004 @@ -898,9 +898,9 @@ final private int[] jj_la1 = new int[22]; static private int[] jj_la1_0; static { - jj_la1_0(); + jj_la1_0_mth(); } - private static void jj_la1_0() { + private static void jj_la1_0_mth() { jj_la1_0 = new int[] {0x180,0x180,0xe00,0xe00,0xfb1f80,0x8000,0xfb1000,0x9a0000,0x40000,0x40000,0x8000,0xc000000,0x1000000,0xc000000,0x8000,0xc0000000,0x10000000,0xc0000000,0x8000,0x40000,0x8000,0xfb0000,}; } final private JJCalls[] jj_2_rtns = new JJCalls[1]; --- lucene-1.4.2/src/java/org/apache/lucene/index/IndexReader.java Wed Apr 21 09:46:30 2004 +++ lucene-1.4.2-patched/src/java/org/apache/lucene/index/IndexReader.java Sat Oct 2 11:42:13 2004 @@ -434,6 +434,12 @@ hasChanges = true; } + public final synchronized void deleteDocument(int docNum) + throws IOException + { + delete(docNum); + } + /** Implements deletion of the document numbered <code>docNum</code>. * Applications should call [EMAIL PROTECTED] #delete(int)} or [EMAIL PROTECTED] #delete(Term)}. */ @@ -459,6 +465,13 @@ } return n; } + + public final int deleteDocuments(Term term) + throws IOException + { + return delete(term); + } + /** Undeletes all documents currently marked as deleted in this index.*/ public final synchronized void undeleteAll() throws IOException{ --- lucene-1.4.2/src/java/org/apache/lucene/search/Searcher.java Mon Mar 29 14:48:04 2004 +++ lucene-1.4.2-patched/src/java/org/apache/lucene/search/Searcher.java Sat Oct 2 12:31:44 2004 @@ -17,6 +17,8 @@ */ import java.io.IOException; +import org.apache.lucene.index.Term; +import org.apache.lucene.document.Document; /** An abstract base class for search implementations. * Implements some common utility methods. @@ -85,4 +87,31 @@ public Similarity getSimilarity() { return this.similarity; } + + abstract public void close() + throws IOException; + + abstract public int docFreq(Term term) + throws IOException; + + abstract public int maxDoc() + throws IOException; + + abstract public Document doc(int i) + throws IOException; + + abstract public Query rewrite(Query query) + throws IOException; + + abstract public Explanation explain(Query query, int doc) + throws IOException; + + abstract public void search(Query query, Filter filter, HitCollector results) + throws IOException; + + abstract public TopDocs search(Query query, Filter filter, int n) + throws IOException; + + abstract public TopFieldDocs search(Query query, Filter filter, int n, Sort sort) + throws IOException; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]