Umbraco Examine Site Search

 

Examine uses Luscene.Net search engine to index nodes. Firstly we need to set up two files to index our nodes Luscene.Net  is based on. These files are 

  • /config/ExamineIndex.config
  • /config/ExamineSettings.config

In ExamineIndex.config file, we need to add a new indexset used for our specific needs.

Here is an example of an IndexSet.

Add it to within  tag.

In ExamineSettings file, add providers you wish to insert to providers tag for both ExamineIndexProviders and ExamineSearchProviders.

Here is an Example of indexer

Search example:

Modified the attribute of index and searcher's sub nodes as needed and make sure they are correctly set.

Note the naming of each provider's name attribute should comply with the convention that the name should end with indexer and searcher respectively.

 

Adding ASP.NET User Controls

Copy 2 user controls .ascx files to usercontrol folder and SiteSearch.dll to bin folder in your project folder.

SiteSearchGUI goes to usercontrol folder. It simply present front end search interface and redirects to search result page in the code behind. 

SearchResults.ascx shows search results returned by Examine.

In Umbraco, create 2 macros for each ASP.NET user control.

In the template where search GUI is needed, insert the macro that references SiteSearchGUI.ascx and test if redirection is made after a search button click in the front end.

In the template applied by the search result page, insert the second macro that shows the search result and test it works.

Share