Thank you @cpradio for help with finding the correct file.
For the beginning, I added a simple version of search operator “not” (~) for tags. Currently it has the highest precedence and I implemented it as I described above. But I am wondering if it would be better for ‘+’ or ‘,’ to have higher precedence? And should it be possible to combine all operators? What way would be the best for users to construct their queries?
Pull request: Add search not operator by kasiabulat · Pull Request #5467 · discourse/discourse · GitHub