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

From: William Morgan <[email-masked]>
Date: Thu, 07 Jul 2011 06:07:41 +0000

Hi Horacio,

Reformatted excerpts from Horacio Sanson's message of 2011-07-07:
> # 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"))

These two are due to case folding. If you try "help" and "please", it
should work.

> index.set_query(Query.new("labels", "unread")

This one should be Query.new("body", "~unread"). The label syntax is
different in heliotrope from in Sup; they aren't regular fielded terms.

> index.set_query(Query.new("from", "[email-masked]")
> index.set_query(Query.new("to", "[email-masked]")
> index.set_query(Query.new("body", "[email-masked]")

This I don't quite understand. Similar queries work on my system. Would
you be able to send the the message that this corresponds to?

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

These ones work due to the lower casing.

> 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"))

I would expect the last one to work. Did it?

> 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???

The reset_query! is unnecessary.

Thanks for all your testing. Much of this is undocumented, so I ask you
to bear with me.
-- 
William <[email-masked]>
_______________________________________________
Sup-devel mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-devel

---

From: William Morgan <[email-masked]>
Date: Thu, 07 Jul 2011 18:08:47 +0000

Ok great, glad we're in sync. I've added an issue for improving this
documentation.
-- 
William <[email-masked]>
_______________________________________________
Sup-devel mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-devel

---

From: Horacio Sanson <[email-masked]>
Date: Thu, 7 Jul 2011 23:48:23 +0900

On Thursday 07 July 2011 15:07:41 William Morgan wrote:
> > # Now I tried several queries that I thought would return that message
> > but they all returned zero results:
> > 

Indeed lowercasing all the queries make them work.

> you be able to send the the message that this corresponds to?

Sorry my mistake. The queries I did were with:
  
  "<[email-masked]>"

in this case the result is zero but if I remove the "<" and ">" then I get the 
expected results. The same goes for "[rails]" that does not work unless I 
remove the square brackets.

> I would expect the last one to work. Did it?

You are rigth, the last query works correclty. Maybe I was already tired of so 
much testing and forgot to actually run the query after setting it.

> Thanks for all your testing. Much of this is undocumented, so I ask you

Once the UTF-7 encoding issue with the labels get's fixed I will test querying 
with Japanese labels.

-- 
regards,                                                                                                                                                                                                       
Horacio Sanson

---

From: Horacio Sanson <[email-masked]>
Date: Thu, 7 Jul 2011 11:24:15 +0900

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 <[email-masked]>"}>

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 "[email-masked]" and a body that contains 
"PLEASE HELP".

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

# 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:

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???