fts-user.c revision fac865bad1ba10e85d80b63dedfd3493a65510d4
c1252a5812eb11fcb81508b9ed37597a5bc84100Timo Sirainen/* Copyright (c) 2015 Dovecot authors, see the included COPYING file */
c1252a5812eb11fcb81508b9ed37597a5bc84100Timo Sirainen#define FTS_DEFAULT_TOKENIZERS "generic email-address"
c1252a5812eb11fcb81508b9ed37597a5bc84100Timo Sirainen#define FTS_DEFAULT_FILTERS "normalizer-icu snowball"
c1252a5812eb11fcb81508b9ed37597a5bc84100Timo Sirainen struct fts_tokenizer *index_tokenizer, *search_tokenizer;
c1252a5812eb11fcb81508b9ed37597a5bc84100Timo Sirainenstatic MODULE_CONTEXT_DEFINE_INIT(fts_user_module,
c1252a5812eb11fcb81508b9ed37597a5bc84100Timo Sirainenstatic const char *const *str_keyvalues_to_array(const char *str)
c1252a5812eb11fcb81508b9ed37597a5bc84100Timo Sirainen unsigned int i;
c1252a5812eb11fcb81508b9ed37597a5bc84100Timo Sirainenfts_user_init_languages(struct mail_user *user, struct fts_user *fuser,
01f54478a7c69b88ab13840c99bbab19a0d7d754Timo Sirainen const char **error_r)
e6837a4f1118565d2ac460dce140705d56f779b3Timo Sirainen const char *lang_config[3] = {NULL, NULL, NULL};
c1252a5812eb11fcb81508b9ed37597a5bc84100Timo Sirainen languages = mail_user_plugin_getenv(user, "fts_languages");
c1252a5812eb11fcb81508b9ed37597a5bc84100Timo Sirainen *error_r = "fts_languages setting is missing";
c1252a5812eb11fcb81508b9ed37597a5bc84100Timo Sirainen lang_config[1] = mail_user_plugin_getenv(user, "fts_language_config");
c1252a5812eb11fcb81508b9ed37597a5bc84100Timo Sirainen fuser->lang_list = fts_language_list_init(lang_config);
c1252a5812eb11fcb81508b9ed37597a5bc84100Timo Sirainen if (!fts_language_list_add_names(fuser->lang_list, languages, &unknown)) {
c1252a5812eb11fcb81508b9ed37597a5bc84100Timo Sirainen "fts_languages: Unknown language '%s'", unknown);
c1252a5812eb11fcb81508b9ed37597a5bc84100Timo Sirainen if (array_count(fts_language_list_get_all(fuser->lang_list)) == 0) {
int ret = 0;
if (ret < 0) {
const char **error_r)
int ret = 0;
if (search)
if (ret < 0) {
const char **error_r)
error_r) < 0)
error_r) < 0)
struct fts_user_language *
return *user_langp;
return NULL;
const char **error_r)
const char **error_r)
const char *error;
i_unreached();