Read google custom search in asp.net mvc for more information.
Google Custom Search helps you to add a search box to the website’s homepage. This, in turn, helps the site visitors to find what they want on the website. CSE works extremely well for a small as well as a large web application. For the benefit of the users, CSE is available free and also as a premium service.
How to Add CSE in ASP.Net MVC
You can follow these steps to add Google Custom Search in ASP.Net MVC.
- You need to first add a search controller to your website and then create a method Search().
- Next, add a form to accept the search string from the user.
- Now, add a view SearchResult.cshtml inside the search directory under views.
- Add the code in the CSE section taken from Google. For instance, you can register a callback function searchCallback, which will get executed once CSE loads.
- Remember, you need to do this code manually as it is not provided by Google by default.
Check out this video for more information:
You can also create your own custom search engine using Expertrec which is a great alternative
Here are steps to create your own custom search that has no search limits.
- Go to expertrec custom search engine.
- Enter your website URL.
- Enter your website sitemap URL (this ensures all your webpages are crawled correctly).
- Wait for the crawl to complete.
- Code to the code section and add it to your website.
- Take live.