fts-storage.h revision 67f1723e1685b4bf73c1cca0a1e08a0a87ffd410
965ed6ea3fc8f7637bd0d159d2fdb283a191ce34Timo Sirainen#ifndef FTS_STORAGE_H
965ed6ea3fc8f7637bd0d159d2fdb283a191ce34Timo Sirainen#define FTS_STORAGE_H
965ed6ea3fc8f7637bd0d159d2fdb283a191ce34Timo Sirainen
cfdaa223525f87c9c980a25cc7bb6770a248d76aTimo Sirainenstruct fts_mailbox {
cfdaa223525f87c9c980a25cc7bb6770a248d76aTimo Sirainen union mailbox_module_context module_ctx;
cfdaa223525f87c9c980a25cc7bb6770a248d76aTimo Sirainen struct fts_backend *backend_substr;
cfdaa223525f87c9c980a25cc7bb6770a248d76aTimo Sirainen struct fts_backend *backend_fast;
965ed6ea3fc8f7637bd0d159d2fdb283a191ce34Timo Sirainen
965ed6ea3fc8f7637bd0d159d2fdb283a191ce34Timo Sirainen const char *env;
3c9783956dea385b322cd7fa6bf8c98c17a907a0Timo Sirainen unsigned int backend_set:1;
965ed6ea3fc8f7637bd0d159d2fdb283a191ce34Timo Sirainen};
965ed6ea3fc8f7637bd0d159d2fdb283a191ce34Timo Sirainen
965ed6ea3fc8f7637bd0d159d2fdb283a191ce34Timo Sirainenstruct fts_search_context {
965ed6ea3fc8f7637bd0d159d2fdb283a191ce34Timo Sirainen union mail_search_module_context module_ctx;
965ed6ea3fc8f7637bd0d159d2fdb283a191ce34Timo Sirainen
965ed6ea3fc8f7637bd0d159d2fdb283a191ce34Timo Sirainen struct fts_mailbox *fbox;
965ed6ea3fc8f7637bd0d159d2fdb283a191ce34Timo Sirainen struct mailbox_transaction_context *t;
965ed6ea3fc8f7637bd0d159d2fdb283a191ce34Timo Sirainen struct mail_search_arg *args;
965ed6ea3fc8f7637bd0d159d2fdb283a191ce34Timo Sirainen struct mail_search_arg *best_arg;
e65cc79f80577e83c706f0678c78e2c0bd91434fTimo Sirainen
7d6389e4053c2dac1fb37180b5756b00785983dcTimo Sirainen ARRAY_TYPE(seq_range) definite_seqs, maybe_seqs;
7d6389e4053c2dac1fb37180b5756b00785983dcTimo Sirainen unsigned int definite_idx, maybe_idx;
6ef7e31619edfaa17ed044b45861d106a86191efTimo Sirainen uint32_t first_nonindexed_seq;
f1ddb98e6b639394ae205b305be1ddcfab102578Timo Sirainen
a399486f2d8d5bed51bc6344baba61a7f2b0dcdbTimo Sirainen struct fts_backend *build_backend;
40992309053d51192ae1b36d1dd6c057f2d37257Timo Sirainen struct fts_storage_build_context *build_ctx;
a399486f2d8d5bed51bc6344baba61a7f2b0dcdbTimo Sirainen
a399486f2d8d5bed51bc6344baba61a7f2b0dcdbTimo Sirainen unsigned int build_initialized:1;
a399486f2d8d5bed51bc6344baba61a7f2b0dcdbTimo Sirainen unsigned int seqs_set:1;
a399486f2d8d5bed51bc6344baba61a7f2b0dcdbTimo Sirainen};
a399486f2d8d5bed51bc6344baba61a7f2b0dcdbTimo Sirainen
965ed6ea3fc8f7637bd0d159d2fdb283a191ce34Timo Sirainen/* Figure out if we want to use full text search indexes and update
e82af44fe25ca9b88210f313548dc08538e4a677Timo Sirainen backends in fctx accordingly. */
965ed6ea3fc8f7637bd0d159d2fdb283a191ce34Timo Sirainenvoid fts_search_analyze(struct fts_search_context *fctx);
b567e0172c73dcf7642462e86962060358dd5f28Timo Sirainen/* Perform the actual index lookup and update definite_uids and maybe_uids. */
b567e0172c73dcf7642462e86962060358dd5f28Timo Sirainenvoid fts_search_lookup(struct fts_search_context *fctx);
10c5fd417af4ee30b68c967f5e7d5a49f4f149b5Timo Sirainen
10c5fd417af4ee30b68c967f5e7d5a49f4f149b5Timo Sirainen#endif
10c5fd417af4ee30b68c967f5e7d5a49f4f149b5Timo Sirainen