I'm building a parser to turn a search string with Boolean operators and nested parenthesis in it into SQL queries. A search string like "(Foo Bar) OR (Foo Baz)" generates
( "cards"."name" LIKE '%Foo%' AND "cards"."name" LIKE '%Bar%' ) OR
( "cards"."name" LIKE '%Foo%' AND "cards"."name" LIKE '%Baz%' )
OR and AND work fine like this, but NOT doesn't work as I expected. I've done some reading and it looks like it only modifies selectors? I'm pretty unfamiliar.
Is there a way to prefix group of selectors, so that something like "NOT (foo bar)" might expand to the functional equivalent of:
( "cards"."name" NOT LIKE '%Foo%' AND "cards"."name" NOT LIKE '%Bar%' )
Aucun commentaire:
Enregistrer un commentaire