@futurebird @Jirikiha You might be able to build something with #Lucene (https://en.wikipedia.org/wiki/Apache_Lucene#Lucene-based_projects) or, for a much more lightweight option, with #Xapian (https://en.wikipedia.org/wiki/Xapian).
You'd still have to build something yourself from those though. For Xapian, looking at the source for #mu4e and #mu would probably be usable as a decent example (https://www.djcbsoftware.nl/code/mu/).
You'd also need to figure out some way to feed data exports from those into it.
All of my suggestions are #FreeSoftware & gratis.