Hi,

Using the 0.10.4 gem under ruby 1.8.5 (2006-08-25) [i686-linux], I
get different results with a TermQuery and a search string. Namely,
using a search string seems to always work whereas using a TermQuery
often doesn't return any entries.

For example:
  > [EMAIL PROTECTED]:message_id]
  => "[EMAIL PROTECTED]"
  > @i.search("message_id:#{x}")
  => #<struct Ferret::Search::TopDocs total_hits=1, hits=[#<struct 
Ferret::Search::Hit doc=450, score=6.51688194274902>], 
max_score=6.51688194274902>
  > @i.search(Ferret::Search::TermQuery.new(:message_id, x))
  => #<struct Ferret::Search::TopDocs total_hits=0, hits=[], max_score=0.0>

But sometimes it works fine:
  > [EMAIL PROTECTED]:message_id]
  => "[EMAIL PROTECTED]"
  > @i.search("message_id:#{x}")
  => #<struct Ferret::Search::TopDocs total_hits=1, hits=[#<struct 
Ferret::Search::Hit doc=123, score=7.21260595321655>], 
max_score=7.21260595321655>
  > @i.search(Ferret::Search::TermQuery.new(:message_id, x))
  => #<struct Ferret::Search::TopDocs total_hits=1, hits=[#<struct 
Ferret::Search::Hit doc=123, score=7.21260595321655>], 
max_score=7.21260595321655>

So how come the first search doesn't return anything?

FWIW, I am creating the index like this:
  field_infos = Ferret::Index::FieldInfos.new :store => :yes
  field_infos.add_field :message_id
  # ...
  field_infos.create_index dir
  @i = Ferret::Index::Index.new(:path => dir)

Thanks for any help!

-- 
William <[EMAIL PROTECTED]>
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to