On Wed, May 09, 2007 at 11:59:59PM +0200, Phillip Oertel wrote:
> require 'rubygems'
> require 'ferret'
> include Ferret
> 
> PATH = '/tmp/ferret_stopwords_test'
> 
> index = Index::IndexWriter.new(:path => PATH, :create => true)
> 
> index.analyzer = Analysis::StandardAnalyzer.new([])
> index << {:title => 'a few good men', :language => 'en'}
> 
> index.analyzer = Analysis::StandardAnalyzer.new(['men'])
> index << {:title => 'a few good men', :language => 'nl'}
> 
> index.close
> 
> searcher = Index::Index.new(:path => PATH)
> puts searcher.search('*:men AND language:nl').total_hits
> #=> 1
> 
> i'd expect zero results, as 'men' is a stopword at the time of indexing
> with language:nl. is this a bug or a lack of understanding on my part.

Queries get analyzed, too, i.e. to remove stop words from them. So
you'll have to use the correct language-dependent Analyzer for your
searcher, too.


Jens

-- 
Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
[EMAIL PROTECTED] | www.webit.de
 
Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to