Class | Ferret::Index::TermVector
In: | ext/r_index.c
Parent: | Object

## Summary

TermVectors are most commonly used for creating search result excerpts and highlight search matches in results. This is all done internally so you won‘t need to worry about the TermVector object. There are some other reasons you may want to use the TermVectors object however. For example, you may wish to see which terms are the most commonly occurring terms in a document to implement a MoreLikeThis search.

## Example

      tv = index_reader.term_vector(doc_id, :content)
      tv_term = tv.find {|tvt| tvt.term = "fox"}

      # get the term frequency
      term_freq = tv_term.positions.size

      # get the offsets for a term
      offsets = tv_term.positions.collect {|pos| tv.offsets[pos]}

## Note

`positions` and `offsets` can be `nil` depending on what you set the +:term_vector+ to when you set the FieldInfo object for the field. Note in particular that you need to store both positions and offsets if you want to associate offsets with particular terms.

### Classes and Modules

Class Ferret::Index::TermVector::TVOffsets
Class Ferret::Index::TermVector::TVTerm

[Validate]