O'Reilly logo

Umbraco User's Guide by Paul Sterling, Nik Wahlberg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

USING EXAMINE TO SEARCH CONTENT

As of Umbraco 4.5, Examine, which is a custom search engine built on Lucene.NET, comes standard as part of the backoffice search feature. Because of that, setting up indexers that you can use to search the content that is published on your website is relatively easy.

To setup Examine for your website, follow these simple steps.

  1. Configure a new index set in <install root>/config/ExamineIndex.config. To make this task easy, copy the InternalIndexSet that is already defined. For your reference, this is the one that is used to support the Umbraco backoffice searching. To set Examine up in your Runway site, copy the code in Listing 9-5.
  2. Create a searcher that you can attach to in your .NET code. This searcher specifies a number of settings, such as whether indexing should be handled asynchronously, the binaries to run the search, and which index set should be used when executing a search. All these settings appear in the <install root>/config/ExamineSettings.config. See Listing 9-6 for an example of a searcher for your Runway site. Add the bolded code in Listing 9-6 to your ExamineSettings.config file.
  3. Gain access to the indexes that are created when you publish a node. You do this by creating a .NET macro with the contents in Listings 9-7 and 9-8. For information on creating macros, see Chapter 5.
  4. Add the Search Results macro to a page or template so that you can call the URL in a browser. For example, add it to http://umbracousersguide.local/search-results.aspx ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required