de62ce819d59a529530da4b57be1b8d6dad13d6bTimo Sirainen#define MAILBOX_GUID_HEX_LENGTH (GUID_128_SIZE*2)
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen int (*init)(struct fts_backend *backend, const char **error_r);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen int (*get_last_uid)(struct fts_backend *backend, struct mailbox *box,
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen int (*update_deinit)(struct fts_backend_update_context *ctx);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen void (*update_set_mailbox)(struct fts_backend_update_context *ctx,
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen void (*update_expunge)(struct fts_backend_update_context *ctx,
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen /* Start a build for specified key */
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen bool (*update_set_build_key)(struct fts_backend_update_context *ctx,
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen /* Finish a build for specified key - guaranteed to be called */
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen void (*update_unset_build_key)(struct fts_backend_update_context *ctx);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen /* Add data for current build key */
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen int (*update_build_more)(struct fts_backend_update_context *ctx,
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen bool (*can_lookup)(struct fts_backend *backend,
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen int (*lookup)(struct fts_backend *backend, struct mailbox *box,
117fb8c00336dc54bab9cfa547249df7a4970611Timo Sirainen struct mail_search_arg *args, enum fts_lookup_flags flags,
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen int (*lookup_multi)(struct fts_backend *backend,
b7fdf4fe23801de680e0be5aca0596a3c9ea3f8fTimo Sirainen void (*lookup_done)(struct fts_backend *backend);
2116e38edb504e72eadaf5a51c3dd9b1a81039eaTimo Sirainen /* Backend supports indexing binary MIME parts */
d9076f5939edf5d20a261494b1a861dcbb0d32e2Timo Sirainen /* Send built text to backend normalized rather than
0fbea4dd37f44d2fcfcd4a36a36a6e545696f0e6Timo Sirainen preserving original case */
84f447a23beceb6ab5898083052e1b5bae51f033Timo Sirainen /* Send only fully indexable words rather than randomly sized blocks */
e51bfe0db17f1a2e44932d0d6d3958ae409a8bcfTimo Sirainen /* Fuzzy search works */
1537d20b852cbbf0d6971790b84e0cce5ca61307Timo Sirainen /* Tokenize all the input. update_build_more() will be called a single
1537d20b852cbbf0d6971790b84e0cce5ca61307Timo Sirainen directly indexable token at a time. Searching will modify the search
1537d20b852cbbf0d6971790b84e0cce5ca61307Timo Sirainen args so that lookup() sees only tokens that can be directly
54d437dea655b338e45a8917880f3d3a2a7b698dTimo Sirainen /* Checksum of settings. If the settings change, the index should
54d437dea655b338e45a8917880f3d3a2a7b698dTimo Sirainen be rebuilt. */
2793e3bd31d212d6506686aa70773e13d9d98195Timo Sirainenvoid fts_backend_register(const struct fts_backend *backend);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainenbool fts_backend_default_can_lookup(struct fts_backend *backend,
809923ba26218971792182ae8894936f9ac99364Timo Sirainenvoid fts_filter_uids(ARRAY_TYPE(seq_range) *definite_dest,
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen/* Returns TRUE if ok, FALSE if no fts header */
54d437dea655b338e45a8917880f3d3a2a7b698dTimo Sirainenbool fts_index_get_header(struct mailbox *box, struct fts_index_header *hdr_r);
b66d803de86bfb411165b3465b0d9ef64ecfe2a1Timo Sirainenfts_index_set_last_uid(struct mailbox *box, uint32_t last_uid);
263d455e9198e8aa45c7a99601ad6a5a9dcdd915Timo Sirainenint fts_backend_reset_last_uids(struct fts_backend *backend);
54d437dea655b338e45a8917880f3d3a2a7b698dTimo Sirainenint fts_index_have_compatible_settings(struct mailbox_list *list,
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen/* Returns TRUE if FTS backend should index the header for optimizing
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainen separate lookups */
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainenbool fts_header_want_indexed(const char *hdr_name);
4ac43ad128cb9b22f1c936659a1ff62e5b6c8bc3Timo Sirainen/* Returns TRUE if header's values should be considered to have a language. */
4ac43ad128cb9b22f1c936659a1ff62e5b6c8bc3Timo Sirainenbool fts_header_has_language(const char *hdr_name);
8d587838c414c48a331f0b54cd7ffd97e5024abdTimo Sirainenint fts_mailbox_get_guid(struct mailbox *box, const char **guid_r);