jonathan
By:
jonathan

Articles and tutorials search not working for no results.

June 18, 2013 2.1k views
When I enter a search in "articles and tutorials", I get a spinner for a fraction of a second, and then nothing for searches like "reboot", "console" etc. I can see that the server is returning {"results":[],"search":"console"} but this isn't really helpful, as I thought search was just broken at first. It would help if "no results" showed "no results" so at least end users would know that search had run.
5 Answers
Searching works fine for me, it's probably a problem on your end. Can you please test with another browser?
Hmmm, well this is weird. I've now tried it on Safari 5.1.7, Opera 15.0.1147.56, Firefox 21.0 and IE 10.

Using basic dev tools I can see that the link that is request is
https://www.digitalocean.com/community/articles/search/?search=reboot
which returns

{
results: [ ],
search: "reboot"
}

If I do a search for something which has a result, like "Ubunutu", then of course, I get results
https://www.digitalocean.com/community/articles/search/?search=ubuntu

So, as expected, it's definitely your server returning the empty result for no results, but when you say "works fine for me", what message are you seeing to indicate there are no results?
Oh, we don't have any articles containing the word 'reboot'. The search box is only for articles and doesn't search questions.

You can find a list of all articles here: https://www.digitalocean.com/community/community_tags/all-articles
Yes, my point was (as per my original post) that it would help if "no results" showed "no results" so at least end users would know that search had run.
An empty array of results usually means there was nothing found. ;)
Have another answer? Share your knowledge.