lucene-wrapper.cc revision b07cb607ae8864e7784787a9db96880db1f50e52
baf6671fd3847865da9b64dc8f8be85d81304840Daniel Lezcano/* Copyright (c) 2006-2010 Dovecot authors, see the included COPYING file */
892bd61e0fcc788390abfadd32b1897943290879dlezcanoextern "C" {
8b8b04f80adf21480c25deb1aae263049ddd6754dlezcano/* Lucene's default is 10000. Use it here also.. */
6a85cf91247b7dd9c3faeddceca8dacb96d02cd6Stéphane GraberARRAY_DEFINE_TYPE(lucene_query, struct lucene_query);
3b9246c4aae3f7602c0ad64f5b1204eb559e5b07Daniel Lezcano wchar_t mailbox_guid[MAILBOX_GUID_HEX_LENGTH + 1];
struct rescan_context {
int box_ret;
unsigned int uids_iter_n;
bool warned;
static int textcat_refcount = 0;
unsigned int len;
#ifdef HAVE_LUCENE_STEMMER
return index;
struct lucene_analyzer *a;
#ifdef HAVE_LUCENE_TEXTCAT
for (i = 0; i < len; i++) {
i_unreached();
wchar_t *ret;
unsigned int len;
i_unreached();
return ret;
MAILBOX_GUID_HEX_LENGTH * sizeof(wchar_t));
const char *msg)
UNLINK_DIRECTORY_FLAG_RMDIR) < 0 &&
int ret;
return ret;
while (*uid != 0) {
uid++;
int ret = 0;
*last_uid_r = 0;
return ret;
&uid) < 0) {
return ret;
int ret;
if (ret == 0) {
*count_r = 0;
int ret = 0;
if (ret != 0)
return ret;
return ret;
const char *lock_path;
!exists);
#ifdef HAVE_LUCENE_TEXTCAT
const struct lucene_analyzer *a;
return a->analyzer;
unsigned int len;
return NULL;
static Analyzer *
const char *lang;
if (textcat_broken)
return NULL;
return NULL;
return NULL;
static Analyzer *
return NULL;
int ret = 0;
return ret;
const char *hdr_name)
index->doc->add(*_CLNEW Field(_T("box"), index->mailbox_guid, Field::STORE_YES | Field::INDEX_UNTOKENIZED));
} else if (size > 0) {
int ret = 0;
return ret;
} T_END;
int ret;
return ret;
int ret;
(enum mailbox_flags)0);
const char *errstr;
ret = 0;
return ret;
&idx_uid)) {
(enum mailbox_list_iter_flags)
(enum mailbox_flags)0);
&metadata) == 0 &&
bool failed = false;
int ret;
return ret;
if (ret > 0) try {
if (ret > 0)
if (ret < 0)
failed = true;
else if (ret == 0)
failed = true;
for (i = 0; i < MAILBOX_GUID_HEX_LENGTH; i++)
int ret;
return ret;
&uid) < 0 ||
return ret2;
int ret = 0;
return ret;
static Query* getFieldQuery(Analyzer *analyzer, const TCHAR* _field, const TCHAR* queryText, bool fuzzy) {
bool severalTokensAtSamePosition = false;
t = NULL;
if (t == NULL)
v.push_back(t);
if (t->getPositionIncrement() != 0)
severalTokensAtSamePosition = true;
if (v.size() == 0)
return NULL;
if (fuzzy)
return ret;
if (severalTokensAtSamePosition) {
t = v.at(i);
return mpq;
t = v.at(i);
return pq;
static Query *
static Query *
Query *q;
case SEARCH_TEXT: {
q = NULL;
q = bq;
case SEARCH_BODY:
case SEARCH_HEADER:
case SEARCH_HEADER_ADDRESS:
arg);
if (q == NULL) {
if (!and_args)
case SEARCH_HEADER:
case SEARCH_HEADER_ADDRESS:
if (q == NULL) {
if (!and_args)
return TRUE;
return FALSE;
int ret = 0;
&uid) < 0) {
return ret;
bool have_definites = false;
have_definites = true;
if (have_definites) {
bool have_maybies = false;
have_maybies = true;
if (have_maybies) {
int ret = 0;
wchar_t *key;
&uid) < 0) {
return ret;
bool have_definites = false;
have_definites = true;
if (have_definites) {
struct lucene_index_iter {
size_t i;
bool failed;
struct lucene_index_iter *
int ret;
if (ret < 0)
return iter;
return iter;
const struct lucene_index_record *
return NULL;
return NULL;
iter->i++;
return ret;
void lucene_shutdown(void)