Some basic questions

Hi, David and everyone,

I’ve had Ferret running fine in a production Rails application for a
while now. I haven’t updated Ferret or really looked at the
Ferret-related code since probably January, but I recently started
thinking about trying out the latest version (we were using 0.3.2, I
think). I got the latest (0.9.4) and have noticed things break. In
particular, I used to refer to the constant
Ferret::Analysis::StandardAnalyzer::ENGLISH_STOP_WORDS, but now when I
try to reference it I get an uninitialized constant error for
StopAnalyzer. Here’s an example IRB session:

 1  irb(main):001:0> require 'rubygems'
 2  => true
 3  irb(main):002:0> require_gem 'ferret'
 4  => true
 5  irb(main):003:0> Ferret::Analysis::StopAnalyzer
 6  NameError: uninitialized constant Ferret
 7          from (irb):3
 8  irb(main):004:0> require 'ferret'
 9  => true
10  irb(main):005:0> Ferret::Analysis::StopAnalyzer
11  NameError: uninitialized constant Ferret::Analysis::StopAnalyzer
12          from (irb):5
13  irb(main):006:0> Ferret::Analysis::StandardAnalyzer
14  => Ferret::Analysis::StandardAnalyzer
15  irb(main):007:0> Ferret::Analysis::StandardAnalyzer.superclass
16  => Ferret::Analysis::Analyzer

A few questions:

On line 8 – why is it necessary to require ‘ferret’ after doing a
require_gem ‘ferret’?

On lines 10 and 11 – why isn’t it finding StopAnalyzer? It’s defined in
the same file as StandardAnalyzer (lines 13 and 14).

On lines 15 and 16 – StandardAnalyzer is defined in
ferret-0.9.4/lib/ferret/analysis/analyzers.rb, and it’s a subclass of
StopAnalyzer. Yet when I try the superclass method, it returns Analyzer.
Any ideas why this is?

Maybe I’m missing something really obvious, but I’m finding it quite
perplexing right now.

Thanks!

Jen

P.S. David – thanks for Ferret! It’s been running great in our
production application. People love the app’s search capabilities,
including fuzzy search, which are of course all made possible by Ferret.

On 7/18/06, jennyw [email protected] wrote:

StopAnalyzer. Here’s an example IRB session:
10 irb(main):005:0> Ferret::Analysis::StopAnalyzer
11 NameError: uninitialized constant Ferret::Analysis::StopAnalyzer
12 from (irb):5
13 irb(main):006:0> Ferret::Analysis::StandardAnalyzer
14 => Ferret::Analysis::StandardAnalyzer
15 irb(main):007:0> Ferret::Analysis::StandardAnalyzer.superclass
16 => Ferret::Analysis::Analyzer

A few questions:

Hi Jenny,

On line 8 – why is it necessary to require ‘ferret’ after doing a
require_gem ‘ferret’?

Because I haven’t set the autorequire parameter in the gemspec. Until
30 seconds ago I wasn’t even aware of it so I’ll make sure it’s set in
futer versions.

On lines 10 and 11 – why isn’t it finding StopAnalyzer? It’s defined in
the same file as StandardAnalyzer (lines 13 and 14).

The code you are looking at is not the actual code that you are
running. All the analyzers are now defined in the extension (as long
as you have the extension loaded). Unfortunately I neglected to add
the StopAnalyzer. I’ll try and remember for the next version.

On lines 15 and 16 – StandardAnalyzer is defined in
ferret-0.9.4/lib/ferret/analysis/analyzers.rb, and it’s a subclass of
StopAnalyzer. Yet when I try the superclass method, it returns Analyzer.
Any ideas why this is?

Same reason as above.

Maybe I’m missing something really obvious, but I’m finding it quite
perplexing right now.

I’d suggest waiting for the next version. There are going to be a lot
of major changes. There will no longer be a pure Ruby version of
Ferret, (windows users no need to fret, there’ll be a windows binary).
I had hoped to get it out over the weekend but I still have a few
problems. I’ll announce it on the list as soon as it’s ready.

P.S. David – thanks for Ferret! It’s been running great in our
production application. People love the app’s search capabilities,
including fuzzy search, which are of course all made possible by Ferret.

I’m very happy to hear that.

Cheers,
Dave

On 7/18/06, David B. [email protected] wrote:

On 7/18/06, jennyw [email protected] wrote:

On lines 10 and 11 – why isn’t it finding StopAnalyzer? It’s defined in
the same file as StandardAnalyzer (lines 13 and 14).

The code you are looking at is not the actual code that you are
running. All the analyzers are now defined in the extension (as long
as you have the extension loaded). Unfortunately I neglected to add
the StopAnalyzer. I’ll try and remember for the next version.

Ok, that makes it sound like my process for creating the next release
is a bit dodgy. When I say “I’ll try and remember”, it is because I’m
rewriting most of the bindings and the API is changing a lot so there
will be a whole new set of unit tests. It is quite likely that a lot
of stuff will be left out, simply because I’m still working on it. So
please be patient. The next release, 0.10.0 will be very alpha quality
so

Thanks for the answers, David!

David B. wrote:

Ok, that makes it sound like my process for creating the next release
is a bit dodgy. When I say “I’ll try and remember”, it is because I’m
rewriting most of the bindings and the API is changing a lot so there
will be a whole new set of unit tests. It is quite likely that a lot
of stuff will be left out, simply because I’m still working on it. So
please be patient. The next release, 0.10.0 will be very alpha quality
so

Looks like you might have gotten cut off, but it sounds like you’re
saying that we should expect some issues with 0.10.0.

Out of curiosity, is there a recommended stable version of Ferret?
We’ve been running on 0.3.2 and it’s working well, so there’s no real
reason to change, but I thought I’d ask. The enhanced performance with
the later Ferret versions would be great but not necessary for our needs
on this project. We’re starting a new project this month, though, that
will be for a customer with a highly visited Web site, so I’ll probably
be putting 0.10.0 through its paces.

Thanks again!

Jen

On 7/18/06, jennyw [email protected] wrote:

Looks like you might have gotten cut off, but it sounds like you’re
saying that we should expect some issues with 0.10.0.

Yes, I was going to say don’t start porting your production apps to
0.10.0. I would however suggest that people starting new applications
should use 0.10.0 as soon as it comes out. It should quickly become
more stable than previous versions.

Out of curiosity, is there a recommended stable version of Ferret?
We’ve been running on 0.3.2 and it’s working well, so there’s no real
reason to change, but I thought I’d ask.

If you are currently using 0.3.2 I’d stick with that until the 0.10
series becomes stable which will hopefully be very soon.

The enhanced performance with
the later Ferret versions would be great but not necessary for our needs
on this project. We’re starting a new project this month, though, that
will be for a customer with a highly visited Web site, so I’ll probably
be putting 0.10.0 through its paces.

Good idea. I hope you like the new API.

Cheers,
Dave

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs