pip install whoosh
python
from whoosh import index
from whoosh.fields import Schema, TEXT, ID
from whoosh.qparser import QueryParser
schema = Schema(title=TEXT(stored=True), content=TEXT, path=ID(stored=True))
ix = index.create_in("index_dir", schema)
writer = ix.writer()
writer.commit()
searcher = ix.searcher()
query_parser = QueryParser("content", schema)
results = searcher.search(query)
for result in results:
print(result)
searcher.close()
ix.close()