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

* Re: [sup-devel] How are the queries supposed to work?
  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
  0 siblings, 1 reply; 4+ messages in thread
From: William Morgan @ 2011-07-07  6:07 UTC (permalink / raw)
  To: sup-devel

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", "rubyonrails-talk@googlegroups.com")
> index.set_query(Query.new("to", "rubyonrails-talk@googlegroups.com")
> index.set_query(Query.new("body", "rubyonrails-talk@googlegroups.com")

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 <wmorgan-sup@masanjin.net>
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


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

* Re: [sup-devel] How are the queries supposed to work?
  2011-07-07  6:07 ` William Morgan
@ 2011-07-07 14:48   ` Horacio Sanson
  2011-07-07 18:08     ` William Morgan
  0 siblings, 1 reply; 4+ messages in thread
From: Horacio Sanson @ 2011-07-07 14:48 UTC (permalink / raw)
  To: Sup developer discussion

On Thursday 07 July 2011 15:07:41 William Morgan wrote:
> 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.
> 

Indeed lowercasing all the queries make them 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", "rubyonrails-talk@googlegroups.com")
> > index.set_query(Query.new("to", "rubyonrails-talk@googlegroups.com")
> > index.set_query(Query.new("body", "rubyonrails-talk@googlegroups.com")
> 
> 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?
> 

Sorry my mistake. The queries I did were with:
  
  "<rubyonrails-talk@googlegroups.com>"

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.

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

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.

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

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

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

* Re: [sup-devel] How are the queries supposed to work?
  2011-07-07 14:48   ` Horacio Sanson
@ 2011-07-07 18:08     ` William Morgan
  0 siblings, 0 replies; 4+ messages in thread
From: William Morgan @ 2011-07-07 18:08 UTC (permalink / raw)
  To: sup-devel

Ok great, glad we're in sync. I've added an issue for improving this
documentation.
-- 
William <wmorgan-sup@masanjin.net>
_______________________________________________
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