fts-user.c revision 084431105a179063aeb08f45eb5f506c61ea8602
/* Copyright (c) 2015-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "module-context.h"
#include "mail-user.h"
#include "fts-language.h"
#include "fts-filter.h"
#include "fts-tokenizer.h"
#include "fts-user.h"
#define FTS_USER_CONTEXT(obj) \
struct fts_user {
int refcount;
struct fts_language_list *lang_list;
struct fts_user_language *data_lang;
};
static const char *const *str_keyvalues_to_array(const char *str)
{
unsigned int i;
return NULL;
else {
value = "";
}
}
}
static int
const char **error_r)
{
*error_r = "fts_languages setting is missing";
return -1;
}
lang_config[0] = "fts_language_config";
return -1;
"fts_languages: Unknown language '%s'", unknown);
return -1;
}
*error_r = "fts_languages setting is empty";
return -1;
}
return 0;
}
static int
{
const struct fts_filter *filter_class;
unsigned int i;
int ret = 0;
/* try to get the language-specific filters first */
/* fallback to global filters */
filters_key = "fts_filters";
/* No filters */
return 0;
}
}
if (filter_class == NULL) {
filters_key, filters[i]);
ret = -1;
break;
}
/* try the language-specific setting first */
}
ret = -1;
break;
}
}
if (ret < 0) {
return -1;
}
return 0;
}
static int
const struct fts_language *lang,
const char **error_r)
{
const struct fts_tokenizer *tokenizer_class;
unsigned int i;
int ret = 0;
return -1;
}
tokenizers_key = "fts_tokenizers";
}
for (i = 0; tokenizers[i] != NULL; i++) {
if (tokenizer_class == NULL) {
tokenizers_key, tokenizers[i]);
ret = -1;
break;
}
}
/* tell the tokenizers that we're tokenizing a search string
(instead of tokenizing indexed data) */
if (search)
ret = -1;
break;
}
}
if (ret < 0) {
return -1;
}
*tokenizer_r = tokenizer;
return 0;
}
static int
struct fts_user_language *user_lang,
const char **error_r)
{
error_r) < 0)
return -1;
error_r) < 0)
return -1;
return 0;
}
struct fts_user_language *
const struct fts_language *lang)
{
struct fts_user_language *const *user_langp;
return *user_langp;
}
return NULL;
}
const struct fts_language *lang,
const char **error_r)
{
struct fts_user_language *user_lang;
return -1;
return -1;
return 0;
}
const char **error_r)
{
const struct fts_language *const *langp;
return -1;
}
return 0;
}
static int
const char **error_r)
{
struct fts_user_language *user_lang;
const char *error;
return -1;
i_unreached();
return 0;
}
{
}
const ARRAY_TYPE(fts_user_language) *
{
}
const ARRAY_TYPE(fts_user_language) *
{
return &fuser->data_languages;
}
{
}
{
}
{
struct fts_user_language *const *user_langp;
}
{
/* multiple fts plugins are loaded */
return 0;
}
return -1;
}
return -1;
}
return 0;
}
{
}
}