Class: Ferret::Index::TermVector

### Home Classes Methods

### In Files

- ext/r_index.c

### Parent

Object

### Namespace

- CLASS Ferret::Index::TermVector::TVOffsets
- CLASS Ferret::Index::TermVector::TVTerm

### Files

- MIT-LICENSE
- README
- TODO
- TUTORIAL

### Class/Module Index

Quicksearch

- Ferret
- Ferret::BlankSlate
- Ferret::BoostMixin
- Ferret::Browser
- Ferret::Browser::Controller
- Ferret::Browser::Delegator
- Ferret::Browser::DocumentController
- Ferret::Browser::ErrorController
- Ferret::Browser::HelpController
- Ferret::Browser::HomeController
- Ferret::Browser::TermController
- Ferret::Browser::TermVectorController
- Ferret::Browser::ViewHelper
- Ferret::Document
- Ferret::Field
- Ferret::FieldSymbol
- Ferret::FieldSymbolMethods
- Ferret::FileNotFoundError
- Ferret::Index
- Ferret::Index::FieldInfo
- Ferret::Index::FieldInfos
- Ferret::Index::Index
- Ferret::Index::IndexReader
- Ferret::Index::IndexWriter
- Ferret::Index::LazyDoc
- Ferret::Index::LazyDoc::LazyDocData
- Ferret::Index::TermDocEnum
- Ferret::Index::TermEnum
- Ferret::Index::TermVector
- Ferret::Index::TermVector::TVOffsets
- Ferret::Index::TermVector::TVTerm
- Ferret::ParseError
- Ferret::QueryParser
- Ferret::QueryParser::QueryParseException
- Ferret::Search
- Ferret::Search::BooleanQuery
- Ferret::Search::BooleanQuery::BooleanClause
- Ferret::Search::ConstantScoreQuery
- Ferret::Search::Explanation
- Ferret::Search::Filter
- Ferret::Search::FilteredQuery
- Ferret::Search::FuzzyQuery
- Ferret::Search::Hit
- Ferret::Search::MatchAllQuery
- Ferret::Search::MultiSearcher
- Ferret::Search::MultiTermQuery
- Ferret::Search::PhraseQuery
- Ferret::Search::PrefixQuery
- Ferret::Search::Query
- Ferret::Search::QueryFilter
- Ferret::Search::RangeFilter
- Ferret::Search::RangeQuery
- Ferret::Search::Searcher
- Ferret::Search::Sort
- Ferret::Search::SortField
- Ferret::Search::Spans
- Ferret::Search::Spans::SpanFirstQuery
- Ferret::Search::Spans::SpanMultiTermQuery
- Ferret::Search::Spans::SpanNearQuery
- Ferret::Search::Spans::SpanNotQuery
- Ferret::Search::Spans::SpanOrQuery
- Ferret::Search::Spans::SpanPrefixQuery
- Ferret::Search::Spans::SpanTermQuery
- Ferret::Search::TermQuery
- Ferret::Search::TopDocs
- Ferret::Search::TypedRangeFilter
- Ferret::Search::TypedRangeQuery
- Ferret::Search::WildcardQuery
- Ferret::StateError
- Ferret::Store
- Ferret::Store::Directory
- Ferret::Store::FSDirectory
- Ferret::Store::Lock
- Ferret::Store::Lock::LockError
- Ferret::Store::RAMDirectory
- WEBrick
- WEBrick::FerretBrowserHandler
- Date
- DateTime
- FileUtils
- Float
- Integer
- String
- Symbol
- Time

No matching classes.

# Ferret::Index::TermVector

## 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.

## 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.

[Validate]

Generated with the Darkfish Rdoc Generator 2.