Bug 281227 - KMail2 4.7's "Find messages ..." reproducibly fails to search: "Unknown error. (Unable to create persistent search)"
Summary: KMail2 4.7's "Find messages ..." reproducibly fails to search: "Unknown error...
Status: RESOLVED WORKSFORME
Alias: None
Product: kmail2
Classification: Applications
Component: search (show other bugs)
Version: 4.11.5
Platform: openSUSE Linux
: NOR major
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2011-09-02 19:01 UTC by fed up
Modified: 2017-01-13 14:22 UTC (History)
29 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fed up 2011-09-02 19:01:15 UTC
Version:           4.7 (using KDE 4.7.0) 
OS:                Linux

KMail2's v4.7.0, @ "Find messages ..." always fails, returning error: "Sorry - Kontact. Can not get search result. Unknown error. (Unable to create persistent search)"


Reproducible: Always

Steps to Reproduce:
I have multiple IMAP accounts subscribed in KMail.

In v4.4.1x, Search ("Find Messages ...") in a given folder, and/or its subfolders worked perfectly.

In v4.7.0, @ "Find messages ..." on any account's parent-/sub-folders, the Find Messages dialog opens, as expected.

But, any/all search attempts result only in a dialog:

"Sorry - Kontact
 Can not get search result. Unknown error. (Unable to create persistent search)"

No crash.  Nothing further in logs.

Search on these IMAP accounts still works from all other clients, as well as KDE 4.4.1x's kmail.


Expected Results:  
Search should work.
Comment 1 Laurent Montel 2011-09-04 10:25:32 UTC
What do you search ? which criteria ?
Comment 2 fed up 2011-09-04 15:52:31 UTC
"... any/all search attempts ..."

This is reproducible fo me searching any IMAP folder - parent or subfolder,

and, any criteria, Subject:, Body:, etc., singly or in combination.
Comment 3 FiNeX 2011-09-14 20:58:15 UTC
I confirm that the search mail doesn't work. I'm using IMAP too.

I've promoted the bug to "Major" because searching is an important feature on a mail client software.

Thanks :-)
Comment 4 fed up 2011-09-14 22:00:35 UTC
After upgrading to:

kontact -v
 Qt: 4.7.4
 KDE Development Platform: 4.7.1 (4.7.1) "release 8"
 Kontact: 4.7.1

the problem still exists as reported.
Comment 5 Laurent Montel 2011-09-15 06:41:48 UTC
Work fine here :)
So do you have nepomuk ?
Which is your search value ?
Etc.
Comment 6 fed up 2011-09-15 06:48:50 UTC
Yes I have nepomuk installed.  Semantic desktop & Strigi search are both enabled.

As answered in comment #c2, above, any and all searches, on any folder, with any single or multiple criteria, return the same result -- the error message as reported: 

"Sorry - Kontact
 Can not get search result. Unknown error. ..."
Comment 7 Lukas Schneiderbauer 2011-09-15 07:25:48 UTC
I can confirm this behaviour in Kmail 4.7.0

With kmail 4.7.1 it's a bit different. I tried a search for subject and search results were shown. However, when I clicked the folder "Last Search Results", kmail couldn't load this folder: "Retrieving Folder Contents Please wait . . .". This seems to block the loading of other folders, so I restarted kmail. Every kmail start it seems, that kmail wants to load the "Last Search Results", which it can't. So it can't load other folders. So it's not usable any more and I cannot do further testing.

Can I delete these search results in any way? "Delete Folder" doesn't help.
Comment 8 Lukas Schneiderbauer 2011-09-15 07:46:32 UTC
Okay, I did an akonadi-restart and it worked again. Did another search for subjects, there were results (pretty fast). After that I searched the email-boddys and the behouvier in comment #7 appeared again.
Comment 9 fed up 2011-09-29 03:02:02 UTC
Is there any more info needed for helping with this?

Unlike @Lukas, search never works for any of our accounts on any of our machines, even after an akonadictl restart.
Comment 10 Pat 2011-10-03 19:43:29 UTC
I'm running

 kontact -v
  Qt: 4.7.4
  KDE Development Platform: 4.7.1 (4.7.1) "release 8"
  Kontact: 4.7.1

