Tuesday, October 18, 2011

Creating an ASP.NET Search Engine


Introduction

When I was working on an ASP.NET project, I had to add the site search module - this article demonstrates how. This search engine will index an entire page for matching keyword(s) or a phrase and will count how many times the keyword(s) or phrase are found on the page, and displays the results with the highest matches first.
The Search Engine module will search an entire page also dynamic pages for matching keyword(s) or a phrase and will count how many times the keyword(s) or phrase are found on the page, and display the results with the highest matches first. The module will search all files with the extensions that you can easily place the extension name into the web.config file where indicated. Files or folders that you don't want searched can be placed in the web.config where indicated, so these files and folders are not searched. Also now you can choose the encoding of your choice.
This updated article contains tips to globalize and enhance the code.
Note: It is best suited for small sites. Also you can modify this code to crawl pages internally by using regular expressions. For larger site you will need to write to XML file once periodically and then read from XML file. I have offered ti