Depends on how you produced your query. In general, your query has to
pass through the same analyzer that was used for indexing.

So, when building a PhraseQuery, for instance, you have to get each word
from the analyzer.

keywords.each {|keyword|
      query = Search::PhraseQuery.new(:fieldname)
      analyzer = StemmedAnalyzer.new
      tokenizer = analyzer.token_stream(:fieldname, keyword)
      while (token = tokenizer.next)
        query << token.text
      end
}

This is how I do it, it would be nicer if AAF would encapsulate this.

Regards,
Ewout

>Hello all,
>Quick question, I'm using AAF and the following custom analyzer:
>
>class StemmedAnalyzer < Ferret::Analysis::Analyzer
>  include Ferret::Analysis
>  def initialize(stop_words = ENGLISH_STOP_WORDS)
>    @stop_words = stop_words
>  end
>  def token_stream(field, str)
>    StemFilter.new(StopFilter.new(LowerCaseFilter.new
>(StandardTokenizer.new(str)),
>@stop_words))
>  end
>
>
>However when my search term includes a stop word I never get any results
>back.  Once I remove the stop word I get the normal results back.  Do I
>need to do a search of my query for stop words and remove them myself?
>Or is there something I'm doing wrong with passing my query to AAF?
>
>Thanks,
>Ray
>
>-- 
>Posted via http://www.ruby-forum.com/.
>_______________________________________________
>Ferret-talk mailing list
>[email protected]
>http://rubyforge.org/mailman/listinfo/ferret-talk


_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to