Has anyone tried this?
I''m I the only one trying to group results from ferret?
Cheers,
Henke
1 jul 2008 kl. 14.43 skrev Henrik:
> Hi list,
>
> I have a problem grouping with ferret.
>
> I''m using the filter_proc from Dave''s book as seen below
>
> results = {}
> group_by_proc = lambda do |doc_id, score, searcher|
> doc = searcher[doc_id]
> (results[doc[:pk_file_id]]||=[]) << doc[:filename] <<
doc[:path]
> next true
> end
>
>
> The problem is that if I use this it ignores my limit clause.
>
> I set limit on 10 and I still get 5995 results and it takes several
> seconds.
>
> How come the limit clause is ignored when using a filter_proc? How
> can I change this behaviour?
>
>
> term = "wi"
>
> bool1 = Ferret::Search::BooleanQuery.new()
> bool1.add_query(Ferret::Search::PrefixQuery.new(:filename,
"#{term}"))
> bool1.add_query(Ferret::Search::PrefixQuery.new(:path,
"#{term}"))
>
> index.search(bool1, :limit => 10, :filter_proc => group_by_proc)
>
> puts result.size
> 5995
>
>
> Cheers,
> Henke
> _______________________________________________
> Ferret-talk mailing list
> Ferret-talk at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ferret-talk