On 9/8/06, Maxime Curioni <[EMAIL PROTECTED]> wrote:
> Hello Dave,
> Sorry for responding so late. I am actually using Ferret via the
> acts_as_ferret Rails plugin.
>
> I have a problem with small words, especially when I search for them
> between quotes. For example, I have indexed the following sentence:
> "e-commerce growth strategy for a major business to leverage key
> intangible assets"
>
> When I search for the sentence '"for a"' (not just 'for AND a' but the
> sentence "for a"), I don't get any results.

Hi Maxime,
It's not the length of the words that is the problem. If you did a
search for "cat" it would find it. The problem is that the default
analyzer which you are using removes common stop-words like "and",
"the", "a" and "for". You can create a StandardAnalyzer that doesn't
remove stopwords like this;

include Ferret::Index
include Ferret::Analysis

index = Index.new(:analyzer => StandardAnalyzer.new([]))

> Is there a way to impose to
> Ferret to return results _strictly_ containing certain words (i.e. exact
> results, not approximate results) ?

I'm not sure what you mean here. Can you give me an example where
Ferret returns approximate results?

> I am also experiencing problems with words containing special characters
> (especially words separated with dashes). Is there a way to send a raw
> query to Ferret without having to escape the special characters ?

words separated by dashes are treated as single words by the current
StandardAnalyzer but that will change in version 0.10.3. Here is an
example;

    require 'rubygems'
    require 'ferret'

    index = Ferret::I.new(:analyzer =>
Ferret::Analysis::StandardAnalyzer.new([]))

    index << "e-commerce growth strategy for a major business to
leverage key intangible assets"

    puts index.search("e-commerce")
    puts index.search("commerce")
    puts index.search("for a")

Currently the search for "commerce" won't return any results. In
version 0.10.3 both "e-commerce" and "commerce" and "e" for that
matter will find the document.

> Thank you for your help,
> Maxime Curioni
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to