If I open Kontact's KMail, and rt-click -> Find Messages on any existing folder (INBOX will do) in an IMAP account, then enter any combination of options -- for example, just accept defaults (Subject: contains ...), enter anything (e.g., "TEST"), then click "Search" ...


a dialog box opens,

 "Sorry - Kontact; Can not get search result. Unknown error. (Unable to create persistent search)"

with an OK button.


Clicking OK simply returns me to the Find Messages dialog.

If I exec 'akonadictl restart' mentioned above -- it doesn't make any difference for me here.  The 1st/next attempt to Find Messages behaves the same way -- Still can't search, & I get the same dialog box.

I'm seeing this on Opensuse 11.4, and have verified the same dialog/error with another user (on Fedora) in #kde.
Comment 11 Pat 2011-10-03 19:56:55 UTC
After restarting akonadi

 akonadictl restart

and leaving that konsole window open, when I exec the failed search I see in THAT console window:

Error during executing query "INSERT INTO CollectionTable (remoteId, name, parentId, resourceId, queryString, queryLanguage) VALUES (:0, :1, :2, :3, :4, :5)" :  "Data too long for column 'remoteId' at row 1 QMYSQL3: Unable to execute statement" 
Error during insertion into table "CollectionTable" "Data too long for column 'remoteId' at row 1 QMYSQL3: Unable to execute statement"
Comment 12 Roger Pixley 2011-10-03 21:06:45 UTC
I'm the other user from Freenode #KDE on Fedora from the above comment.

Upon doing a akonadictl restart and trying to search I get the following error messages.

Error during executing query "INSERT INTO CollectionTable (remoteId, name, parentId, resourceId, queryString, queryLanguage) VALUES (:0, :1, :2, :3, :4, :5)" :  "Duplicate entry '1-Last Search' for key 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement" 
Error during insertion into table "CollectionTable" "Duplicate entry '1-Last Search' for key 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement" 
Error during executing query "INSERT INTO CollectionTable (remoteId, name, parentId, resourceId, queryString, queryLanguage) VALUES (:0, :1, :2, :3, :4, :5)" :  "Duplicate entry '1-Last Search' for key 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement" 
Error during insertion into table "CollectionTable" "Duplicate entry '1-Last Search' for key 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement"

The other thing that I noted was the open search folder button became enabled despite the error. It opens a KMail intro page but then adds a search virtual folder to the leftpane.

Any other information that may be needed from debug packages?
Comment 13 Pat 2011-11-02 21:52:27 UTC
This bug's been reported, repeatedly verified, and info about the apparently related SQL problem has been provided.

Users keep asking what else is needed, offering to provide whatever info is helpful, but no reply.

What are the chances of getting some attention on this?  IMAP without search is, frankly, useless.

I'd offer testing by my KDE 250+ user community, but as of last week, I've migrated everybody off -- except myself.  So I'll still help while I can -- on just one environment.  But it needs some input from a developer willing/able to fix this.
Comment 14 fed up 2011-11-02 22:42:15 UTC
I switched over to Thunderbird where search works great, but I'll at least switch the bug back to "New" status for you, since the NEEDSINFO flag didn't seem to help much.
Comment 15 Pat 2011-11-05 04:34:40 UTC
New version.

Qt: 4.7.4
KDE Development Platform: 4.7.3 (4.7.3) "release 10"
Kontact: 4.7.3

Problem persists.
Comment 16 Pat 2011-11-10 22:45:07 UTC
Thanks anyway, I'm no longer a KDE PIM user.
Comment 17 bugs.kde.org-1 2011-12-23 19:26:09 UTC
Kmail compiled from git KDE/4.8 today , still receiving this error. The reason is however slightly different:

Error during executing query "INSERT INTO CollectionTable (remoteId, name, parentId, resourceId, queryString, queryLanguage) VALUES (:0, :1, :2, :3, :4, :5)" :  "Duplicate entry '1-Ostatnie wyszukiwdNameIndex' QMYSQL3: Unable to execute statement" 
Error during insertion into table "CollectionTable" "Duplicate entry '1-Ostatnie wyszukiwanie' for key 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement" 

