News for hackers. Stuff that matters.

Google doesn't like -2 * 2

Searching for "-2 * 2" or any other number between 1 and 9 in the format "-<num> * <num>" results in a long delay (~5 seconds) and empty SERP.
( 19 comments | 33 points | on HN )
Re:Google doesn't like -2 * 2 by jhanschoo on Friday July 06, 2018 @06:53AM (#17470380)
This also happens if you search for, say, -1 1. At the time of this comment, there has been multiple people hypothesizing behaviors like "confuses it" or "causing a loop". I offer a possible explanation more grounded in information retrieval basics.

Yes, one indeed is including and excluding the search term, ensuring that no results satisfy the query. Why does this take so long? Probably, Google evaluates a query until it retrieves the 30 or so most relevant results and returns them. But with the contradictory query, none are found, and so the retrieval continues until it times out.

But if you should try "-13 13", we do get results; this suggests that there is a mode of retrieval gated by the query terms being more than one character in length.

If we should try, say, "q -q", the number of results and retrieval time does not pop up. however, it seems to take comparably long to execute.

Trying out "c -c", however, we still get the no. of results display, along with the retrieval time. A card also pops up showing the calculation as interpreting c to be the speed of light.

Thus it seems that the results counter and retrieval time is displated whenever Google has something to say regarding the query, even if it is not a search result; but it does not display it when it has absolutely nothing to say. But even if it has nothing to say, it still spends the same large amount of time attempting to retrieve results.

Re:Google doesn't like -2 * 2 by imdsm on Friday July 06, 2018 @07:28PM (#17475896)
Very interesting investigation. Thanks for that. I played around with it for a while and wondered whether it may be a possible DoS attack vector, but the security team didn't think so. If it's retrieving the most relevant results and discarding them and grabbing more, perhaps it could be used nefariously to put a big load on Google's infrastructure. Maybe.

Interesting though, isn't it!

Re:Google doesn't like -2 * 2 by vinchuco on Friday July 06, 2018 @06:28AM (#17470283)
Ambiguous

- is used to exclude results

* is a wildcard

There's other search options i.e. for date ranges, "inurl:", "filetype:", and looking for exact string matches using quotes. But sometimes they don't work as well. Try:

  "define:-2*2"

  "2 * -2 * +2"
Re:Google doesn't like -2 * 2 by rcuv on Friday July 06, 2018 @06:39AM (#17470322)
Played around with this for a minute, interesting find. It seems to trigger a parsing ambiguity, but only for specific forms of that query.

Notably, this doesn't happen for other multiplies I randomly plugged in involving a positive and a negative. 2 * -2 has the same slow behavior as well, but if you remove the whitespace from the query, or rewrite the -2 as -(2) or (-2), it runs fast again.

Removing the white space from the query with the -2 as the first value doesn't speed it up, only adding the parens does.

I think the big clue to what's actually going on is on parses that run in the normal amount of time, Google also returns actual search results. I'm guessing the slowness is coming from the search service timing out, but the calculator service still returns, so you still get a result at all.

Good stuff, thanks for sharing.

Re:Google doesn't like -2 * 2 by imdsm on Friday July 06, 2018 @07:30PM (#17475906)
It's amazing that such a simple query could be discovered simply through my self-doubt at multiplying negative numbers.
Re:Google doesn't like -2 * 2 by aequitas on Friday July 06, 2018 @06:49AM (#17470358)
"-2 * 2" shows the calculator with the correct result.

As others mentions maybe the minus is seen as exclusion parameter. So I tried "-test test" which shows empty results. However searching "-2 2" (without the wildcard, shows an empty map tile with "Map for -2 2", funny.

Re:Google doesn't like -2 * 2 by fotcorn on Friday July 06, 2018 @09:37AM (#17471259)
This is not an empty map tile, it just so happens that theses coordinates are in the middle of the ocean:

https://www.google.com/maps/place/2%C2%B000'00.0%22S+2%C2%B0...

Re:Google doesn't like -2 * 2 by tvmalsv on Friday July 06, 2018 @08:14AM (#17470755)
I get the same result (the calculator), but it consistently takes 5 seconds for the calculator to appear with the result. There's also no side card on the right side or search results underneath the calculator.
Re:Google doesn't like -2 * 2 by milankragujevic on Friday July 06, 2018 @06:25AM (#17470272)
I think it might be related to the fact that you are excluding a keyword (-2) then including it (2). That confuses it, maybe causes a loop?
Re:Google doesn't like -2 * 2 by ltmi600 on Friday July 06, 2018 @08:58AM (#17471001)
It needs time to determine if you are searching the web for any text with "* 2" excluding (-) "-2". I'm sure that over time with enough of the same calculation requests from different users it will become much faster at producing the correct response, due to machine learning.
Re:Google doesn't like -2 * 2 by tomhoward on Friday July 06, 2018 @06:28AM (#17470284)
When I enter this in the Chrome search bar, it returns the correct answer immediately in the dropdown menu.

When I hit Enter to submit the search, there's a delay while it loads the calculator over my slow connection, then shows the calculator with the correct answer in the display.

No problem.

Re:Google doesn't like -2 * 2 by federicoponzi on Friday July 06, 2018 @06:22AM (#17470260)
Seems like there is some issues with the -2 without a space in them.

- 2 + 2 works fine while -2 + 2 does not. -2 +2 seems working though.

Also, try to search "-2" to get no results.

Re:Google doesn't like -2 * 2 by techno_modus on Friday July 06, 2018 @06:00AM (#17470185)
Same with "-2 + 2". Maybe it is loading its calculator implementation in JavaScript (including all dependencies).
Re:Google doesn't like -2 * 2 by DougBTX on Friday July 06, 2018 @06:25AM (#17470269)
Just "2 * 2" is near enough instant ("About 25,270,000,000 results (0.64 seconds)") but "2 * -2" takes its time ("About 0 results (5.16 seconds)").

Some sort of conflict between the "ignore keyword using hyphen prefix" and the "is it a calculation" detection, causing the search itself to time out and produce zero results? Searching with quotes ("2 * -2") is fast ("About 25,270,000,000 results (0.49 seconds)") but no calculator is shown.

Re:Google doesn't like -2 * 2 by aryamaan on Friday July 06, 2018 @06:28AM (#17470285)
but searching -200 * 21 gives an instant result.
Re:Google doesn't like -2 * 2 by mchahn on Friday July 06, 2018 @01:27PM (#17473314)
I don't know how long google has offered the calculator but I discovered it recently. I now use it daily. Awesome.
Re:Google doesn't like -2 * 2 by saxatrumpet on Friday July 06, 2018 @06:25AM (#17470274)
The time to complete the calculation was the same as 25*5 or any other calculation I tried.
Re:Google doesn't like -2 * 2 by varjag on Friday July 06, 2018 @06:22AM (#17470261)
No problem here (Norway).
Re:Google doesn't like -2 * 2 by gshock on Friday July 06, 2018 @07:01AM (#17470422)
the is no problem with +2 +2