Functions for building a whoosh database and searching it