100 Scripts in 30 Days challenge: Script 5 & 6 — Fast Document Search & Indexing using Whoosh

Many a times I wanted a ready to use search option in Python but apart from some crude examples I never found a salable solution. And thats when I found Whoosh.

In this post I share 2 scripts. In my first “index_folder.py” script I show how we can index documents in a folder and its sub-folders.

In my second script “search_index.py” I share a simple way of searching the index and showing the results in an Html format with highlights of sections where you get a match.

More details about Whoosh can be found in the below link:

The code is given below.

For any further queries or feedback please contact me on twitter https://twitter.com/twitmyreview.