It''s working here;
require ''ferret''
include Ferret
include Ferret::Index
i = Index.new
i << {:a => "one", :b => 1}
i << {:a => "two two", :b => 2}
i << {:a => "three three three", :b => 3}
i << {:a => "four", :b => 4}
i.search_each("one two three four") do |d, s|
puts "#{s} => #{i[d]}"
end
# 0.0612355209887028 => Document {
# stored/uncompressed,indexed,tokenized,<b:1>
# stored/uncompressed,indexed,tokenized,<a:one>
# }
# 0.0612355209887028 => Document {
# stored/uncompressed,indexed,tokenized,<b:4>
# stored/uncompressed,indexed,tokenized,<a:four>
# }
# 0.0541250631213188 => Document {
# stored/uncompressed,indexed,tokenized,<b:2>
# stored/uncompressed,indexed,tokenized,<a:two two>
# }
# 0.0530315153300762 => Document {
# stored/uncompressed,indexed,tokenized,<b:3>
# stored/uncompressed,indexed,tokenized,<a:three three three>
# }
i.search_each("one two three four", :sort => :b) do |d, s|
puts "#{s} => #{i[d]}"
end
# 0.0612355209887028 => Document {
# stored/uncompressed,indexed,tokenized,<b:1>
# stored/uncompressed,indexed,tokenized,<a:one>
# }
# 0.0541250631213188 => Document {
# stored/uncompressed,indexed,tokenized,<b:2>
# stored/uncompressed,indexed,tokenized,<a:two two>
# }
# 0.0530315153300762 => Document {
# stored/uncompressed,indexed,tokenized,<b:3>
# stored/uncompressed,indexed,tokenized,<a:three three three>
# }
# 0.0612355209887028 => Document {
# stored/uncompressed,indexed,tokenized,<b:4>
# stored/uncompressed,indexed,tokenized,<a:four>
# }
i.search_each("one two three four",
{:sort => :b, :first_doc => 1, :num_docs => 2}) do
|d, s|
puts "#{s} => #{i[d]}"
end
# 0.0541250631213188 => Document {
# stored/uncompressed,indexed,tokenized,<b:2>
# stored/uncompressed,indexed,tokenized,<a:two two>
# }
# 0.0530315153300762 => Document {
# stored/uncompressed,indexed,tokenized,<b:3>
# stored/uncompressed,indexed,tokenized,<a:three three three>
# }
On 5/9/06, Pedro C?rte-Real <Pedro.CorteReal at iantt.pt>
wrote:> On Tue, 2006-04-25 at 22:20 +0900, David Balmain wrote:
> > Thanks Pedro,
> >
> > This was a bug. It is now fixed.
>
> I think I can still see it in my search results. Are you sure it''s
> fixed? I''m using SVN now.
>
> Greetings,
>
> Pedro.
>
> _______________________________________________
> Ferret-talk mailing list
> Ferret-talk at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ferret-talk
>