fts-api.h revision de11cf486e0d0448537b1b5d546496ab85e7cda8
#ifndef FTS_API_H
#define FTS_API_H
struct mail;
struct mailbox;
struct fts_backend_build_context;
#include "seq-range-array.h"
enum fts_lookup_flags {
At least one of these must be set. */
FTS_LOOKUP_FLAG_HEADER = 0x01,
FTS_LOOKUP_FLAG_BODY = 0x02,
/* The key must NOT be found */
FTS_LOOKUP_FLAG_INVERT = 0x04
};
struct fts_backend_uid_map {
const char *mailbox;
};
struct fts_score_map {
float score;
};
struct fts_backend *
/* Get the last_uid for the mailbox. */
/* Get last_uids for all mailboxes that might be backend mailboxes for a
virtual mailbox. The backend can use mailbox_get_virtual_backend_boxes() or
mailbox_get_virtual_box_patterns() functions to get the list of mailboxes.
Depending on virtual mailbox configuration, this function may also return
mailboxes that don't even match the virtual mailbox patterns. The caller
needs to be able to ignore the unnecessary ones. */
/* Initialize adding new data to the index. last_uid_r is set to the last
indexed message's IMAP UID */
struct fts_backend_build_context **ctx_r);
/* Switch to building index for mail's headers or MIME part headers. */
/* Switch to building index for the next body part. If backend doesn't want
to index this body part (based on content type/disposition check), it can
return FALSE and caller will skip to next part. The backend must return
The content_disposition is passed without parsing/validation if it exists,
otherwise it's NULL. */
const char *content_disposition);
/* Called once when the whole body part has been sent. */
The data must contain only full valid UTF-8 characters, but it doesn't need
to be NUL-terminated. size contains the data size in bytes, not characters.
This function may be called many times and the data block sizes may be
small. Backend returns 0 if ok, -1 if build should be aborted. */
/* Finish adding new data to the index. */
/* Returns TRUE if there exists a build context. */
/* Expunge given mail from the backend. Note that the transaction may still
fail later, so backend shouldn't do anything irreversible. */
/* Called after transaction has been committed or rollbacked. */
/* Refresh database to make sure we see latest changes from lookups.
Returns 0 if ok, -1 if error. */
/* Start building a FTS lookup. */
struct fts_backend_lookup_context *
/* Add a new search key to the lookup. The keys are ANDed together. */
/* Finish the lookup and return found UIDs. The definite_uids are returned
to client directly, while for maybe_uids Dovecot first verifies (by
opening and reading the mail) that they really do contain the searched
keys. The maybe_uids is useful with backends that can only filter out
messages, but can't definitively say if the search matched a message. */
#endif