I'm looking for a way to parse some user-input. The input should show which searches have to be performed and how they have to be combined.
- 1 AND 2
- (3 AND 2) OR 1
- (3 AND 2) OR (1 AND 4)
- ( (3 OR 4) AND 1) OR 2
- etc.
The first example should combine the results of search 1 and 2 in an AND-fashion. The second example should combine the results of search 3 and 2 in an AND-fashion, and combine the results of this combination to the results of search 1 in an OR-fashion. Etc.
Any ideas on how to do this?