Hello.

This is in Dovecot 2.1.7 on Linux x86, but it looks as though 2.1.8 has the 
same issue. I'm using fts-lucene. SEARCH HEADER TO returns no results, but 
SEARCH TO works:

B SEARCH TO TEST
* SEARCH 1 2 3 4 5 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 26 27 28 29 31
B OK Search completed (0.000 secs).
C SEARCH HEADER TO TEST
* SEARCH
C OK Search completed (0.000 secs).

Without FTS enabled, both forms of the query work.

It looks as though the header names are indexed in lower case. But Dovecot is 
passing the header name to the backend in upper case when SEARCH HEADER is used.

I'm not sure whether this is the *right* fix, but lower-casing the header name 
in lucene-wrapper.cc seems to fix the problem:

--- dovecot-2.1.7-clean/src/plugins/fts-lucene/lucene-wrapper.cc        
2011-12-13 06:35:29.000000000 -0500
+++ dovecot-2.1.7/src/plugins/fts-lucene/lucene-wrapper.cc      2012-07-24 
14:03:14.000000000 -0400
@@ -1094,7 +1094,7 @@
                        return false;
 
                q = lucene_get_query(index,
-                                    t_lucene_utf8_to_tchar(index, 
arg->hdr_field_name, FALSE),
+                                    t_lucene_utf8_to_tchar(index, 
t_str_lcase(arg->hdr_field_name), FALSE),
                                     arg);
                break;
        default:

Now:

B SEARCH TO TEST
* SEARCH 1 2 3 4 5 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 26 27 28 29 31
B OK Search completed (0.000 secs).
C SEARCH HEADER TO TEST
* SEARCH 1 2 3 4 5 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 26 27 28 29 31
C OK Search completed (0.000 secs).

-- 

Matthew Powell                                          matt...@atom.net


Reply via email to