shish / shimmie2

An easy-to-install community image gallery (aka booru)
http://code.shishnet.org/shimmie2/
GNU General Public License v2.0
404 stars 113 forks source link

OR operator #292

Open shish opened 11 years ago

shish commented 11 years ago

Can it be done without overloading the database?

discomrade commented 8 months ago

I am currently testing a basic OR operator: ~tag1 ~tag2 tag3 matches posts with tag3 and either tag1 and/or tag2 . ~tag1 ~tag2 -tag3 matches posts with either tag1 and/or tag2 , except any with tag3. Order doesn't matter, there can be any number of OR operations. It does not work with parentheses.

It also handles negated OR: ~tag1 ~-tag2 ~-tag3 matches posts either with tag1 or which don't contain tag2 or which don't contain tag3 (so a post with tag2 tag4 will match because it doesn't have tag3, but a post with tag2 tag3 will not match)

While I do think OR with parentheses is much easier to use and powerful, they're too advanced for my current experience with parsing and SQL. This format is common enough (used on e621ng, legacy operator on danbooru, documented but 'not working' on safebooru, even though another Gelbooru 0.2 site has parentheses working)