pylucene 3.5.0-3
[pylucene.git] / samples / LuceneInAction / index.py
1
2 import os, sys, tarfile, lucene
3 lucene.initVM()
4
5 baseDir = os.path.dirname(os.path.abspath(sys.argv[0]))
6 sys.path.append(baseDir)
7
8 from lia.common.TestDataDocumentHandler import TestDataDocumentHandler
9
10 TestDataDocumentHandler.createIndex(os.path.join(baseDir, 'data'),
11                                     os.path.join(baseDir, 'index'),
12                                     False)
13
14 tar = tarfile.open(os.path.join(baseDir, 'indexes.tar.gz'), "r:gz")
15 while True:
16     member = tar.next()
17     if member is None:
18         break
19     print member.name
20     tar.extract(member, baseDir)
21 tar.close()