From 6ccd0e6f59bec5f1900c49cd1868fca998570fc7 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 18 Apr 2002 02:18:55 +0000 Subject: When doing a contains match, split the words and perform an and on it. 2002-04-18 Not Zed * camel-folder-search.c (check_header): When doing a contains match, split the words and perform an and on it. (match_words_messages): If we have an index, but were forced to do a full search, first lookup a subset of messages using the index and a simplified word set. Only do a manual search of this subset. 2002-04-17 Not Zed * camel-folder-search.c (match_message_index): Changed to take a utf8 string not a regex pattern. (match_words_index): Matches against a camel_search_words list. (match_words_1message): Matches a single message against a camel_search_words list. (match_words_message): Same, but gets the message from the folder for you. (match_words_messages): Matches a list of messages against a words list. (search_body_contains): Rewritten to handle multiple word searches. For #23371. * providers/imap/camel-imap-search.c (sync_match): Split words when searching, to support multiple search words. Also, try searching specifying charset of utf8 if we can, if that fails, fall back to not specifying charset. TODO: It should translate the strings into the locale default charset? * providers/imap/camel-imap-store.c (connect_to_server): Added new cap - utf8_search, if set, we tell the server we're searching using utf8, otherwise we dont (incorrectly, since we always use utf8 to search). * camel-search-private.c (camel_ustrstrcase): Make this class public. (camel_search_words_split): Split a word into multiple words based on whitespace, and keep track of whether the word is simple (indexable directly), or not. (camel_search_words_free): Free 'em. svn path=/trunk/; revision=16501 --- camel/camel-search-private.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'camel/camel-search-private.h') diff --git a/camel/camel-search-private.h b/camel/camel-search-private.h index e45d6fe321..7cc30b687f 100644 --- a/camel/camel-search-private.h +++ b/camel/camel-search-private.h @@ -21,6 +21,8 @@ #ifndef _CAMEL_SEARCH_PRIVATE_H #define _CAMEL_SEARCH_PRIVATE_H +#include + typedef enum { CAMEL_SEARCH_MATCH_START = 1<<0, CAMEL_SEARCH_MATCH_END = 1<<1, @@ -52,4 +54,29 @@ gboolean camel_search_message_body_contains(CamelDataWrapper *object, regex_t *p gboolean camel_search_header_match(const char *value, const char *match, camel_search_match_t how, camel_search_t type, const char *default_charset); gboolean camel_search_header_soundex(const char *header, const char *match); +/* TODO: replace with a real search function */ +const char *camel_ustrstrcase(const char *haystack, const char *needle); + +/* Some crappy utility functions for handling multiple search words */ +enum _camel_search_word_t { + CAMEL_SEARCH_WORD_SIMPLE = 1, + CAMEL_SEARCH_WORD_COMPLEX = 2, + CAMEL_SEARCH_WORD_8BIT = 4, +}; +struct _camel_search_word { + enum _camel_search_word_t type; + char *word; +}; + +struct _camel_search_words { + int len; + enum _camel_search_word_t type; /* OR of all word types in list */ + struct _camel_search_word **words; +}; + +struct _camel_search_words *camel_search_words_split(const unsigned char *in); +struct _camel_search_words *camel_search_words_simple(struct _camel_search_words *wordin); +void camel_search_words_free(struct _camel_search_words *); + #endif /* ! _CAMEL_SEARCH_PRIVATE_H */ + -- cgit v1.2.3