<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">It's because you're misunderstanding how the lookup() function works. It gets ALL the search parameters, including the "mailbox inbox". This is intentional, and not a bug. Two reasons being:<div class=""><br class=""></div><div class="">1) The FTS plugin in theory could support indexing/searching any kinds of searches, not just regular word searches. So I didn't want to limit it unnecessarily.</div><div class=""><br class=""></div><div class="">2) Especially with "mailbox inbox" this is important when searching from virtual mailboxes. If you configure "All mails in all folders" virtual mailbox, you can do a search in there that restricts which physical mailboxes are matched. In this case the FTS backend can optimize this lookup so it can filter only the physical mailboxes that have matches, leaving the others out. And it can do this in a single query if all the mailboxes are in the same FTS index.</div><div class=""><br class=""></div><div class="">So again: Your lookup() function needs to be changed to only use those search args that it really wants to search, and ignore the others. Use solr_add_definite_query_args() as the template.</div><div class=""><br class=""></div><div class="">Also I see now the reason for the timeout problem. It's because you're not setting search_arg->match_always=TRUE. These need to be set for the search args that you're actually using to generate the Xapian query. If it's not set, then Dovecot core doesn't think that the arg was part of the FTS search and it processes it itself. Meaning that it opens all the emails and does the search the slow way, practically making the FTS lookup ignored.</div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On 21 Apr 2019, at 19.50, Joan Moreau <<a href="mailto:jom@grosjo.net" class="">jom@grosjo.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" class=""><div style="font-size: 9pt; font-family: Verdana,Geneva,sans-serif" class=""><p class="">No, the parsing is made by dovecot core, that is nothing the backend can do about it. The backend shall *never*  reveive this. (would it be buggy or no)</p><p class=""><br class=""></p><p class="">PLease, have a look deeper</p><p class="">And the loop is a very big problem as it times out all the time (and once again, this is not in any of the backend  functions)</p>
<div id="signature" class=""> </div><p class=""><br class=""></p><p id="reply-intro" class="">On 2019-04-21 10:42, Timo Sirainen via dovecot wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0" class=""><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<div class="">Inbox appears in the list of arguments, because fts_backend_xapian_lookup() is parsing the search args wrong. Not sure about the other issue.</div>
<div class=""><br class="">
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0" class="">
<div class="">On 21 Apr 2019, at 19.31, Joan Moreau <<a href="mailto:jom@grosjo.net" rel="noreferrer" class="">jom@grosjo.net</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="font-size: 9pt; font-family: Verdana,Geneva,sans-serif;" class=""><p class="">For this first point, the problem is that dovecot core sends TWICE the request and "Inbox" appears in the list of arguments ! (inbox shall serve to select teh right mailbox, never sent to the backend)</p><p class="">And even if this would be solved, the dovecot core loops *after* the backend hs returneds the results</p><p class=""><br class=""></p><p class=""># doveadm search -u <a href="mailto:jom@grosjo.net" rel="noreferrer" class="">jom@grosjo.net</a> mailbox inbox text milan<br class="">doveadm(<a href="mailto:jom@grosjo.net" rel="noreferrer" class="">jom@grosjo.net</a>): Info: Get last UID of INBOX = 315526<br class="">doveadm(<a href="mailto:jom@grosjo.net" rel="noreferrer" class="">jom@grosjo.net</a>): Info: Get last UID of INBOX = 315526<br class="">doveadm(<a href="mailto:jom@grosjo.net" rel="noreferrer" class="">jom@grosjo.net</a>): Info: Query: FLAG=AND<br class="">doveadm(<a href="mailto:jom@grosjo.net" rel="noreferrer" class="">jom@grosjo.net</a>): Info: Query(1): add term(wilcard) : inbox<br class="">doveadm(<a href="mailto:jom@grosjo.net" rel="noreferrer" class="">jom@grosjo.net</a>): Info: Query(2): add term(wilcard) : milan<br class="">doveadm(<a href="mailto:jom@grosjo.net" rel="noreferrer" class="">jom@grosjo.net</a>): Info: Testing if wildcard<br class="">doveadm(<a href="mailto:jom@grosjo.net" rel="noreferrer" class="">jom@grosjo.net</a>): Info: Query: set GLOBAL (no specified header)<br class="">doveadm(<a href="mailto:jom@grosjo.net" rel="noreferrer" class="">jom@grosjo.net</a>): Info: Query : ( bcc:inbox OR body:inbox OR cc:inbox OR from:inbox OR message-id:inbox OR subject:inbox OR to:inbox ) AND ( bcc:milan OR body:milan OR cc:milan OR from:milan OR message-id:milan OR subject:milan OR to:milan )<br class=""><strong class="">doveadm(<a href="mailto:jom@grosjo.net" rel="noreferrer" class="">jom@grosjo.net</a>): Info: Query: 2 results in 1 ms // THIS IS WHEN BACKEND HAS FOUND RESULTS AND STOPPED</strong><br class="">d82b4b0f550d38593644000095331209 847<br class="">d82b4b0f550d38593644000095331209 1569<br class="">d82b4b0f550d38593644000095331209 2260<br class="">d82b4b0f550d38593644000095331209 2575<br class="">d82b4b0f550d38593644000095331209 2811<br class="">d82b4b0f550d38593644000095331209 2885<br class="">d82b4b0f550d38593644000095331209 3038<br class=""><strong class="">d82b4b0f550d38593644000095331209 3121 -> LOOPING FOREVER</strong></p><p class=""><br class=""></p>
<div id="signature" class=""> </div><p class=""><br class=""></p><p id="reply-intro" class="">On 2019-04-21 09:57, Timo Sirainen via dovecot wrote:</p>
<blockquote style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0;" class="">
<div class="pre" style="margin: 0; padding: 0; font-family: monospace;">On 3 Apr 2019, at 20.30, Joan Moreau via dovecot <<a href="mailto:dovecot@dovecot.org" rel="noreferrer" class="">dovecot@dovecot.org</a>> wrote:
<blockquote style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0;" class="">doveadm search -u <a href="mailto:jom@grosjo.net" rel="noreferrer" class="">jom@grosjo.net</a> mailbox inbox text milan<br class="">output<br class=""><br class="">doveadm(<a href="mailto:jom@grosjo.net" rel="noreferrer" class="">jom@grosjo.net</a>): Info: Query : ( bcc:inbox OR body:inbox OR cc:inbox OR from:inbox OR message-id:inbox OR subject:inbox OR to:inbox OR uid:inbox ) AND ( bcc:milan OR body:milan OR cc:milan OR from:milan OR message-id:milan OR subject:milan OR to:milan OR uid:milan )<br class=""><br class="">1 - The query is wrong</blockquote>
<br class="">That's because fts_backend_xapian_lookup() isn't anywhere close to being correct. Try to copy the logic based on solr_add_definite_query_args().<br class=""><br class=""><br class=""></div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
</div></blockquote></div><br class=""></div></body></html>