Mufaddal Khumri wrote:
> David Balmain wrote:
>> On 9/5/06, Mufaddal Khumri <[EMAIL PROTECTED]> wrote:
>>>
>>> index << {:name => "Lona"}
>>> index << {:name => "Frank"}
>>>
>>> index.optimize
>>>
>>> query = Search::TermQuery.new(:name, "Joe")
>> 
>> Your problem lies here. The AsciiStandardAnalyzer downcases all of the
>> data as it is entered into the index, so you should be searching for
>> "joe", not "Joe". Since you are using the Index class you can just do
>> it like this also;
>> 
>>     index.search_each("name:Joe", {:limit => :all}) do |doc, score|
>> 
>> In this case the QueryParser will downcase "Joe" for you.
>> 
>> Cheers,
>> Dave
> 
> Thanks.
> 

> I thought the AsciiStandardAnalyzer would be used by the 
> index.search_each(..) call. How do I specify a analyzer 
> (AsciiStandardAnalyzer) while searching the index? I thought that I 
> could specify the analyzer via the constructor for the Index class. 
> Later when I index data or search the index the set analyzer would be 
> used. Am I understanding this right?

Just read David's post carefully :)

I guess the QueryParser uses the analyzer set:
index.search_each("name:Joe", {:limit => :all}) do |doc, ....

My next question is how do I get the analyzer to be used when i create 
my query and search like this:

query = Search::TermQuery.new(:name, "Joe")
index.search_each(query, {:limit => :all}) do |doc, score| ....

Thanks.

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to