mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 00:28:22 +00:00
Return the number of indexed documents
This commit is contained in:
parent
12dd16daf9
commit
f3d1ca052e
1 changed files with 6 additions and 0 deletions
|
@ -24,6 +24,7 @@ indexertype = cfg.get("Indexer", "type")
|
|||
|
||||
argParser = argparse.ArgumentParser(description='Fulltext search for AIL')
|
||||
argParser.add_argument('-q', action='append', help='query to lookup (one or more)')
|
||||
argParser.add_argument('-n', action='store_true', default=False, help='Return numbers of document indexed')
|
||||
args = argParser.parse_args()
|
||||
|
||||
from whoosh import index
|
||||
|
@ -33,6 +34,11 @@ schema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT)
|
|||
ix = index.open_dir(indexpath)
|
||||
|
||||
from whoosh.qparser import QueryParser
|
||||
|
||||
if args.n:
|
||||
print ix.doc_count_all()
|
||||
exit(0)
|
||||
|
||||
if args.q is None:
|
||||
argParser.print_help()
|
||||
exit(1)
|
||||
|
|
Loading…
Reference in a new issue