Example #1
0
        if ".docx" in file:
            file_names.append(file)
            # print(os.path.join(root, file))
if len(file_names) < 1:
    print('No "docx" file found in ' + doc_coll_path +
          ' directory for indexing. Exiting application.')
    sys.exit()
else:
    print('List of files found for indexing are:')
    for name in file_names:
        print(name, end=' ')
print('\n\n')

# Start indexing
i = Indexer()
i.createIndex(doc_coll_path, file_names)
# Indexing completed

# Start querying the search engine
q = QueryIndex()
# Read input query
print(
    '\n\nHello,\nEnter your search query and hit Enter key. Wrap your query in "" for searching a phrase.\nIf you want to exit, just hit Enter key!'
)
while True:
    query = input('\nEnter your search query: ')
    # q = sys.stdin.readline()
    if query == '':
        print('No input provided. Exiting the program.')
        print('\nBye, Have a great day!')
        break