Forum: Ferret bug when assigning new analyzer?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
E5f0f1587d8356e859354e9b9cebc762?d=identicon&s=25 Phillip Oertel (phillipoertel)
on 2007-05-09 23:59
require 'rubygems'
require 'ferret'
include Ferret

PATH = '/tmp/ferret_stopwords_test'

index = => PATH, :create => true)

index.analyzer =[])
index << {:title => 'a few good men', :language => 'en'}

index.analyzer =['men'])
index << {:title => 'a few good men', :language => 'nl'}


searcher = => PATH)
puts'*: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 ...

E5f0f1587d8356e859354e9b9cebc762?d=identicon&s=25 Phillip Oertel (phillipoertel)
on 2007-05-10 00:04
* addendum 1: i use ferret 0.11.4

* addendum 2: when i comment out the first index.analyzer assignment, i
/Users/phillip/Sites/ruby/playground/ferret_stopwords.rb:13: [BUG] Bus
ruby 1.8.5 (2006-12-25) [i686-darwin8.8.2]

* addendum 3: the underlying problem i have is that i have many
different languages that have to be correctly indexed. is there a best
practise how to do that? i mean, better than having one index and
switching the analyzer around?

thanks again,
C9dd93aa135988cabf9183d3210665ca?d=identicon&s=25 Jens Kraemer (Guest)
on 2007-05-10 09:34
(Received via mailing list)
On Wed, May 09, 2007 at 11:59:59PM +0200, Phillip Oertel wrote:
> 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 Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66 |

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa
E5f0f1587d8356e859354e9b9cebc762?d=identicon&s=25 Phillip Oertel (phillipoertel)
on 2007-06-06 20:20
hi jens,

thanks for making that clear, and sorry for the long delay in replying.
we were quite busy.

This topic is locked and can not be replied to.