Using Multi Search Engine

I have cut a version of the Multi Search Engine code it is stored in google’s SVN repository, you will need to have an SVN client to get the code onto your machine.

In the version is the following projects:

  • MCromwell.MultiSearchEngine.Domain – Interfaces/Classes that mirror the domain
  • MCromwell.MultiSearchEngine.Google – A plugin search engine implementation that uses google
  • MCromwell.MultiSearchEngine.Google.Test – Unit tests against the above
  • MCromwell.MultiSearchEngine.Msn – A plugin search engine implementation that uses msn search
  • MCromwell.MultiSearchEngine.Msn.Test – Unit tests for the above
  • MCromwell.MultiSearchEngine.Repository.Xml – Contains an XML implementation of a repository that provides persistence for the search engines the app should use
  • MCromwell.MultiSearchEngine.Repository.Xml.Test – Unit tests for the above
  • MCromwell.MultiSearchEngine.UI.Windows – Actual forms app
  • MCromwell.String.Util – Provides string tokenizer
  • MCromwell.String.Util.Test – Unit tests for above

Implementing a Pluggable Search Engine

To create your own pluggable search engine you can either inherit from the AbstractSearchEngine in your class or just implement the ISearchEngine interface, the AbstractSearchEngine class helps with paging and allows you to just concentrate on grabbing the results from the search engine you wish to use.

In my examples I have used the excellent HtmlAgilityPack that can be downloaded from codeplex it’s an open source project that contain objects that help deal with working with html using xpath.

Once you have your class compiled you need to drop the DLL into the same folder as the

windows app and update the search engines configuration file “searchengines.config.xml”

    <!-- other search engine config here.... -->

The next time the app is ran it will pick up the new search engine, make sure that any other dependencies are copied into the app folder, or the type won’t be able to load.Please feel free to change the code in anyway and if you have any comments by all means post them here.