What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 127 Stack Exchange communities.

tl;dr: Give the score search operator ability to change between greater than and less than.

I just noticed that searching for score:0 turns up only question with a score equal to 0. Searching for score:1 gives everything with a positive score. (>=1)

I can live with these. But here's the big one: score:-1.

I would expect it to give all the negatively scored posts - there is a minus sign in there.

But it doesn't. It gives all the posts >=-1. Greater than?

So, my is that we get more granular search options for score.

For example,

  • score:1 would show all posts with score == 1
  • score:1+ would show everything score >= 1
  • score:0 would show all posts with score == 0
  • score:-1 would show everything score == -1
  • score:-1- would show al posts where score <= -1

In short, the operator after the number would show which direction to go with the matching. A minus sign means less than, a plus sign means greater than. No sign means exact.

share|improve this question
add comment

3 Answers

up vote 23 down vote accepted

We use the Google number range style here which is simple: term:<min>..<max> where either min or max are optional as well. Here are some examples:

  • score:-2..2 means -2 to 2
  • score:..2 means <= 2
  • score:2..2 means == 2
  • score:-2.. means >= -2

I agree it's not obvious since score: 2 means >= 2, but I was not going to break an existing known syntax when adding the ability to search ranges as well.

share|improve this answer
    
I would have thought you add the [status-bydesign] tag. –  juergen d Jul 14 '13 at 16:07
    
@juergend there's a feature request in there...it's just already been completed in a different way. Programmers will argue about search syntax all day, so we just choose the best route we could: match google. –  Nick Craver Jul 14 '13 at 16:09
3  
Are you sure the last option works? score:1203..1500 works nicely, but score:1203.. gives 143,826 results...? –  Arjan Jul 14 '13 at 17:21
    
@Arjan it did, will look at the bug next time I'm at a comp –  Nick Craver Jul 14 '13 at 22:09
2  
@Arjan yep there was a bug that creeped in, all fixed now - same range operator works on dates now as well (the optional part didn't before). –  Nick Craver Jul 14 '13 at 23:15
    
This is not really documented, other than in the January announcement, right? Should we create a "How does search work"? –  Arjan Jul 15 '13 at 6:38
add comment

Use score:..-1 to search for posts having a score of -1 or lower.

And searching for an exact score: I don't know a use case where that one is helpful.

share|improve this answer
4  
Wow. Just. wow. –  Undo Jul 14 '13 at 14:32
9  
Yeah, that's totally obvious. Who wrote the grammar for this search algorithm? –  Richard J. Ross III Jul 14 '13 at 14:33
4  
That should be on the advanced search page. –  Undo Jul 14 '13 at 14:33
    
@RichardJ.RossIII Oded, obviously. Bots aren't known for their excellent grammar. –  Undo Jul 14 '13 at 14:34
    
@RichardJ.RossIII The range operator was borrowed from Google, where the unbounded lower range is simply an extension of that. –  Tim Stone Jul 14 '13 at 15:30
add comment

As @juergen d already said you can use option score:..-1 to search posts having score of -1 or lower.

In addition search engine allow to combine several score options in one search, e.g., for example, you can use request score:..-1 score:-1 to search posts having exact score -1 (e.g. -1 and lower and -1 and greater at same time).

Also, using option combination you can receive some complex search results, for example score:32 score:..34 give posts with score from 32 to 34.

share|improve this answer
5  
As a side note, you can combine it into a single option as score:32..34 –  Tim Stone Jul 14 '13 at 15:29
add comment

You must log in to answer this question.

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