After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 733271 - search provides incomplete result
search provides incomplete result
Status: RESOLVED INCOMPLETE
Product: geary
Classification: Other
Component: search
0.6.x
Other Linux
: High normal
: ---
Assigned To: Geary Maintainers
Geary Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-07-16 17:06 UTC by Frédéric Parrenin
Modified: 2017-10-26 01:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
The message when browsing the message list (128.89 KB, image/png)
2014-07-18 06:41 UTC, Frédéric Parrenin
Details
The message does no"t appear when searching "from:bug" (129.08 KB, image/png)
2014-07-18 06:42 UTC, Frédéric Parrenin
Details
Geary window when searching for "bug" (171.80 KB, image/png)
2014-07-18 06:52 UTC, Frédéric Parrenin
Details

Description Frédéric Parrenin 2014-07-16 17:06:09 UTC
geary 0.6.1 on my ubuntu 14.04 system provides incomplete search results.

For example, I have an email from bugzilla.gnome.org, but if I search for "bug", this email is not found. The email is stored in geary, I have viewed it several times. Strangely, I have another similar email from bugzilla.gnome.org which is found.

By the way, it is not clear to me if the search is supposed to return only cached emails or really all emails. Of course we want the later, since we might search old emails which are not cached.
Comment 1 Jim Nelson 2014-07-17 22:10:43 UTC
I replied to your email on the mailing list and then discovered this bug, so I'm kind of re-answering.

If you type "from:bug" in the Search box, do you see the message you're expecting to see?

Is it possible the message is located down the list?  Search results are sorted in descending order.

Server search is filed at bug #714742.
Comment 2 Frédéric Parrenin 2014-07-18 06:41:05 UTC
Created attachment 281056 [details]
The message when browsing the message list
Comment 3 Frédéric Parrenin 2014-07-18 06:42:00 UTC
Created attachment 281057 [details]
The message does no"t appear when searching "from:bug"
Comment 4 Frédéric Parrenin 2014-07-18 06:52:27 UTC
Created attachment 281058 [details]
Geary window when searching for "bug"
Comment 5 Adam Dingle 2014-07-21 23:52:35 UTC
I myself have seen this problem from time to time.  And in fact I'm seeing it now.  I was just looking for a past conversation with subject "signed lease attached", so I searched for [lease].  To my surprise it didn't appear.  I then went to All Mail and scrolled down until I saw that conversation: its last message was on June 27.  That confirmed that the message was actually in Geary, but I tried searching again and the message still wasn't found.

I then exited Geary, moved my database directory (~/.local/share/geary/adam@medovina.org) to another folder, restarted Geary and created a fresh account with my email address (adam@medovina.org).  In that account, I scrolled down in All Mail until I saw the signed lease message.  I then searched.  In this instance, the search found the message.

I then exited Geary, restored my database directory to the version I originally had and searched again.  Once again, the message was not found.

So it appears that my database (or the SQLite state?) is somehow corrupted, preventing Geary from finding this one message at least.

I think investigating this should be a pretty high priority since local search is a key feature for Geary.  Let me know how I can help.  Jim, I'd be willing to tar up my database directory and email it to you if you think it would help you investigate.
Comment 6 Jim Nelson 2014-07-22 20:28:49 UTC
Adam, if you could tar up both databases (or at least the one with the problem, if you wiped the other) that would be great.  I have looked into this problem a few times but can't find a repro case on my own database nor looking through the search table can I find anything wrong.  Some hard data would be very helpful here.
Comment 7 Adam Dingle 2014-07-24 01:02:03 UTC
Sure - I should be able to do that.  One question: is my email password stored in the database directory itself?
Comment 8 Jim Nelson 2014-07-24 18:34:13 UTC
No, passwords are stored in your keyring.  I don't need the attachments or the .ini file, just geary.db.
Comment 9 Frédéric Parrenin 2014-07-24 20:02:49 UTC
Hi Jim, I just sent you my database.
Note that it is reproductible in my case: if I remove the database and rebuild it with geary, the message still does not appear in the search.
Comment 10 Jim Nelson 2014-07-24 22:58:04 UTC
Frédéric's database helped me immensely.  It turns out his problem is due to a comparison method not falling back on a stable sort when two dates were the same.  That's why the one message wasn't showing up, there was another message in the search results with the same date/time.  Coincidence, but not improbable when dealing in machine-generated emails delivered in batches.

