diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
commit | f7548d6d28c313cf80e6f3ef89aed16a19815df1 (patch) | |
tree | a3f6f2a3f247293bee59ecd28e8cd8ceb6ca064a /src/plugins/fts-lucene/lucene-wrapper.h | |
parent | Initial commit. (diff) | |
download | dovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.tar.xz dovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.zip |
Adding upstream version 1:2.3.19.1+dfsg1.upstream/1%2.3.19.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/plugins/fts-lucene/lucene-wrapper.h')
-rw-r--r-- | src/plugins/fts-lucene/lucene-wrapper.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/plugins/fts-lucene/lucene-wrapper.h b/src/plugins/fts-lucene/lucene-wrapper.h new file mode 100644 index 0000000..270e902 --- /dev/null +++ b/src/plugins/fts-lucene/lucene-wrapper.h @@ -0,0 +1,67 @@ +#ifndef LUCENE_WRAPPER_H +#define LUCENE_WRAPPER_H + +#include "fts-api-private.h" +#include "guid.h" + +struct mailbox_list; +struct fts_expunge_log; +struct fts_lucene_settings; + +#define MAILBOX_GUID_HEX_LENGTH (GUID_128_SIZE*2) + +struct lucene_index_record { + guid_128_t mailbox_guid; + uint32_t uid, part_num; +}; + +HASH_TABLE_DEFINE_TYPE(wguid_result, wchar_t *, struct fts_result *); + +struct lucene_index * +lucene_index_init(const char *path, struct mailbox_list *list, + const struct fts_lucene_settings *set) + ATTR_NULL(2, 3); +void lucene_index_deinit(struct lucene_index *index); + +void lucene_index_select_mailbox(struct lucene_index *index, + const wchar_t guid[MAILBOX_GUID_HEX_LENGTH]); +void lucene_index_unselect_mailbox(struct lucene_index *index); +int lucene_index_get_last_uid(struct lucene_index *index, uint32_t *last_uid_r); +int lucene_index_get_doc_count(struct lucene_index *index, uint32_t *count_r); + +int lucene_index_build_init(struct lucene_index *index); +int lucene_index_build_more(struct lucene_index *index, uint32_t uid, + uint32_t part_num, const unsigned char *data, + size_t size, const char *hdr_name); +int lucene_index_build_deinit(struct lucene_index *index); + +void lucene_index_close(struct lucene_index *index); +int lucene_index_rescan(struct lucene_index *index); +int lucene_index_expunge_from_log(struct lucene_index *index, + struct fts_expunge_log *log); +int lucene_index_optimize(struct lucene_index *index); + +int lucene_index_lookup(struct lucene_index *index, + struct mail_search_arg *args, + enum fts_lookup_flags flags, + struct fts_result *result); + +int lucene_index_lookup_multi(struct lucene_index *index, + HASH_TABLE_TYPE(wguid_result) guids, + struct mail_search_arg *args, + enum fts_lookup_flags flags, + struct fts_multi_result *result); + +struct lucene_index_iter * +lucene_index_iter_init(struct lucene_index *index); +const struct lucene_index_record * +lucene_index_iter_next(struct lucene_index_iter *iter); +int lucene_index_iter_deinit(struct lucene_index_iter **iter); + +/* internal: */ +void lucene_utf8_n_to_tchar(const unsigned char *src, size_t srcsize, + wchar_t *dest, size_t destsize); + +void lucene_shutdown(void); + +#endif |