changeset 451:d726f62f886e

updated whoosh indexer to take index building argument type
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 03 Sep 2010 13:07:07 +0200
parents c3236d7febad
children f19d3ee89335
files pylons_app/lib/indexers/daemon.py
diffstat 1 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pylons_app/lib/indexers/daemon.py	Fri Sep 03 09:55:48 2010 +0200
+++ b/pylons_app/lib/indexers/daemon.py	Fri Sep 03 13:07:07 2010 +0200
@@ -184,8 +184,24 @@
             self.update_index()
         
 if __name__ == "__main__":
-    repo_location = '/home/marcink/hg_repos/*'
-    full_index = True # False means looking just for changes
+    arg = sys.argv[1:]
+    if not arg:
+        sys.stdout.write('Please specify indexing type [full|incremental]' 
+                         ' as script arg \n')
+        sys.exit()
+    if arg[0] == 'full':
+        full_index = True
+    elif arg[0] == 'incremental':
+        # False means looking just for changes
+        full_index = False
+    else:
+        sys.stdout.write('Please use [full|incremental]' 
+                         ' as script arg \n')
+        sys.exit()
+    
+    
+    repo_location = '/home/hg_repos/*'
+    
     try:
         l = DaemonLock()
         WhooshIndexingDaemon(repo_location=repo_location)\