solrconfig.xml is usually the second file you configure when setting up a new Solr installation, after schema.xml.

The more commonly-used elements in solrconfig.xml are:

Data directory

Used to specify an alternate directory to hold all index data
other than the default ./data under the Solr home.
If replication is in use, this should match the replication configuration.

Query cache parameters

    <!-- There are two implementations of cache available for Solr,
        LRUCache, based on a synchronized LinkedHashMap, and
        FastLRUCache, based on a ConcurrentHashMap.  FastLRUCache has faster gets
        and slower puts in single threaded operation and thus is generally faster
        than LRUCache when the hit ratio of the cache is high (> 75%), and may be
        faster under other scenarios on multi-cpu systems. -->
    <!-- Cache used by SolrIndexSearcher for filters (DocSets),
        unordered sets of *all* documents that match a query.
        When a new searcher is opened, its caches may be prepopulated
        or "autowarmed" using data from caches in the old searcher.
        autowarmCount is the number of items to prepopulate.  For LRUCache,
        the autowarmed items will be the most recently accessed items.
        class - the SolrCache implementation LRUCache or FastLRUCache
        size - the maximum number of entries in the cache
        initialSize - the initial capacity (number of entries) of
          the cache.  (seel java.util.HashMap)
        autowarmCount - the number of entries to prepopulate from
          and old cache.

    <!-- Cache used to hold field values that are quickly accessible
        by document id.  The fieldValueCache is created by default
        even if not configured here.

   <!-- queryResultCache caches results of searches - ordered lists of
        document ids (DocList) based on a query, a sort, and the range
        of documents requested.  -->

  <!-- documentCache caches Lucene Document objects (the stored fields for each document).
      Since Lucene internal document ids are transient, this cache will not be autowarmed.  -->

Request handlers

Request handlers are responsble for accepting HTTP requests, performing searches, then returning the results.

The default request handler that comes configured with the example webapp, also known as the standard request handler, looks like this:

<requestHandler name="standard" class="solr.SearchHandler" default="true">
   <lst name="defaults">
     <str name="echoParams">explicit</str>
    <int name="rows">10</int>
    <str name="fl">*</str>
    <str name="version">2.1</str>

Every request handler has a configurable list of search components which performs the actual searching.

Default configuration in a requestHandler would look like:

<arr name="components">

These are described in the following section.

Search components

Search components extend the abstract class SearchComponent and are responsible for performing the actual searches.

By default, the following components are available:

<searchComponent name="query"     class="org.apache.solr.handler.component.QueryComponent" />
<searchComponent name="facet"     class="org.apache.solr.handler.component.FacetComponent" />
<searchComponent name="mlt"       class="org.apache.solr.handler.component.MoreLikeThisComponent" />
<searchComponent name="highlight" class="org.apache.solr.handler.component.HighlightComponent" />
<searchComponent name="stats"     class="org.apache.solr.handler.component.StatsComponent" />
<searchComponent name="debug"     class="org.apache.solr.handler.component.DebugComponent" />

Custom SearchComponents

Custom SearchComponents can be developed and added to solrconfig.xml. Note that these then have to be declared in a request handler's components stack to be actually used in a request.

There are 4 ways of doing this:

  1. Registering a custom SearchComponent under one of the 'standard' names, e.g. query
  2. Inserting before the 'standard' components.
    <arr name="first-components">
  3. Inserting after the 'standard' components.
    <arr name="last-components">
  4. Redeclaring components:
    <arr name="components">

Note: We've only covered the most commonly-used configuration elements. The Solr Wiki has an extensive list of config elements in solrconfig.xml.