Sesat > Docs + Support > Development using the SFC > Developing a quick and simple Enrichment tutorial

This tutorial will give an overview on the most basic implementation of an enrichment.
It will refer to the Idol enrichment implemented for sesam.no in 2007.

The Search Command

Each enrichment is just a result list in a condensed format presented like a single result hit within the pages main result list.
Therefore the enrichment requires a result list and this must come from a search command. We could use the StaticCommand which always returns a single dummy result item in the result list, but this example will use the PropertiesCommand that performs a simple search within a specified .properties file.

PropertiesCommand and the properties file

Configure modes.xml for the PropertiesCommand in your vertical's mode like:

<properties-command id="idol" properties-filename="idol"/>

Create a new file idol.properties, for example:

Idol=
Jan\ Fredrik\ Karlsen=
Benedicte\ Adrian=
Asbjørn\ Slettemark=
Mariann\ Thomassen=

The PropertiesCommand will return hits if any of the keys are found within the user's query.

Triggering the execution of the search command

For the vertical/mode to include the enrichment's search command to be run it must be specified in views.xml within the corresponding vertical/tab like:

<enrichment base-score="1000" threshold="0" weight="6" command="idol"/>

This enrichment does

  • not refer to a rule since there is no analysis rules-based engine to determine the display, that is a result from the search command is the only determining factor,
  • specify a base score and a threshold with the base score above the threshold to ensure its inclusion,
  • specify a weight to ensure top placement of the enrichment over other enrichments, and
  • specify the associated command to run.
    The term mode is used for the business definition of a vertical, and the term tab used for the view definition of a vertical

Visual Design of the enrichment

Create a velocity template in the skin's template/enrichments folder giving it a name equal to the command name.
For example:

<div class="enrichment">
    <div class="enrich_img"><img src="/images/star.png" alt="stjerne" /></div>
    <div class="enrich_text">
        <b>Idol 2007</b><br/>
        #foreach ( $item in $datamodel.getSearch($commandName).results.results )
            So you think <strong>$item.getField('key')</strong> is going to win?
        #end
    </div>
    <div class="clearFloat">&nbsp;</div>
</div>
 © 2007-2009 Schibsted ASA
Contact us