Adam, I don't know that this solves your problem, but it could very well.  I've posted a branch (wip/733271-search) with the fix.  If you want to try it out and let me know, that would be great.
Comment 11 Jim Nelson 2014-07-25 20:41:05 UTC
I've pushed this fix to master, commit 9933f2.  Adam, if you pull from master you can see if this fixes your problem.  (At this point, I suspect it doesn't, as this is not something that will change if you re-build your database; the sort collision was due to date/times stored on the server.)  However, this is an important fix and I wanted to get it in.

I'll leave this ticket open until I hear from you, Adam.
Comment 12 Adam Dingle 2014-07-27 18:34:32 UTC
Jim, I'm glad that Frédéric's database helped you find a bug.  Unfortunately even after rebuilding from master I'm still seeing this: when I search for [lease] Geary doesn't find a message with subject ""signed lease attached" that is visible in All Mail.

I'm currently attempting to upload a compressed copy of my geary.db to Google Drive so I can share it with you.  I'm on vacation in Maine where my Internet connection is over a cell phone and only works sporadically, so I'm not sure whether the upload will succeed.  If so, I'll let you know; if not I'll upload it when I get back to Massachusetts next week.
Comment 13 Adam Dingle 2014-08-09 15:12:32 UTC
I'm now back where I have a decent Internet connection and would be able to upload my database, but unfortunately at this moment I can no longer reproduce this: a search for 'lease' does find the message I was unable to find before.  Drat.

I'm pretty sure I've seen this bug from time to time in the past, and will be sure to post again here the next time I see this.
Comment 14 Jim Nelson 2014-08-21 01:10:52 UTC
The search stabilization fix has been released w/ 0.6.2.
Comment 15 Elizabeth 2014-10-08 22:55:02 UTC
Recently installed 0.8.0, and now I have this bug.  Search for the email address of a close friend and I only find 5 conversations (we have *far* more email threads than that).  Upgrade to 0.8.1: same problem.
Comment 16 Elizabeth 2014-10-09 18:30:52 UTC
Tried installing 0.6.3, and I still have this problem.  Tried reinstalling 0.8.1, removing that email account, and adding it again.  Still same problem.  Geary is finding a tiny fraction of the search results it should. 

Linux Mint 17.
Comment 17 Jim Nelson 2014-10-09 18:56:14 UTC
Elizabeth, a couple of things.  First, this bug is still open, hence I wouldn't expect going back and forth between versions to change what you see.  The fix applied to 0.6.2 solved a certain subset of search problems, but not all of them.

Regarding your friends' email, there's a few things to know.  First, Geary by default only stores some of your entire mail database in the local cache.  Geary can only search locally (searching on the server is a separate problem and is not implemented today).  By default Geary will only download the last two weeks' of your mail locally.  That affects your search results.

Second, even if you set Geary to download more mail (in the Accounts dialog), it can take a while for Geary to pull it all down.  Please make sure you're giving it some time before expecting full results.

Third, if you're still having problems, I'd be curious if putting quotes around your friends email changes anything, i.e.

"jim@example.com"

instead of

jim@example.com
Comment 18 Elizabeth 2014-10-09 20:22:50 UTC
Ah, that was very helpful!  I *had* forgotten that the Geary default is only to download the last 2 weeks' of mail locally.  My bad.  Wierdly, one of the 5 conversations from my friend that it was able to find before I fixed the settings was from 2007!

