Re: search problem using white spaces...

Paul Lesniewski <[email protected]>
Newsgroups gmane.mail.squirrelmail.devel
Message-ID <[email protected]>
On Fri, Dec 11, 2009 at 3:12 PM, Paul Lesniewski <[email protected]> wrote:
> Please do not top-post.  I believe you should know better.
>
>>> I'm using SM1.4.20rc2 and cyrus.
>>>
>>> Whenever I search for something let's say in the "From" header, using a
>>> word I have no problem, cyrus finds it inmedeatily.
>>> However, I a use two (or more) words, it takes a long time and I get:
>>> Connection terminated by IMAP server, "Query: SEARCH CHARSET ISO-8859-1 ALL
>>> FROM".
>>>
>>> I have disabled, charset search... same problem. If I do the search using
>>> telnet I have no problem either.
>>>
>>> For instance, searching "javier wilson": A06 UID SEARCH CHARSET
>>> "ISO-8859-1" ALL FROM "javier wilson"
>>> works fine using telnet. It does not work using Squirrelmail.
>>>
>>> Any ideas, anyone with a similar problem?
>>> Could it be because of " $multi_search = explode(' ', $search_what); "  in
>>> functions/imap_search.php ?
>>
>> I corrected the problem changing line 38 of functions/imap_search.php:
>>
>> < $multi_search = explode(' ', $search_what);
>>> $multi_search = array( $search_what );
>>
>> Of course this doesn't search "javier" *and* "wilson", but "javier wilson",
>> which is what I intended anyway.
>>
>> In summary, I would say multi_search is broken in SM1.4.20rc2
>
> Confirmed.  With search terms other than single words, I get:
>
> ERROR: Could not complete request.
> Query: FETCH (FLAGS UID RFC822.SIZE INTERNALDATE
> BODY.PEEK[HEADER.FIELDS (Date To Cc From Subject X-Priority Importance
> Priority Content-Type)])
> Reason Given: Error in IMAP command received by server.

The problem seems to be that the SEARCH command is sending each word
as a separate string after the search key... something like:

A01 SEARCH CHARSET ISO-8859-1 ALL FROM {6}
javier {6}
wilson

That's the same as:

A01 SEARCH CHARSET ISO-8859-1 ALL FROM javier wilson

Which doesn't match RFC as far as I can tell.  The SEARCH command
accepts a single string argument for keys like FROM.  The examples
above are sending two strings, not one.  You either have to quote the
two strings (which makes the search different than we've had it before
wherein the whole string "javier wilson" is searched for as is.  I
think to search for the intersect of "javier" and "wilson", you have
to specify the key for each string, i.e.,

A01 SEARCH CHARSET ISO-8859-1 ALL FROM {6}
javier FROM {6}
wilson

Or this:

A01 SEARCH CHARSET ISO-8859-1 ALL FROM javier FROM wilson

My tests on the command line bear this out.


-- 
Paul Lesniewski
SquirrelMail Team
Please support Open Source Software by donating to SquirrelMail!
http://squirrelmail.org/donate_paul_lesniewski.php

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: [email protected]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.