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 TermVectorComponent is a search component designed to return additional information about documents<br />

matching your search.<br />

For each document in the response, the TermVectorCcomponent can return the term vector, the term frequency,<br />

inverse document frequency, position, and offset information.<br />

Configuration<br />

The TermVectorComponent is not enabled implicitly in <strong>Solr</strong> - it must be explicitly configured in your solrconfig<br />

.xml file. The examples on this page show how it is configured in <strong>Solr</strong>'s " techproducts" example:<br />

bin/solr -e techproducts<br />

To enable the this component, you need to configure it using a searchComponent element:<br />

<br />

A request handler must then be configured to use this component name. In the techproducts example, the<br />

component is associated with a special request handler named /tvrh, that enables term vectors by default<br />

using the tv=true parameter; but you can associate it with any request handler:<br />

<br />

<br />

true<br />

<br />

<br />

tvComponent<br />

<br />

<br />

Once your handler is defined, you may use in conjunction with any schema (that has a uniqueKeyField) to<br />

fetch term vectors for fields configured with the termVector attribute, such as in the techproductsfor<br />

example:<br />

<br />

Invoking the Term Vector Component<br />

The example below shows an invocation of this component using the above configuration:<br />

http://localhost:8983/solr/techproducts/tvrh?q=*%3A*&start=0&rows=10&fl=id,includes<br />

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

383

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

Saved successfully!

Ooh no, something went wrong!