Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Saller <bcsaller@objectrealms.net>2007-07-13 15:49:47 (GMT)
committer Benjamin Saller <bcsaller@objectrealms.net>2007-07-13 15:49:47 (GMT)
commita0613664b4c32676a5c4b6681279eef8606b47cf (patch)
tree9c6395115b9104f8e17c4e90ba6b1bcaaffb3660
parent5b1b6738f438a6607179ee139ccdc8dc095f24ec (diff)
flush after change
-rwxr-xr-xbin/sample-client.py13
-rw-r--r--src/olpc/datastore/xapianindex.py8
-rw-r--r--tests/funkyabi.odtbin0 -> 2603 bytes
-rw-r--r--tests/test_conversion.py4
4 files changed, 22 insertions, 3 deletions
diff --git a/bin/sample-client.py b/bin/sample-client.py
index 2a2b19c..12c5514 100755
--- a/bin/sample-client.py
+++ b/bin/sample-client.py
@@ -59,7 +59,20 @@ def main():
else:
print "Found deleted value... oops"
raise KeyError(uid)
+
+
+ uid2 = datastore.create(dict(title="cows",
+ mime_type="application/vnd.oasis.opendocument.text"),
+ os.path.abspath('tests/funkyabi.odt'))
+
+ datastore.complete_indexing()
+ assert datastore.find(dict(fulltext="vaca"))[0][0]['uid'] == uid2
+ print "found in binary file :: ODT"
+
+ datastore.delete(uid2)
+ datastore.complete_indexing()
+
print "ALL GOOD"
if __name__ == '__main__':
diff --git a/src/olpc/datastore/xapianindex.py b/src/olpc/datastore/xapianindex.py
index c0f1665..7cb54b6 100644
--- a/src/olpc/datastore/xapianindex.py
+++ b/src/olpc/datastore/xapianindex.py
@@ -154,14 +154,18 @@ class IndexManager(object):
(uid, operation))
continue
- # XXX: this isn't quite true, we haven't called flush
- # yet so the document might not be on disk
+ # we do flush on each record now
+ self.flush()
+
logger.info("Indexed Content %s:%s" % (uid, vid))
# but we still tell the queue its complete
self.queue.task_done()
except Empty:
pass
+ except:
+ logger.exception("Error in indexer")
+
## except:
## import traceback
## traceback.print_exc()
diff --git a/tests/funkyabi.odt b/tests/funkyabi.odt
new file mode 100644
index 0000000..1850b47
--- /dev/null
+++ b/tests/funkyabi.odt
Binary files differ
diff --git a/tests/test_conversion.py b/tests/test_conversion.py
index 1b4b773..aa6f1a9 100644
--- a/tests/test_conversion.py
+++ b/tests/test_conversion.py
@@ -12,11 +12,13 @@ class Test(unittest.TestCase):
'test.pdf' : 'Don\'t',
'test.doc' : 'amazed.',
'test.odt' : 'amazed.',
- 'plugger.pdf' : 'Plugger'
+ 'plugger.pdf' : 'Plugger',
+ 'funkyabi.odt' : 'vaca'
}
for fn, expect in fn_expectations.iteritems():
assert expect in converter(fn).read()
+
def test_suite():
suite = unittest.TestSuite()