Write a library in C or rust so we can link it into all the other languages. If it is that complex, we'd benefit from a single implementation to get us started at least.
Discussion
Too bad I don't know either of those languages 😅 But it's actually not the compiler that's all that complex, it's writing the UI for it. The compiler has one or two hairy functions but they should be pretty easy to port over to something other than javascript.
Please make it a natural language query. Something like "All notes with hashtags A, B, F, and Y that have media" it should just ignore filler words that are not keywords. I'm happy to help, if you'd like.