but error is the same: "Unable to create persistent search". Kmail and KDE version exacly:
KMail
Version 4.8 rc1
Using KDE Development Platform 4.7.90 (4.8 Beta2 (4.7.90) "release 2"
Comment 18 Blackpaw 2012-01-06 14:31:51 UTC
Just joining the crowd - 4.8 RC1, any search for any terms, never return any results.

Google IMAP, tried cached/non-cached.

Kubuntu 64 bit 11.10
Comment 19 FranJPR 2012-01-26 21:50:34 UTC
kubuntu 11.10 kmail 4.7.3.
Any kind of search gives Can not get search result. Unknown error. (Unable to create persistent search). It is not possible to search through emails!

This kind of bug in an email client in a production environment is a real severe bug

Good luck
Comment 20 Thomas Pfeiffer 2012-01-29 18:59:03 UTC
This bug is still present in Kmail 4.8 (after upgrade, not tested with fresh install)
Comment 21 Blackpaw 2012-01-29 21:42:57 UTC
It was more or less working form em on Kubuntu 11.10, but after a clean install of 12.04 serach is returning nonsense results again
Comment 22 Andrew Gaydenko 2012-01-31 13:39:25 UTC
I can confirm the issue for 4.8 under Arch Linux.
Comment 23 Andrew Gaydenko 2012-01-31 13:48:52 UTC
At my case (4.8 under Arch) very often the error message appears on the second sequential search - the first search completes without errors (but skipping matched messages - this is another very sad story). Saying "sequential" I mean the same opened search dialog instance. So, I can close the dialog, open it again and get next first search results without error.
Comment 24 Ralph Moenchmeyer 2012-02-04 14:55:57 UTC
I have updated to KDE 4.8 on an Opensuse 12.1 system with a complete fresh setup of Akonadi, Kmail etc. - meaning that I deleted all respective folders and config files. I than added all my IMAP resources again - which worked very well -  and tried the search functionality via the search dialog. 

Defect: There still is no option to select the folder to search in. 
Bug: Then I tried some combined conditions for the search - it all gave an empty result set although there are lots of emails which fit the conditions.

Then I tried a search with only one condition for the complete email text. This gave me a result list - but not a reliable one. 

So nothing has improved with KDE 4.8. The search dialog in my opinion is completely useless as it is right now.
Comment 25 Robin Green 2012-03-18 07:59:22 UTC
(In reply to comment #24)
> I have updated to KDE 4.8 on an Opensuse 12.1 system with a complete fresh
> setup of Akonadi, Kmail etc. - meaning that I deleted all respective folders
> and config files. I than added all my IMAP resources again - which worked
> very well -  and tried the search functionality via the search dialog. 
> 
> Defect: There still is no option to select the folder to search in. 
> Bug: Then I tried some combined conditions for the search - it all gave an
> empty result set although there are lots of emails which fit the conditions.
> 
> Then I tried a search with only one condition for the complete email text.
> This gave me a result list - but not a reliable one. 
> 
> So nothing has improved with KDE 4.8. The search dialog in my opinion is
> completely useless as it is right now.

It sounds like while some other pretty serious bugs are still there, this PARTICULAR bug ("Unknown error" dialog box) is fixed in 4.8 for you, after you have deleted and re-added your resources. Can you confirm this?
Comment 26 Ralph Moenchmeyer 2012-03-18 11:58:08 UTC
(In reply to comment #25)
> 
> It sounds like while some other pretty serious bugs are still there, this
> PARTICULAR bug ("Unknown error" dialog box) is fixed in 4.8 for you, after
> you have deleted and re-added your resources. Can you confirm this?

I changed to KDE 4.8.1 meanwhile (packages from Opensuse's KDE Release Repository). I did not delete my IMAP resources and reattach it to Akonadi/Kmail when I changed from KDE 4.8.0 to 4.8.1.
So, right now I can only confirm that the search dialog again gives me the choice to select a folder to search in together with the option to include subfolders in the search. Now the search dialog looks similar again as it was for older KDE 4 versions with KMail 1.X.  

I tried a search for emails with a certain customer name as part of the FROM field (= sender's email address). I checked that such mails were located somewhere in the subfolders. This search did not work correctly. It did not return any hit. However, this may have to do with an incorrect or incomplete update of nepomuk's database during my steps from 4.8.0 to 4.8.1. 

Therefore, I shall perform the following experiments: I shall delete and reconfigure my IMAP access. I shall wait until the nepomuk/ virtuoso-t load on the cpu is back to almost zero - which may take some time. Then, I shall try a search with single and combined criteria for mails in the email folder structure and see if that works correctly. 

If this does not work as expected: I shall again delete the IMAP resource and in addition delete all Nepomuk folders and configuration files in ~/.kde4. Then I shall setup the IMAP connection again within Kmail and try some email searches again.   

So please be patient - it may take some time. But I promise to report the results as soon as I have them.
Comment 27 Ralph Moenchmeyer 2012-03-18 18:08:14 UTC
(In reply to comment #25)
> It sounds like while some other pretty serious bugs are still there, this
> PARTICULAR bug ("Unknown error" dialog box) is fixed in 4.8 for you, after
> you have deleted and re-added your resources. Can you confirm this?

Back again with the first results. I deleted and re-added my IMAP resource. It took only some minutes until could access the folder structure, which includes several GB of mails in a folder structure with about 100 folders. However, the mail indexer took 150 minutes to index the contents. 

After that the search in a given folder worked for the FROM and TO fields . But I had to click twice on the search button to get the correct number of hits - especially when using wild cards in the search term. 

The indexing of mail adresses (better its segments) remains a puzzle to me. Searching for "TO" adresses that contain "de"  gives less results than a search for "*.de". A search for TO adresses that contain ".de" (with the dot) gives an empty result set. From that I would conclude that only segments of the address are indexed. But even then a search for "de" should give the same amount of hits as "*.de" - which is not the case. 
    
OR combinations of search criteria for the TO field do not seem to work at all - with or without wild cards.  I did not try search conditions with AND criteria much, but they do not seem to work either.   

In addition, a recursive search through a folder hierarchy does not work. At least not over three or more levels of the hierarchy. Moreover, sometimes a search does not work at first. reformulating the search term may give you some hits. And afterwards suddenly the original search works, too.  

Worst of all - after trying some searches with combined conditions virtuoso-t suddenly ran amok - using 4 of my CPU cores at a 100% level. This could not be stopped by deactivating Nepomuk via KDE's system-settings. I had to kill the virtuso-t process explicitely.  

As an additional test, I am going to stop akonadi, then delete all nepomuk configuration files and nepomuk directories and start everything again.
Comment 28 Ralph Moenchmeyer 2012-03-19 09:05:29 UTC
(In reply to comment #25)
> (In reply to comment #24)
> It sounds like while some other pretty serious bugs are still there, this
> PARTICULAR bug ("Unknown error" dialog box) is fixed in 4.8 for you, after
> you have deleted and re-added your resources. Can you confirm this?

I deleted all nepomuk related config files and directories in ~-kde4. I deleted my IMAP resource, added it again and let Nepomuk / virtuoso-t do their job from scratch now while I fetched folder after folder manually from the server. There are some inconsistencies 

I always let nepomuk/virtuso-t finish their jobs first before opening new folders. With one exception for a last folder with several subfolders and a lot of mails. I opened these folders, Nepomuk and virtuso-t started as expected. They should have worked quite a while - at least 15 minutes. For testing purposes I logged out and restarted the PC and afterwards Kmail. My expectatioin was that the email indexing would continue. This was not the case. There seems to be an additional bug. 

Regarding the other indexed folders and searching via the new dialog: The results are pretty much the same. You can use the search dialog and select folders. There is no "Unknown error" message.  

However, the search result list gives no reliable results. Recursive searching over several levels of subfolders is sometimes not working at all. very often the result list of a simple search gives you hits twice. Searches with combined conditions most often do not work at all. Sometimes they work for AND conditions, but if and only if the conditions are related to different parts of the Email. But even then the result list is not reliable. 

Summary: The logic behind the search process still seems to be buggy regarding recursive subfolder analysis and the handling of combinations of search conditions.
Comment 29 Maurice Batey 2012-05-12 16:54:59 UTC
(Using KMail 4.8.2 on 64-bit Mageia-2 Cauldron, with Local Folders mapped onto a 'maildir' email directory)

I was very happy with KMail 4.8.2, especially with it's handling of mapping Local Folders onto an existing 'maildir' email directory...
.... until I tried 'Find Messages' (on a specified folder), that is.

At first all I got was the baffling error message:

"Cannot get search result. Unknown error. Only resources can modify
remote identifiers." 

Later on this stopped happening (with occasional relapses), but nevertheless Find Messages usually fails to work at all, with no indication of progress and no results, just saying 'Ready'.  No feedback whatsoever.

Sometimes it works well, e.g. searching on "that" in Subject in Sent-mail.
   Mostly it fails to find anything when I can see there are many occurrences of the search string in the mail folder messages.

Please, can this function be made usable, so that we can continue to use this otherwise excellent version of KMail?
Comment 30 Maurice Batey 2012-05-21 16:23:21 UTC
Regarding Find Messages on the 'To or 'From' fields, the search appears not to be looking for a matching string anywhere in those fields, but only for a matching 'component' (where 'component' is either the characters to the left of the "@", or to the right).

For example, if searching in Sent-mail for email sent to "fredsmith@gmail.com", then a search string of "freds" would find nothing, nor would even a search string of "gmail'!
    Only a search string of "fredsmith" would succeed at all, and even then it might not find *all* of 'To' fields with that component.

As a test, I did a Find Messages for "gmail.com" in the 'To' fields of a Sent-mail folder containing 4,886 emails.

KDE 4.5.2's KMail (1.13.5) found 395 emails sent to someone at gmail.com
KDE 4.8.2 on the other hand - given the same email Sent-mail folder - found only *11* matches:

    5 'this week'
    4 in 2004
    1 in 2005
    1 last week
            
 - which leads me to conclude that 4.8.2's Find Messages is well and truly broken, and so unusable, thus rendering KMail 4.8.2 itself unusable...
Comment 31 Vojtěch Zeisek 2012-06-24 21:06:00 UTC
I get same error on every search in KMail from KDE 4.7.2, openSUSE 12.1.
Comment 32 Mark Fraser 2012-06-26 16:41:55 UTC
I'm now running Kontact 4.9 beta 2 on Kubuntu 12.04 and I'm still getting this error.
Comment 33 Mark Fraser 2012-06-26 17:25:52 UTC
Think I've figured out the cause of the error, but I am unable to fix it - I don't have a search folder and that is stopping searching from working. Only trouble is, I don't know how to create the search folder.
Comment 34 Maurice Batey 2012-06-27 16:21:00 UTC
(In reply to comment #33)
> Think I've figured out the cause of the error, but I am unable to fix it - I
> don't have a search folder and that is stopping searching from working. Only
> trouble is, I don't know how to create the search folder.

  With 4.8.2 the Search Folder appears automatically. Perhaps 4.9 has an additional bug... :-(

Bad news that the problem still isn't fixed in 4..9.  It renders KMail unusable routinely.

Good hunting!
Comment 35 Mark Fraser 2012-06-27 16:26:46 UTC
(In reply to comment #34)
> (In reply to comment #33)
> > Think I've figured out the cause of the error, but I am unable to fix it - I
> > don't have a search folder and that is stopping searching from working. Only
> > trouble is, I don't know how to create the search folder.
> 
>   With 4.8.2 the Search Folder appears automatically. Perhaps 4.9 has an
> additional bug... :-(

I've had the problem since upgrading to KMail2 in Kubuntu 11.10 and it was only yesterday that I noticed that I didn't have a search folder, but my netbook does and search works on that.

> Bad news that the problem still isn't fixed in 4..9.  It renders KMail
> unusable routinely.
> 
> Good hunting!

Now all I need to do is find a way to create a search folder.
Comment 36 Vojtěch Zeisek 2012-06-27 18:37:35 UTC
I have search folder in 4.7.4 and it does not work (same error as in 1st post).
Comment 37 Con Hennessy 2012-08-18 10:58:15 UTC
the first search in 4.9.0 seems to work for me. Subsequent searches do not, so I'll create a new bug for that.
Comment 38 Mark Fraser 2012-08-18 12:48:44 UTC
I don't seem to get the error any more with 4.9, but doing a search for something containing the search word brings up nothing and doing the same search for emails not containing the search word brings up everything in the folder!
Comment 39 S. Bryant 2012-08-18 13:18:38 UTC
I'm still getting this error, even on the first search.  I can't get any search results at all using the "Find Messages" dialog, although the quick search (inside the current folder) seems to work fine.

I'm using the 4.9.0 RPMs from the OpenSuse 12.1 repository (x86_64).  FWIW, I'm have both local folders (Maildir) and disconnected IMAP.

Steve
Comment 40 Ralph Moenchmeyer 2012-08-19 12:21:49 UTC
(In reply to comment #39)

> I'm using the 4.9.0 RPMs from the OpenSuse 12.1 repository (x86_64).  FWIW,
> I'm have both local folders (Maildir) and disconnected IMAP.
> 
> Steve

I can confirm Steve's findings. I, too, use Opensuse 12.1, RPMs from the SUSE's KDE 4.9 repository. I do not get any hits when searching with the search dialog with kmail 4.9 - neither for an online IMAP mail directory nor for local mail directories. 

This is in contrast to what I described in comment #27 and comment #28 for KDE 4.8.1. In kmail 4.8.1 I at least for some search criteria could find some mails - now in KDE 4.9 the search dialog has stopped working for me.
Comment 41 Peter Antoniac 2012-08-26 06:09:14 UTC
I have the same issues. I used to be able to create the search folder and the folders that I had seem to work. But then, after playing with the search and getting the error on "persistent search" I deleted it. If I now try to create the folder, kmail throws me to the "welcome screen". After that, the search doesn't even work any more! Weird...
Comment 42 Maurice Batey 2012-12-24 12:43:43 UTC
What progress is being made with this, please?

Using Mageia-3-alpha2 fully updated (KDE 4.10 Beta1):

In System Settings/desktop Search the following are all marked 'x' in
the box:

-   'Enable Nepomuk Semantic desktop'
        "Desktop search servcies are active"

 -  'File Indexer'
       "File indexer is suspended" (?!)

  -  'Enable Email indexer'
    
In KMail/Inbox/Folder Properties/Maintenance:

    x Enable Full Text Indexing
       "Folder was indexed Saturday 25 Aug 2012" !!
      
   So I hit 'Force re-indexing' and went for a cup of coffee.
    (Then it said "Folder indexed Sunday Dec 16 2012")

Then I did the Find Messages again (Inbox, From: "gmail.com")
  Result = Found 14  (whereas KDE 4.5.2's KMail finds 142)

Then I repeated the Find Messages for 'From=yahoo.com'
  Result: Finds 3  (whereas KDE 4.5.2's KMail finds 345 !) 

So it would seem re-indexing is happening, but Find Messages is still
hardly working at all...

Do please let me know if I can help further.
Comment 43 Dimitrios Glentadakis 2013-01-21 05:29:26 UTC
I have kmail 4.8.5 and search worked fine.
I had a bad idea to delete the subfolder with the glass under the folder Search in the left bottom because i did nt want to list my last search anymore, and now if i try again to do a serach i have the message "Unable to create persistent search" and the search does nt work anymore. Nepomuk is enabled
Comment 44 Maurice Batey 2013-01-21 12:27:17 UTC
(In reply to comment #43)
> I have kmail 4.8.5 and search worked fine.

   Does it work as well as e.g. KMail 1.13.5?

My experience - as posted earlier - is that although Find Messages with KMail 4.8.x and later *appears* to work, it only finds a small proportion of the number found by earlier KMails.
    So it does not work correctly; certainly not 'fine'!
Comment 45 Dimitrios Glentadakis 2013-01-22 06:08:27 UTC
After 3-4 reboots and one hole day of usage , the search folder came back by its own.

I use imap gmail. I dont know how to test the number of results, with a first vision it founds the expected results. May be i have to count some messages and after see if it finds all of them but i dont have such many messages. I think the problem would be with a big number of messages
Comment 46 Ralph Moenchmeyer 2013-01-22 09:56:30 UTC
(In reply to comment #45)
> I use imap gmail. I dont know how to test the number of results, with a
> first vision it founds the expected results. May be i have to count some
> messages and after see if it finds all of them but i dont have such many
> messages. I think the problem would be with a big number of messages

I use KDE 4.9 + E-Mails on an IMAP-Server in our local network. Mail searching in my case is only working when the search expression refers to the  "subject" field of the mail.  If such a  search delivers complete results I have not tested - but I have doubts for cases when you include  subfolders of a choosen mail folder in the search. 

Searches  for other important fields as "FROM",  "CC", "DATE" do not work. Searches where you combine different search conditions by "AND" or "OR" do not work, either. At least I get no results although there are many mails matching the conditions.  

So I am very surprised that searching worked for Dimitrios and KDE 4.8. I had tested searching also for KDE 4.8 versions - and it never worked in a reasonable way (see comment #27 and #28).
Comment 47 Dimitrios Glentadakis 2013-01-22 10:24:56 UTC
I searched only in "Subject" field until now. This evening at home i will test if it works with other fields
Comment 48 Dimitrios Glentadakis 2013-01-22 17:17:11 UTC
With other fields the search it is nt reliable for me too. 
I searched multiple times in subject, hole message, core of message fields and i compare the results with gmail in the browser. 
Kmail find a part of them
So the search in kmail is not reliable for me too.
Comment 49 Blackpaw 2013-02-16 14:09:23 UTC
Getting the same problem for 4.10. Have done the usuals - delete akonadi db, delete nepomuk db, reindex.
Comment 50 Axel Braun 2013-04-23 08:58:44 UTC
It still happens on 4.10.2
Comment 51 davidblunkett 2013-07-04 08:44:40 UTC
Yep I've developed this problem -
Comment 52 optional 2013-07-04 10:06:15 UTC
Due to the fact that KMail development seems to run in circles (working-failing-working-failing...) I'd like to remove myself from the CC list.

I unmark the "Add me to CC list" checkbox and hit the "Save changes" button, but I stay subscribed.

Admins, please help.

(Note: Never looked at the code, but wonder if unit-testing is utilized.)
Comment 53 Nico Kruber 2013-07-04 11:50:10 UTC
still there in KDE 4.10.5 :(
Comment 54 Patrick 2013-08-05 12:36:25 UTC
I've found what's causing the problem, but it's not KMail. In the Akonadi source, the file server/src/handler/searchpersistent.cpp (in method SearchPersistent::parseStream()) contains the following line:
  col.setRemoteId( queryString ); // ### remove, legacy compat

This sets the remote id of the virtual collection in which the search result will be stored to the query which KMail sends to Akonadi. This collection is only created if it doesn't already exist. But the query used as remote id is too long (> 255 chars).
Comment 55 Rainer Dorsch 2014-02-02 10:30:31 UTC
I get on 4.11.5 on Debian

akonadi_nepomuk_feeder(32182) ItemQueue::fetchJobResult: Not all items were fetched:  0 100 
akonadi_nepomuk_feeder(32182) ItemQueue::fetchJobResult: Not all items were fetched:  90 100 
Error during executing query "INSERT INTO CollectionTable (remoteId, name, parentId, resourceId, queryString, queryLanguage, isVirtual) VALUES (:0, :1, :2, :3, :4, :5, :6)" :  "Duplicate entry '1-Last Search' for key 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement"

Can Patrick's information be used as workaround?
Comment 56 Duarte Rocha 2014-02-24 11:21:15 UTC
KMAIL:  4.12.2

Still can't use search:

Error during executing query "INSERT INTO CollectionTable (remoteId, name, parentId, resourceId, queryString, queryLanguage, isVirtual) VALUES (:0, :1, :2, :3, :4, :5, :6)" :  "Duplicate entry '1-Last Search' for key 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement"
Comment 57 Larry CK 2014-02-28 05:18:28 UTC
using KMail Version 4.10.5 on Opensuse 12.3 (64bit). Only search that somewhat works - is search in subject field.

This is a deal breaker for me as I originally intended to use it for my work email.
Comment 58 Laurent Montel 2014-02-28 09:17:08 UTC
4.10.5 is too old.
Even if we try to fix it it will put in 4.12 or 4.13 not 4.10.

And in 4.13 we rewrote all and works fine.
Comment 59 Blackpaw 2014-02-28 12:53:11 UTC
(In reply to comment #58)
> 4.10.5 is too old.
> Even if we try to fix it it will put in 4.12 or 4.13 not 4.10.
> 
> And in 4.13 we rewrote all and works fine.

?! Really? I'm running master+baloo (4.13pre) and for me search has major issues, not that I have been able to get anyone to take notice.

But I am running a two seriously large IMAP accounts (60,000+ msgs) - I suspect  the search devs don't.
Comment 60 Christophe Marin 2014-03-13 09:20:53 UTC
(In reply to comment #59)
> (In reply to comment #58)
> > 4.10.5 is too old.
> > Even if we try to fix it it will put in 4.12 or 4.13 not 4.10.
> > 
> > And in 4.13 we rewrote all and works fine.
> 
> ?! Really? I'm running master+baloo (4.13pre) and for me search has major
> issues, not that I have been able to get anyone to take notice.
> 
Then your issue is unrelated to this bug report. Create a new one.
Comment 61 Blackpaw 2014-03-13 10:18:28 UTC
(In reply to comment #60)
> (In reply to comment #59)
> > (In reply to comment #58)
> > > 4.10.5 is too old.
> > > Even if we try to fix it it will put in 4.12 or 4.13 not 4.10.
> > > 
> > > And in 4.13 we rewrote all and works fine.
> > 
> > ?! Really? I'm running master+baloo (4.13pre) and for me search has major
> > issues, not that I have been able to get anyone to take notice.
> > 
> Then your issue is unrelated to this bug report. Create a new one.

But "in 4.13 we rewrote all and works fine." so why bother?

I've posted multiple times on the dev list about search not working, with examples. No one wants to know, might as will piss into the wind.
Comment 62 Laurent Montel 2014-03-13 10:29:32 UTC
Create a new bug report.
Dan/Vishesh/Me work on baloo support.
Upgrade to last baloo and report bug with specific test case
Thanks
Comment 63 Blackpaw 2014-03-13 10:31:45 UTC
(In reply to comment #62)
> Upgrade to last baloo and report bug with specific test case

Master or 4.13 branch?
Comment 64 Laurent Montel 2014-03-13 10:52:31 UTC
I backport all in 4.13 for it
Comment 65 Andreas Tono 2014-12-29 22:32:44 UTC
opensuse  kmail Version 4.11.5 
If have the same problem with the search window (Unable to create persistent search). Time by time I searched for a resolution. Today I  figured out the way how the search always works.
1. step define a search folder (last input field in search window)
2. make sure the search folder name is different to any one displayed beneath search in kmail windows (left side navigation tree)
The disadvantage: I'll get a new searchfolder for every search but search always worked this way.
Next Test: I did'nt supply a new search folder name. Resulting error: Unable to create persistent search.
Next step: I deleted all searchfolders.
After that all searches where working. I could not reproduce the error.
I do not know which action leads to the problem (may be relicts of old kmail version?), but a hint in error message would have helped me earlier: "Delete all searchfolders may help"
Comment 66 Martin Steigerwald 2015-05-04 13:12:55 UTC
With KDEPIM 4.14.7 and Akonadi 1.13 compiled from git branches, I get no dialog like this, but the search returns no result, even when it should.
Comment 67 Maurice Batey 2015-05-04 15:57:25 UTC
Using 4.12.5 here on 64-bit Mageia-4, Find Messages appears to be back to normal.
Comment 68 Martin Steigerwald 2015-09-08 20:05:05 UTC
Okay, trying this with KDEPIM compiled from master yesterday, doing anything with Find Messages crashes here. So not able to triage this issue further for now.
Comment 69 Denis Kurz 2017-01-13 14:22:18 UTC
Recent versions seem unaffected, since this bug has never been confirmed/reported for a Framework-based version. There hasn't been activity for more than a year, and I haven't come across this bug in ages, either. Please only re-open if it happens in a version of at least 5.0.