Changeset - f19d3ee89335
[Not reviewed]
default
0 1 0
Marcin Kuzminski - 15 years ago 2010-09-03 13:15:16
marcin@python-works.com
updated whoosh indexer to take path as second argument
1 file changed with 14 insertions and 6 deletions:
0 comments (0 inline, 0 general)
pylons_app/lib/indexers/daemon.py
Show inline comments
 
@@ -182,28 +182,36 @@ class WhooshIndexingDaemon(object):
 
            self.build_index()
 
        else:
 
            self.update_index()
 
        
 
if __name__ == "__main__":
 
    arg = sys.argv[1:]
 
    if not arg:
 
        sys.stdout.write('Please specify indexing type [full|incremental]' 
 
                         ' as script arg \n')
 
    if len(arg) != 2:
 
        sys.stderr.write('Please specify indexing type [full|incremental]' 
 
                         'and path to repositories as script args \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')
 
                         ' as script first arg \n')
 
        sys.exit()
 
    
 
    
 
    repo_location = '/home/hg_repos/*'
 
    if not os.path.isdir(arg[1]):
 
        sys.stderr.write('%s is not a valid path \n' % arg[1])
 
        sys.exit()
 
    else:
 
        if arg[1].endswith('/'):
 
            repo_location = arg[1] + '*'
 
        else:
 
            repo_location = arg[1] + '/*'
 
    
 
    try:
 
        l = DaemonLock()
 
        WhooshIndexingDaemon(repo_location=repo_location)\
 
            .run(full_index=full_index)
 
        l.release()
0 comments (0 inline, 0 general)