Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] How are the queries supposed to work?
@ 2011-07-07  2:24 Horacio Sanson
  2011-07-07  6:07 ` William Morgan
  0 siblings, 1 reply; 4+ messages in thread
From: Horacio Sanson @ 2011-07-07  2:24 UTC (permalink / raw)
  To: sup-devel


Finally after several attempts the gmail-dumper finished indexing my +450,000 
emails but searching emails does not work as I expected or I am doing 
something wrong.

Here is an example I have been trying to understand:

I am using the heliotrope-console with this command:

bash> ruby1.9.1 -Ilib bin/heliotrope-console -d ~/.heliotrope

Then in that console :

# Create a query for EVERY
index.set_query(Query.new("body", "*"))

# Get first 5 matches
r = index.get_some_results 5

# Inspect the one result

puts r[1][:subject] 
=> [Rails] Test fixtures not loading

puts r[1][:direct_recipients].inspect
=> #<Set: {"Ruby on Rails: Talk <rubyonrails-talk@googlegroups.com>"}>

puts r[1][:snippet].inspect
=> PLEASE HELP. This is driving me insane. I have a simple database table

puts r[1][:labels]
=> #<Set: {"unread"}>


# So I have a message indexed with a subject that contains "Rails" a direct 
recipient with "rubyonrails-talk@googlegroups.com" and a body that contains 
"PLEASE HELP".


# Now I tried several queries that I thought would return that message but 
they all returned zero results:

index.set_query(Query.new("body", "HELP"))
index.set_query(Query.new("body", "PLEASE"))
index.set_query(Query.new("labels", "unread")
index.set_query(Query.new("from", "rubyonrails-talk@googlegroups.com")
index.set_query(Query.new("to", "rubyonrails-talk@googlegroups.com")
index.set_query(Query.new("body", "rubyonrails-talk@googlegroups.com")

# And the interesting part is that these queries do return the message I 
expect:

index.set_query(Query.new("body", "fixtures"))
index.set_query(Query.new("subject", "fixtures"))

# This made me think that only the subject is searchable since the word 
"fixtures" only appears in the subject but then these queries with words in the 
subject return zero results:

index.set_query(Query.new("subject", "Rails"))
index.set_query(Query.new("subject", "[Rails]"))
index.set_query(Query.new("subject", "Test fixtures"))
index.set_query(Query.new("subject", "test fixtures"))
 
On all tests I made sure to run index.reset_query! before setting the new 
query with index.set_query. Is this the correct way???

-- 
regards,                                                                                                                                                                                                       
Horacio Sanson
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-07-07 17:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-07  2:24 [sup-devel] How are the queries supposed to work? Horacio Sanson
2011-07-07  6:07 ` William Morgan
2011-07-07 14:48   ` Horacio Sanson
2011-07-07 18:08     ` William Morgan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox