Hi Dave,
Wonderful! Thanks! I should have taken a deeper look at the
documentation, indeed. Anyway, thanks for your patience!
Cheers,
Al.
David Balmain wrote:
> On 9/30/06, Albert <[EMAIL PROTECTED]> wrote:
>> end
>> i.search_each(query) { |doc, score| ... }
>>
>> things work as expected (modulo the stemmming, of course). So, it may
>> be that I fundamentally misunderstand something or make a stupid mistake
>> ...
>>
>> Cheers,
>>
>> Albert
>>
>
> Sorry, I must have been tired last night. The problem is obvious to me
> now. You need to set the :fields parameter. The above query parser
> should work as long as you explicitly specify all fields in your
> query. For example:
>
> "content:(ruby rails) title:(ruby rails)"
>
> But if you want to search all fields by default then you need to tell
> the QueryParser what fields exist. The Index class will handle all of
> this for you including using the same analyzer as is used during
> indexing. It looks like you are using the Index class for your
> searches so why not just leave the query parsing to it. Otherwise you
> can get the fields from the reader.
>
> query = Ferret::QueryParser.new(
> :analyzer => Ferret::Analysis::StemmingAnalyzer.new,
> :fields => reader.fields,
> :tokenized_fields => reader.tokenized_fields
> ).parse(query_string)
>
> index.search_each(query) { |doc, score| ... }
>
> Hope that helps,
> Dave
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk