Search configuration overview

The search configuration is stored in WEB-INF/config/opencms-search.xml. The configuration is specified in the following XML format:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE opencms SYSTEM "http://www.opencms.org/dtd/6.0/opencms-search.dtd">

<opencms>
<search>
<cache>8</cache>
<directory>index</directory>
<excerpt>1024</excerpt>
<extractionCacheMaxAge>672.0</extractionCacheMaxAge>
<forceunlock>onlyfull</forceunlock>
<highlighter>org.opencms.search.documents.CmsTermHighlighterHtml</highlighter>
<timeout>60000</timeout>
<documenttypes>
...
</documenttypes>
<analyzers>
...
</analyzers>
<indexes>
...
</indexes>
<indexsources>
...
</indexsources>
</search>
</opencms>

Configuration nodes

Within the <search> node, these sub-nodes must be declared:

  • the <cache> node specifies the total number of cached search results
  • the <directory> node specifies the directory below the WEB-INF/ directory within the OpenCms web application where Lucene stores its index files
  • the <excerpt> node specifies the maximum character length of the excerpt in the search results
  • the <forceunlock> node defines how unlocking is handled by indexing threads. Valuas are: always, never and onlyfull(default)
  • the <highlighter> node specifies a class implementing org.opencms.search.documents.I_TermHighlighter to highlight the search terms in the excerpt.
  • the <timeout> node specifies the timeout value used to abort the indexing thread of a single resource
  • the <documenttypes> node has one or more <documenttype> sub-nodes that specify which Cms resource types and/or mimetypes are maped to a Lucene document factory
  • the <analyzers> node has one or more sub-nodes to specify the Lucene or snowball analyzer to be used for a certain locale
  • the <indexes> node has one or more sub-nodes to specify search indexes
  • the <indexsources> node has one or more sub-nodes to specify the contents for indexing

Example

For examples, see the next pages explaining the configuration of the various nodes. For a complete example, look into the default search configuration located at WEB-INF/config/opencms-search.xml in the OpenCms web application.