How to analyze logical search queries

I need to parse a search query using boolean parameters. For example, if I have a request

(Mexico or Peru) and ((Air and Wind) or (Big and Little))

I want to create several subqueries based on operators. So this query will give me the following helper queries

Mexico, air, wind
Mexico, Large, Small
Peru, Air, Wind
Peru, Large, Small

Does anyone have an idea about an algorithm that I could use, or maybe a library that would help me with this?

Thanks!

+4
source share

Source: https://habr.com/ru/post/1340225/


All Articles