5

I just noticed that one of my Stackoverflow-search-bookmarks no longer displayed all the questions in the tags I want. After some experimenting I could reduce it to the following issue:

It used to be that if you visited the page /questions/tagged/foo or bar baz, the performed search would be foo OR (bar AND baz), however somewhat recently it must have changed to (foo OR bar) AND baz, which broke my bookmark.

I think the old behavior was preferable because:

  1. Traditionally (i.e. in maths and most programming languages) AND binds tighter than OR.
  2. It is IMHO the more useful behavior.
  3. The tag list at the right of the tagged-page (see screenshot below) definitely makes it look as if you were searching for "questions tagged foo or questions tagged bar and baz", not "questions tagged foo and baz or questions tagged bar and baz" (which is the new behavior).

tag list

If this change was indeed intentional, I would at least ask that the list of searched tags is changed to visually indicate the new behavior (either by adding parentheses or by changing it to display as "foo baz or bar baz").

2 Answers 2

3

I just fixed it so OR always has lower precedence than the rest.

I agree it feels really inconsistent to have a left-to-right parse decide this.

This all happened we ported the question by tag engine to an in-memory structure. You should have noticed that questions-by-tag and family got much faster in the last 2 weeks. The new engine averages 0ms per search which is awesome.

The fact we have the engine also means we can extend it to support fancy grouping if it makes sense, but I see no point in adding such a feature if only 2 people know how to use it.

For now, I hope status quo is restored

0
4

This was likely broken when search was overhauled recently.

Personally, I find the current syntax ambiguous and confusing; certainly the results of the searches can be unpredictable (don't get me started on the NOT operator), which is really frustrating.

Anyway, based on the new results, I would have thought the syntax was changed to simply evaluate left-to-right, which would let you do bar baz or foo (your original search). Buuuuuut that's not the case; it returns bar AND (baz OR foo), so it seems OR has higher precedence (edit: the behaviour is inconsistent -- see comments).

The solution is to fix this properly by reverting the operator precedence (I agree), and allowing for unambiguous syntax with bracketing.

2
  • Actually, I think it is left to right now. At least moving the AND-case to the front seems to have fixed the issue (c++ templates or ruby or ... finds questions that are tagged ruby and only ruby just fine). So +1 for finding a workaround (even if you said it didn't work ;-) )
    – sepp2k
    Jun 7, 2011 at 2:15
  • @sepp: If it works for that example, great, but from what I tried here, it appears to be inconsistent: meta.stackexchange.com/questions/tagged/… vs meta.stackexchange.com/questions/tagged/… EDIT: in fact, looking at the results carefully, I'm not sure it works at all.
    – Jon Seigel
    Jun 7, 2011 at 2:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .