You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2011/03/08 23:30:41 UTC

[Solr Wiki] Update of "TermVectorComponent" by YonikSeeley

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "TermVectorComponent" page has been changed by YonikSeeley.
The comment on this change is: generald doc cleanup, remove most JIRA issues, change examples to select for "includes" field which as termvectors, remove extraneous params, etc.
http://wiki.apache.org/solr/TermVectorComponent?action=diff&rev1=15&rev2=16

--------------------------------------------------

  
  == Enabling the TVC ==
  === Changes required in solrconfig.xml ===
- You need to enable the TermVectorComponent in your solr configuration:
+ You need to enable the TermVectorComponent in your solr configuration (this is already in the example solrconfig.xml):
  
  {{{
  <searchComponent name="tvComponent" class="org.apache.solr.handler.component.TermVectorComponent"/>
@@ -32, +32 @@

          </arr>
  </requestHandler>
  }}}
- === HTTP Requests ===
+ === Example Requests ===
- {{{http://localhost:8983/solr/select/?q=*%3A*&version=2.2&start=0&rows=10&indent=on&qt=tvrh&tv=true}}}
+ In the example schema, the "includes" field has term vectors enabled.  The following example HTTP request
+ asks for the term vectors of all documents with something in the includes field.
  
+ [[http://localhost:8983/solr/select/?qt=tvrh&q=includes:[*+TO+*]&fl=id|http://localhost:8983/solr/select/?&qt=tvrh&q=includes:[* TO *]&fl=id]]
+ 
- In the example, the component is associated with a request handler named tvrh, but you can associate it with any !RequestHandler.  To turn on the component for a request, add the {{{tv=true}}} parameter (or add it to your !RequestHandler defaults configuration).
+ In the example server, the component is associated with a request handler named tvrh, but you can associate it with any !RequestHandler.  To turn on the component for a request, add the {{{tv=true}}} parameter (or add it to your !RequestHandler defaults configuration).
  
  Example output: See TermVectorComponentExampleEnabled.
  
  == Options ==
- {{{http://localhost:8983/solr/select/?q=*%3A*&version=2.2&start=0&rows=10&indent=on&qt=tvrh&tv=true&tv.tf=true&tv.df=true&tv.positions&tv.offsets=true}}}
- 
   * tv.tf - Return document term frequency info per term in the document.
   * tv.df - Return the Document Frequency (DF) of the term in the collection.  This can be expensive.
   * tv.positions - Return position information.
   * tv.offsets - Return offset information for each term in the document.
   * tv.tf_idf - Calculates tf*idf for each term.  Requires the parameters tv.tf and tv.df to be "true". This can be expensive. (not shown in example output)
+  * tv.all - If true, turn on extra information (tv.tf, tv.df, etc)
+  * tv.fl - ([[Solr3.1]]) Provides the list of fields to get term vectors for (defaults to fl)
+  * tv.docIds - List of Lucene document ids (not the Solr Unique Key) to get term vectors for.
  
- Alternatively, a shortcut for all options on is:
+ An example HTTP request using these options:
  
+ [[http://localhost:8983/solr/select/?qt=tvrh&q=includes:[*+TO+*]&fl=id&tv.all=true|http://localhost:8983/solr/select/?qt=tvrh&q=includes:[* TO *]&fl=id&tv.all=true]]
-  * tv.all=true
- 
- Example output: See TermVectorComponentExampleOptions.
- 
- Schema requirements see: FieldOptionsByUseCase.
  
  === Per Field Options ===
- With https://issues.apache.org/jira/browse/SOLR-1556, it is now possible to specify per field options, similar to the way per field options work in faceting, as in
+ ([Solr3.1]) Options may be specified per-field, similar to the way per field options work in faceting, as in
  
   * f.fieldName.tv.tf - Turns on Term Frequency for the fieldName specified.
-  * Similar for all the other options above
+  * Similar for all the other options that are applicable to single fields
  
  '''''If you specify f.fieldName you must also explicitly declare &tv.fl or &fl'''''
  
@@ -80, +80 @@

  }}}
  If you do not specify per field options but still specify a field, it will assume the general options.
  
- == Other Options ==
-  * tv.fl - List of fields to get TV information from.  Optional.  If not specified, the fl parameter is used.
-   * As of https://issues.apache.org/jira/browse/SOLR-1556, If the field does not exist, an exception is thrown
-  * tv.docIds - List of Lucene document ids (not the Solr Unique Key) to get term vectors for.
- 
  == Warnings ==
- https://issues.apache.org/jira/browse/SOLR-1556
- 
  If a request field does not support the options specified, warnings will be returned indicating that the field does not support that option.  There are three types of warnings:
  
   1. noTermVector - The field does not store term vectors
@@ -99, +92 @@

  == SolrJ ==
  Neither the SolrQuery class nor the QueryResponse class offer specific method calls to set TermVectorComponent parameters or get the "termVectors" output. However, there is a patch for it: [[https://issues.apache.org/jira/browse/SOLR-949|SOLR-949]].
  
- == History ==
- [[https://issues.apache.org/jira/browse/SOLR-651|SOLR-651]] covers the development history.
-