11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The Terms Component<br />

The Terms Component provides access to the indexed terms in a field and the number of documents that match<br />

each term. This can be useful for building an auto-suggest feature or any other feature that operates at the term<br />

level instead of the search or document level. Retrieving terms in index order is very fast since the<br />

implementation directly uses Lucene's TermEnum to iterate over the term dictionary.<br />

In a sense, this search component provides fast field-faceting over the whole index, not restricted by the base<br />

query or any filters. The document frequencies returned are the number of documents that match the term,<br />

including any documents that have been marked for deletion but not yet removed from the index.<br />

Configuring the Terms Component<br />

By default, the Terms Component is already configured in solrconfig.xml for each collection.<br />

Defining the Terms Component<br />

Defining the Terms search component is straightforward: simply give it a name and use the class solr.TermsC<br />

omponent.<br />

<br />

This makes the component available for use, but by itself will not be useable until included with a request<br />

handler.<br />

Using the Terms Component in a Request Handler<br />

The /terms request handler is also defined in solrConfig.xml by default.<br />

<br />

<br />

true<br />

false<br />

<br />

<br />

terms<br />

<br />

<br />

Note that the defaults for the this request handler set the parameter "terms" to true, which allows terms to be<br />

returned on request. The parameter "distrib" is set to false, which allows this handler to be used only on a single<br />

<strong>Solr</strong> core. To finish out the configuration, he Terms Component is included as an available component to this<br />

request handler.<br />

You could add this component to another handler if you wanted to, and pass "terms=true" in the HTTP request in<br />

order to get terms back. If it is only defined in a separate handler, you must use that handler when querying in<br />

order to get terms and not regular documents as results.<br />

Terms Component Parameters<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

378

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!