Search Components

<!> Solr1.3 -- Search components enable a SearchHandler to chain together reusable pieces of functionality to create custom search handlers without writing code.

There are currently several "default" SearchComponents which now comprise the default SearchHandler. They are:

These examples are enabled by default, but can be overridden by writing your own class that extends SearchComponent and then declare it in the solrconfig.xml with the appropriate name. For instance, to override the "query" component, one would declare:

<searchComponent name="query"     class="my.app.MyQueryComponent" />

Other useful components are:

Components can also be initialized with NamedList params. For example, the Query Elevator (editorial boosting) can be declared with:

<searchComponent name="elevator" class="org.apache.solr.handler.component.QueryElevationComponent" >
    <!-- pick a fieldType to analyze queries -->
    <str name="queryFieldType">string</str>
    <str name="config-file">elevate.xml</str>
  </searchComponent>

Components can be reused by multiple instances of SearchHandler -- either by prepending (first-components), appending (last-components), or replacing (components) the default list...

<requestHandler name="/elevate" class="solr.SearchHandler">
    <!-- add my elevator component to the end of the default list -->
    <arr name="last-components">
      <str>elevator</str>
    </arr>
</requestHandler>
<requestHandler name="/simple" class="solr.SearchHandler">
    <!-- i don't want many of the defaults -->
    <arr name="components">
      <str>query</str>
      <str>debug</str>
    </arr>
</requestHandler>


see: http://www.nabble.com/search-components-%28plugins%29-tf3898040.html#a11050274

It was first introduce as part of SOLR-281

SearchComponent (last edited 2010-09-27 20:13:00 by AndrzejBialecki)