Class: Ferret::Analysis::StopAnalyzer
- Defined in:
- lib/ferret/analysis/analyzers.rb
Overview
Filters LetterTokenizer with LowerCaseFilter and StopFilter.
Direct Known Subclasses
Constant Summary collapse
- ENGLISH_STOP_WORDS =
An array containing some common English words that are not usually useful for searching.
[ "a", "an", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "no", "not", "of", "on", "or", "s", "such", "t", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with" ]
Instance Method Summary collapse
-
#initialize(stop_words = ENGLISH_STOP_WORDS) ⇒ StopAnalyzer
constructor
Builds an analyzer which removes words in the provided array.
-
#token_stream(field, string) ⇒ Object
Filters LowerCaseTokenizer with StopFilter.
Constructor Details
#initialize(stop_words = ENGLISH_STOP_WORDS) ⇒ StopAnalyzer
Builds an analyzer which removes words in the provided array.
43 44 45 |
# File 'lib/ferret/analysis/analyzers.rb', line 43 def initialize(stop_words = ENGLISH_STOP_WORDS) @stop_words = stop_words end |
Instance Method Details
#token_stream(field, string) ⇒ Object
Filters LowerCaseTokenizer with StopFilter.
48 49 50 |
# File 'lib/ferret/analysis/analyzers.rb', line 48 def token_stream(field, string) return StopFilter.new(LowerCaseTokenizer.new(string), @stop_words) end |