Kentico CMS Quick Tip - Smart Search without User Input
Today I'm writing a small quick tip type of post that allows you to customize the Smart search wep parts inside of Kentico CMS in a way that I think helps the usability of searching Kentico based web sites.
Kentico's Smart search web parts easily create functionality that allow you to have a very powerful search engine right at your own disposal. The built-in functionality indexes your site's content and displays search results that are ranked based on relevancy. Trust me, it's much more than just a SQL WHERE clause. I'm not trying to cover the entire spectrum of search inside a Kentico site so if you are not used to using the Smart search check out the Smart Search documentation on Kentico's Devnet.
When you add a Smart search dialog with results web part and configure it to search your site, you may notice that if you don't type anything into the input box and click the search button, generally there are no results returned. Now when I first ran into this I thought it was because I did something wrong while setting one of the web part's properties, however a quick double check showed that I had it setup correctly.
I worked on a bit more and ended up not having any luck, so after a quick email to the great Kentico support team, I was quickly informed of a not so widely know web.config tweak. The support team reccomended that I add the following key to my application settings node in the main web.config file of my installatton.
When this key is present in the web.config file, the Smart search will perform the search operation without any text present in the input box. This also helps out if you are using Smart search Filters to filter your search results.
So there you have it, by adding this key into your application settings you can now search without forcing the user to enter at least a few characters.