| 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.
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.
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.
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
| The term mode is used for the business definition of a vertical, and the term tab used for the view definition of a vertical |
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"> </div> </div>