[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sup-devel] How are the queries supposed to work?



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