(I've just upgraded my operating system ... should have mentioned that...  and so had wiped all my settings, and completely forgotten it was necessary to re-set that.)  

Have set it to download more mail and it is now functioning as it was before.

(Before making that change, I tried the quotes, which made no difference).
Comment 19 Jim Nelson 2014-10-09 20:25:57 UTC
Ok, good.  That clears things up.

The time-limit setting isn't an exact science; for efficiency Geary downloads mail in chunks, and if the tail end of the chunk is beyond the two-week limit (or whatever), Geary doesn't trim it off.  Duration of time is not directly correlated to disk space, but it's a more useful approximation for more users.
Comment 20 Antony 2015-05-13 19:27:42 UTC
Hey, late to the party but I'm on Geary 0.10.0 and I still have this problem, i.e. I'm missing emails.  Also, I do have the email account set to download everything, but clearly it's not doing that.   It only fetches emails when I scroll to the end of what I have downloaded already.
Comment 21 mt 2015-05-21 17:44:39 UTC
+1 using 0.10.0 compiled from git.... I've got the same email account in Thunderbird, Evolution, and Geary and am comparing features.  Geary's search seems very unusable.  It only finds things that the other two find occasionally and so far I have not been able to notice a pattern on hits versus misses, but would love to help contribute to improving.
Comment 22 Robert Schroll 2015-05-22 02:40:04 UTC
(In reply to Antony from comment #20)
> It only fetches
> emails when I scroll to the end of what I have downloaded already.

I assume you're referring to the loading of new conversations when you scroll do the bottom of the conversation list.  This has nothing to do with what has been downloaded.  We load only a small number of emails initially and pull in more from the local database as you scroll backwards in time.

(In reply to mt from comment #21)
> +1 using 0.10.0 compiled from git.... I've got the same email account in
> Thunderbird, Evolution, and Geary and am comparing features.  Geary's search
> seems very unusable.  It only finds things that the other two find
> occasionally and so far I have not been able to notice a pattern on hits
> versus misses, but would love to help contribute to improving.

If you can show us some searches that fail, it may shed some light on what's going wrong.
Comment 23 mt 2015-05-22 12:31:57 UTC
(In reply to Robert Schroll from comment #22)
> (In reply to Antony from comment #20)
> > It only fetches
> > emails when I scroll to the end of what I have downloaded already.
> 
> I assume you're referring to the loading of new conversations when you
> scroll do the bottom of the conversation list.  This has nothing to do with
> what has been downloaded.  We load only a small number of emails initially
> and pull in more from the local database as you scroll backwards in time.

Interesting that you responded to both of these.  If I scroll backward in time to the emails I was searching for (first), then search works.  I'm guessing for mail in an imap server that was not originally ingested on delivery by geary, its actually doing the downloading as I'm scrolling?  

> 
> (In reply to mt from comment #21)
> > +1 using 0.10.0 compiled from git.... I've got the same email account in
> > Thunderbird, Evolution, and Geary and am comparing features.  Geary's search
> > seems very unusable.  It only finds things that the other two find
> > occasionally and so far I have not been able to notice a pattern on hits
> > versus misses, but would love to help contribute to improving.
> 
> If you can show us some searches that fail, it may shed some light on what's
> going wrong.
Comment 24 Robert Schroll 2015-05-23 04:47:02 UTC
(In reply to mt from comment #23)
> Interesting that you responded to both of these.  If I scroll backward in
> time to the emails I was searching for (first), then search works.  I'm
> guessing for mail in an imap server that was not originally ingested on
> delivery by geary, its actually doing the downloading as I'm scrolling?  

Yes, that's true.  Scrolling back can trigger further downloads, and the email needs to be downloaded before it'll show up in search results.  But loading new conversations does not necessarily indicate more downloads are occurring.  (I have several years of email in my local database, so I never trigger more downloads this way.   I forget that's not the case for everyone.)

Once it's loaded, it should always show up in the search results, even if it's not in the currently loaded conversations.  But apparently it doesn't; hence this bug.
Comment 25 Michael Gratton 2016-12-20 12:51:59 UTC
Hi all, a couple of fixes have been made recently that may have helped/fixed this issue:

1. Search was in general unreliable due to the database being corrupted - Bug 772522.

2. Regardless of how many weeks/months/etc you had configured Geary to prefetch in your account settings, it may never have reliably prefetched messages your Inbox - Bug 776029

Can you please try building Geary from git (either master or the LTS "geary-0.11" branch) or when 0.11.3 is released at the end of the week, and let me know if this is still a problem for you?

Ta!
Comment 26 Michael Gratton 2017-10-26 01:01:53 UTC
Closing this bug report as no further information has been provided. Please feel free to reopen this bug report if you can provide the information that was asked for in a previous comment.
Thanks!