c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen#ifndef FTS_FILTER_PRIVATE_H
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen#define FTS_FILTER_PRIVATE_H
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen
3e462730eb79d8a7289edc138cf80cf79a737268Timo Sirainen#include "fts-filter.h"
3e462730eb79d8a7289edc138cf80cf79a737268Timo Sirainen
440b625484f3cc9d3ec0a7ba36fe3583aa90172dTeemu Huovila#define FTS_FILTER_CLASSES_NR 6
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen/*
88f5dbec21b26b80371961d5d6320bb2aa92384cTeemu Huovila API that stemming providers (classes) must provide: The create()
88f5dbec21b26b80371961d5d6320bb2aa92384cTeemu Huovila function is called to get an instance of a registered filter class.
88f5dbec21b26b80371961d5d6320bb2aa92384cTeemu Huovila The filter() function is called with tokens for the specific filter.
88f5dbec21b26b80371961d5d6320bb2aa92384cTeemu Huovila The destroy function is called to destroy an instance of a filter.
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen*/
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainenstruct fts_filter_vfuncs {
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen int (*create)(const struct fts_language *lang,
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen const char *const *settings,
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen struct fts_filter **filter_r,
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen const char **error_r);
6111370718708a3a966c60a1941ea303a4e0c759Timo Sirainen int (*filter)(struct fts_filter *filter, const char **token,
6111370718708a3a966c60a1941ea303a4e0c759Timo Sirainen const char **error_r);
1d0f568e26ce5cbf18cd7bb335c6eea20a7e3770Teemu Huovila
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen void (*destroy)(struct fts_filter *filter);
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen};
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainenstruct fts_filter {
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen const char *class_name; /* name of the class this is based on */
be7085921228e1c1333dbf7aa2daca41115c3f23Timo Sirainen struct fts_filter_vfuncs v;
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen struct fts_filter *parent;
887b04f7b235dbc18a5f787ac95ddc86e653ab6fTimo Sirainen string_t *token;
a754c3be2b1e00fe42ecdb6b068d444be0030420Teemu Huovila size_t max_length;
a754c3be2b1e00fe42ecdb6b068d444be0030420Teemu Huovila int refcount;
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen};
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen
c865b0e9c65fd77f7b2ab6f8616d3def5501ecb3Timo Sirainen#endif