Alright, so for a while, I've had this PR cooking over on the github which creates a new tag syntax that allows for one thing I see requested so often which isthe ability to make groups of OR requests. The details and implementation are not important to the context of this topic.
However, the primary pushback I see is that the syntax doesn't make sense, or is too different. But this feature is probably one of the most requested features that I know of, so push forward I must.
So here I am, asking you how you would like to see this implemented?
Here's a few things to consider:
- The syntax should support being able to do OR NOT, which the current syntax doesn't actually support as ~-tag not only looks weird, but it only checks for the starting character.
- My syntax fixes this by separating OR from the tags: tag1 ~ -tag2 reads as "tag1 or not tag2"
- The syntax should support proper grouping regardless of operator.
- This is because supporting this allows implicit support of allowing multiple OR group chaining, which is the main point of the request
- As in being able to search for posts with "tag1 and tag2, or tag3 and tag4" which for my syntax would look like ( tag1 tag2 ) ~ ( tag3 tag4 )
- Or "tag1 or tag2, and tag3 or tag4", which would be the opposite: ( tag1 ~ tag2 ) ( tag3 ~ tag4 )
- What's important here is that the groups resolve separately, meaning that, in the first example either group has to pass because the OR is between the two groups, and in the second example both groups have to pass because the default operator is AND, however the ORs are within the groups so tag1 and tag4 work, or tag2 and tag3, or tag1 and tag3, you get the idea.
- This syntax allows for complex queries like: ( tag1 tag2 ~ ( tag3 tag4 ) ) ~ tag5 which would mean posts that have (tag1 AND (tag2 OR (tag3 AND tag4))) OR tag5, the parentheses in the explanation are just to properly show the order.
- Basically operators shouldn't care what comes before or after it, being a tag or group
- This means that ~( tag1 tag2 ) ~( tag3 tag4 ) isn't exactly great because that means that every tag inside the group is AND'd (or OR'd, it's kinda ambiguous) together, which isn't always wanted
- The syntax has to consider tag rules
- For example have tags that end with ) so groups either need to be a difference character, or be separated by spaces, which is what I've done with my syntax
I personally don't think it's possible to make a fully backwards compatible system with the rules currently defining our search syntax since it's so limited, but perhaps you can think of one that meets these requirements, isn't too far off what we already have, and can be agreed upon by users.
Again the programming behind it doesn't matter, and it's basically already done this is solely for the syntax which is changes to the tokenizer, rather than the logic.
Offtopic programmer jargon
I can't say for sure this will be implemented as-is, because my ruby is not the best, so it might have to be rewritten, which would obviously add time to it hitting the site.
I can't say it will be implemented at all, since that's out of my power.
I'm just the guy that is utilizing the open source nature of the site to push ideas onto the table that might be worth pursuing
Updated