This tutorial covers a few ways to turn your search result summaries in to more relevant and effective snippets, helping your search users find the documents they need, quickly and efficiently.

Watch the video, or read below for full details.



Transform your search results page

One-size does not fit all when it comes to search engines which is why SearchUnit offers a number of ways to transform the summaries on your results page...



from something like this (which includes menu text);

Messy result summaries
in to something more useful and relevant, like this;

Clear result summaries

Ignoring sections (such as menus)

You probably have at least one section within your documents that you do not want to be indexed and shown to users. These could be navigational menus, or text in headers and footers for example. SearchUnit has a built-in way of ignoring regions within your documents. This allows you to tidy-up your search results summaries and show only the information that is pertinent to your users.

Of course SearchUnit also allows you to ignore whole documents that don't need to be indexed, but for this tutorial we'll be focusing on how to ignore sections of pages in-order for your search results to be more effective.

To ignore sections on a page, simply set these beginning and end tags around the sections you would like to be excluded;

<!--keyoti_search_ignore_begin-->

<div>Section to be ignored...</div>

<!--keyoti_search_ignore_end-->

The next time the document is indexed, everything within the ignore region will be missed. You can also change the ignore region tags to your own setting via the Configuration. Just change the values under 'Ignore Block Begin Pattern' and Ignore Block End Pattern'.

Boosting page & section weight

All kinds of HTML pages (ASPX etc) and sections of pages can be boosted in weight using comments. This will allow words in your document to be treated as more important and push the page higher up in the search results.

Simply place the following HTML comment immediately before the section (or entire page) that you would like to be boosted in weight.

<!--keyoti_search_weight_boost_factor="6"-->

In this example, all words following the comment will be weighted 6 times more than usual. To reset the weighting to normal, just reset the boost factor to 1. The boost factor is converted in to a single precision decimal and should be greater than 0. Sections with a weight factor of 0 will not be ignored but instead will result in the document being last in the results. If you would like to ignore a region altogether, please see the 'Ignoring Sections' part of this tutorial.

Change weighting with a plug-in

Another way of modifying word weighting in any document is by using a plugin. Simply create a plug-in project using the Index Manager tool. Within the plug-in project, find the code for the 'Calculate Word Relevancies' event like this;

   private void CentralEventDispatcher_Action(object sender, Keyoti.SearchEngine.Events.ActionEventArgs e)

{
   if(e.ActionData.Name== ActionName.CalculateWordRelevancies)
   {

   System.Collections.ArrayList words = e.ActionData.Data as System.Collections.ArrayList;
   Document document = sender as Document;
   if (document.Uri.AbsolutePath.Contains("/important/"))
   {
      foreach (Word word2 in words)
      {
         word2.Weight *= 2; //boost the weight of all words by 2, if they're in the /important/ subdir.
      }
   }
}

This example code will boost all words in documents located under the '/important' folder by 2x. Of course any criteria can be used, and specific words in the 'words' collection can be modified in weight.

Changing the result summary type

You may like to change where your descriptions come from when displaying your search results. Under the Configuration you will find the Result Summary Type setting. Here you can choose how your result summaries are created. Choices include using the description meta tag, the text at the start of the document or to by dynamically generated based on keyword matches. When changing between static types, you will need to reindex your documents for your changes to take effect.

Changing summary type

Summary word length

As each application is different, you may find showing more or less words in each of the summaries of the search result page is more effective for your end users. You can adjust the number of words shown in each of the summaries (when using the dynamic result summary type) under the Summary Word Length setting of the Configuration.

Changing summary type

Conclusion

These have been just some of the ways you can neaten up your search results pages and help end users find the information they are looking for. You can find further ways of customizing SearchUnit in the Help documentation and tutorials or contact us with any questions you may have.