I'm getting some results that I don't understand from a search.

The code, based on the tutorial, and the results are below.

Everything makes sense to me, except the results for
the 'title:"Some"' query.  I would think that it should
match the first two documents, but not the third.

What am I missing here?

Thanks for any help!

--- code -----------------------------------------------------

require 'ferret'

def query(index, query_str)
  puts("Query '#{query_str}'...")
  index.search_each(query_str) do |id, score|
    puts("  id=#{id} score=#{score} uid=#{index[id][:uid]} 
title='#{index[id][:title]}'")
  end
end

index = Ferret::Index::Index.new

index << {:uid => 'one', :title => 'Some Title', :content => 'my first text'}
index << {:uid => 'two', :title => 'Some Title', :content => 'some second 
content'}
index << {:uid => 'three', :title => 'Other Title', :content => 'my third text'}

query(index, 'content:"text"')
query(index, 'content:"some"')
query(index, 'title:"Some"')
query(index, 'title:"Title"')
query(index, 'uid:"two"')

--- results ---------------------------------------

Query 'content:"text"'...
  id=0 score=0.625 uid=one title='Some Title'
  id=2 score=0.625 uid=three title='Other Title'
Query 'content:"some"'...
  id=1 score=0.125318586826324 uid=two title='Some Title'
Query 'title:"Some"'...
  id=0 score=0.0554137788712978 uid=one title='Some Title'
  id=1 score=0.0554137788712978 uid=two title='Some Title'
  id=2 score=0.0554137788712978 uid=three title='Other Title'
Query 'title:"Title"'...
  id=0 score=0.712317943572998 uid=one title='Some Title'
  id=1 score=0.712317943572998 uid=two title='Some Title'
  id=2 score=0.712317943572998 uid=three title='Other Title'
Query 'uid:"two"'...
  id=1 score=1.0 uid=two title='Some Title'

_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to