Re: [chandler-dev] chandlerdb and pylucene-2.4.1-1
Jacob Floyd <[email protected]> Sat, 11 Apr 2009 21:27:44 -0600 (MDT)
| Newsgroups | gmane.org.osaf.devel |
|---|---|
| Message-ID | <[email protected]> |
> That part of the Lucene store extensions needs to be reworked. > The changes should be minimal, look at the svn history of PyLucene's > test_PythonDirectory.py. That seems to have been just the ticket I needed. Based on the various changes visible in svn, I made a patch for chandlerdb/persistence/LuceneContainer.py which is attached (I hope that's ok on this list, if not let me know, and I'll post it some other way) It seems to work for me, all the tests apparently pass, but please do a sanity check on what I changed. > But, to do this properly, one needs to take on the task of upgrading > PyLucene in the chandler build. > > Given, at least, that no new functionality is introduced by this > upgrade that chandler lacks or desires, I don't think you'll get much > interest in it. ok. Well we'll see what happens with this patch then. Thanks for looking it over. Thank you, Jacob Floyd _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Open Source Applications Foundation "chandler-dev" mailing list http://lists.osafoundation.org/mailman/listinfo/chandler-dev
signature.asc
(application/pgp-signature, 271 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (GNU/Linux) Comment: Use GnuPG with Firefox : http://getfiregpg.org (Version: 0.7.5) iEYEARECAAYFAknhX7UACgkQfAvTH1QCRAZofgCgzM+X5dPA7jrdGvmta0p3WEwH B28AoLU3v4wXqVw0ukdOMnAtRhzBbN2A =+0Tc -----END PGP SIGNATURE-----
LuceneContainer.py.diff
(application/octet-stream, 2.1 KB)
--- chandlerdb/persistence/LuceneContainer.py 2008-03-30 21:45:24.000000000 -0600
+++ chandlerdb/persistence/LuceneContainer.py.new 2009-04-11 21:19:29.000000000 -0600
@@ -20,7 +20,7 @@
QueryParser, IndexReader, IndexWriter, IndexSearcher, Term, TermQuery, \
JavaError, MatchAllDocsQuery, BooleanQuery, BooleanClause, Hit, \
StringReader, PythonDirectory, PythonIndexOutput, PythonIndexInput, \
- PythonLock, PythonHitCollector, initVM, CLASSPATH, IOException
+ PythonLock, PythonHitCollector, initVM, CLASSPATH, IOException, JArray
initVM(CLASSPATH, maxstack='2m')
from chandlerdb.util.c import UUID
@@ -67,7 +67,7 @@
self.stream.seek(pos)
def flushBuffer(self, buffer):
- self.stream.write(buffer)
+ self.stream.write(''.join(buffer))
self.stream.flush()
class DbIndexInput(PythonIndexInput):
@@ -78,6 +78,7 @@
self.stream = stream
directory._streams.append(self)
self.directory = directory
+ self.isClone = clone
def length(self):
return long(self.stream.length)
@@ -88,12 +89,14 @@
def close(self):
if self.directory is not None:
- self.stream.close()
+ if not self.isClone:
+ self.stream.close()
+
self.directory = None
def readInternal(self, length, pos):
self.stream.seek(pos)
- return self.stream.read(length)
+ return JArray('byte')(self.stream.read(length))
def seekInternal(self, pos):
self.stream.seek(pos)
@@ -113,7 +116,7 @@
self._locks.clear()
def createOutput(self, name):
- return DbIndexOutput(self, self.fileContainer.createFile(name))
+ return DbIndexOutput(self, self.fileContainer.createFile(name))
def deleteFile(self, name):
if self.fileContainer.fileExists(name):
@@ -140,7 +143,7 @@
def openInput(self, name, bufferSize=0):
try:
- stream = self.fileContainer.openFile(name)
+ stream = self.fileContainer.openFile(name)
except RepositoryError:
raise JavaError, IOException(name)
return DbIndexInput(self, stream, bufferSize)