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.
a workaround would be to close and reopen the index after every
language, that returns the expected zero, as expected. don’T know how
much overhead that would be.
i am on ruby 1.8.5 / os x.
any assistance would be greatly appreciated since i have no clue why
this happens …
cheers,
phillip