These are some of the most important things to consider for a good websearch experience.
A. Tips for the search box
#1 Do You Need A Search Box?
If you have a small website, you might not need a search function. A small website is anything less than 100 pages, but it's a matter of preference.
#2 Avoid Icons
If you prefer a search function on your website, avoid having an icon (for example, a magnifier) that opens a popup with the search function. Instead, display the search field (a place where people can directly enter keywords and hit a search button), even on mobile.
#3 Consider Placement of The Search Box
Users expect a search box in the upper part of a website, most commonly in the upper-right area.
But central, in the upper part of the website, is good too.
#4 What Can Users Search On Your Website?
You should specify what users can search for (the most relevant categories, for example). Try not to put the text as a placeholder, but, instead, as a text above or below the search box.
#5 Search Box On The 404 pages
Add the search box to the 404 pages. If people get to an error page, they should be able to search your website.
An excellent example:
#6 Wide Search Box
The search box should be rather wide. Allow people to search for long queries.
The above image is an excellent example of this.
#7 Search Suggestion
It would help if you offered search suggestions.
#8 Promote Most Relevant Results
In the search suggestions list, promote the most relevant results. If you have top-selling products, or articles with high traffic, you should promote those products/articles in the suggestions. The above example shows that "laptops" and "gaming laptops" categories are the two most recommended options.
#9 Displaying Icon On Mobile
On mobile, consider showing a menu at the bottom of the page and including in that menu a search icon, which will bring up a search box.
#10 Avoid Complicated Search Queries
Avoid boolean queries altogether - don't use queries with "OR", "AND", "NEAR" - or similar other things. Most users don't use these correctly.
#11 Search Button
It's good to have a search field and a search button, and not just the input field where the submit event is expected to be hit on the Enter key of the keyboard.
#12 Allow Voice Input Search
You might consider allowing voice search.
B. Tips for the search results page
#1 Show Option To Change What Is Written
After a user searches for something, allow them to change what they wrote by repeating the query in the search box and the results page.
#2 Try A "Fuzzy"/Less Rigid Search
Sometimes, when you search on Google, they give you results even if the query doesn't match 100% with what you wrote. That's what you should also do - show some results, even for pages that would generally bring zero results.
#3 Check The Spelling
After a person searches for something, and they find no good results, you could tell them to:
-
Check to spell (and offer clickable results).
-
Search for a more straightforward query.
-
Search for less specific things.
Also, the message "There are no results for the query" should be crystal clear.
#4 Contact Details For Pages Without Results
For pages without any results, you could also give contact details.
#5 Create An Alert
For certain industries, like real estate, if someone searches for a property within specific criteria, you can allow the users to set an email alert for whenever a property becomes available.
#6 Offer Options To Sort/Filter Results
For example, if you're a news website, you can offer an option to sort by relevance (most relevant results first) or date (most recent results first).
If you're representing a real estate agency, allow expanding/narrowing down the search.
#7 Spelling Suggestions
If a person typed a keyword wrong, offer spelling suggestions.
Within this, it is also important to allow for synonyms - if someone searches for "laptops", the query should also include products like "notebooks". Terms like "netbook" or "ultrabook" could also be considered, but more as a fuzzy search. In the synonyms, do include words in the way people use them. If users type "120GB", you should know that this might imply "120 Gigabytes". If people search for "Net connection issues", you should know that they refer to the Internet.
#8 Group Results In The Search Results Page
If on a website one could search for multiple things (for example, songs, albums, and artists), you have two different options:
a. You should allow for filtering the results by type of results.
b. Another option would be to show results grouped by categories. So, within a long list of results, show some songs, albums, and artists, one beneath the other.
#9 Select Best Results
Let's say someone searches for "The Smashing Pumpkins". You should show results that contain the exact string ("The Smashing Pumpkins"), some results that start with the string ("The Smash..."), results that contain one of the beginnings of each word ("Th", "Smash", "Pump"), or results that show words that have part of the string ("Footpump"). Choosing this should be based on the specifics of the website. It might be necessary for some websites to go for an exact match; for others, there are more liberties to be taken.
This function is similar to Google's "I'm feeling lucky".
#10 Advanced Search
It's better to include it on the result page and not in the initial box of searching. Let users search for something and, only then, allow additional advanced queries.
Make it simple, initially, complicated if necessary.
The above is the default behavior on Google searches – one types something, they can refine their searches afterward.
#11 Infinite Scrolling
For SEO purposes, it's best to avoid infinite loading via JavaScript / AJAX on result pages. If you must use it, consider the example shown by this website: http://scrollsample.appspot.com/items
#12 Default Sort Criteria
It's best that the default sorting criteria for results is to be relevant. In most cases, this will do fine.
C. Finally, A tip For The Search, In General
You can set up Google Analytics to track searches on your website: Set up Site Search - Analytics Help.
This tip can help you understand what people are looking for when first entering the website. You can also build data and learn about the popular queries on products and services you don't currently offer.