Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorBenjamin Saller <bcsaller@objectrealms.net>2007-06-05 04:46:45 (GMT)
committer Benjamin Saller <bcsaller@objectrealms.net>2007-06-05 04:46:45 (GMT)
commitd4aeda0a2bdfbaee764f49c47c5e8adf65ae944f (patch)
treef1c8cb0d5c3d121acd98ea91642404666c22f991 /bin
parentcf334ab618bd1a3ea5752bda7efd39976e600016 (diff)
indexing fixes
Diffstat (limited to 'bin')
-rwxr-xr-xbin/datastore4
-rwxr-xr-xbin/index-service55
2 files changed, 37 insertions, 22 deletions
diff --git a/bin/datastore b/bin/datastore
index ae8db9d..c50daf6 100755
--- a/bin/datastore
+++ b/bin/datastore
@@ -1,8 +1,8 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2.4
from ore.main import Application
from olpc.datastore import DataStore
from olpc.datastore.indexer import INDEX_SERVICE, INDEX_OBJECT_PATH
-import os, signal
+import os, signal, sys
import dbus
import dbus.mainloop.glib
diff --git a/bin/index-service b/bin/index-service
index 5db5b30..acc582c 100755
--- a/bin/index-service
+++ b/bin/index-service
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2.4
""" Async index service for the Datastore.
@@ -82,17 +82,32 @@ class IndexService(Application):
# create call we must actually get the filename and trigger
# the indexing on that
filename = self.ds.get_filename(uid)
- if filename: self.fulltext.fulltext_index(uid, filename)
- logger.debug("index creation of %s" % uid)
-
+ r = None
+ if filename:
+ r = self.fulltext.fulltext_index(uid, filename)
+ if r is True:
+ logger.debug("index creation of %s" % uid)
+ elif r is False:
+ logger.debug("unable to index creation of %s" % uid)
+ else:
+ logger.debug("nothing to index on creation of %s" % uid)
+
def updated(self, uid, props):
"""An object was updated on the bus and we want to index it"""
# because the file isn't encoded anywhere accessible in the
# create call we must actually get the filename and trigger
# the indexing on that
filename = self.ds.get_filename(uid)
- if filename: self.fulltext.fulltext_index(uid, filename)
- logger.debug("index update of %s" % uid)
+ r = None
+ if filename:
+ r = self.fulltext.fulltext_index(uid, filename)
+ if r is True:
+ logger.debug("index update of %s" % uid)
+ elif r is False:
+ logger.debug("unable to index update of %s" % uid)
+ else:
+ logger.debug("nothing to index on update of %s" % uid)
+
def deleted(self, uid):
"""An object was updated on the bus and we want to index it"""
@@ -122,22 +137,22 @@ if __name__ == "__main__":
signal.signal(signal.SIGTERM, handle_shutdown)
idx = IndexService()
- #idx()
+ idx()
# w/o ore.main
- idx.eventloop = gobject.MainLoop()
- class options(object): pass
- o = options()
- o.fulltext_dir = 'fulltext'
- idx.options = o
- try:
- idx.main()
- except:
- # force logging this one
- logger.setLevel(logging.DEBUG)
- logger.debug("Problem in index service",
- exc_info=sys.exc_info())
- idx.stopped()
+## idx.eventloop = gobject.MainLoop()
+## class options(object): pass
+## o = options()
+## o.fulltext_dir = 'fulltext'
+## idx.options = o
+## try:
+## idx.main()
+## except:
+## # force logging this one
+## logger.setLevel(logging.DEBUG)
+## logger.debug("Problem in index service",
+## exc_info=sys.exc_info())
+## idx.stopped()