Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Horacio Sanson <hsanson@gmail.com>
To: sup-devel@rubyforge.org
Subject: [sup-devel] How are the queries supposed to work?
Date: Thu, 7 Jul 2011 11:24:15 +0900	[thread overview]
Message-ID: <201107071124.16433.hsanson@gmail.com> (raw)


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


             reply	other threads:[~2011-07-07  2:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-07  2:24 Horacio Sanson [this message]
2011-07-07  6:07 ` William Morgan
2011-07-07 14:48   ` Horacio Sanson
2011-07-07 18:08     ` William Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201107071124.16433.hsanson@gmail.com \
    --to=hsanson@gmail.com \
    --cc=sup-devel@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox