/* Copyright 2005 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "apr.h" #include "apr_strings.h" #include "apr_date.h" #include "apr_buckets.h" #ifndef NO_MBOX_SEARCH #include "lcn_init.h" #include "lcn_document.h" #include "lcn_pools.h" #include "lcn_index_writer.h" #include "lcn_query_parser.h" #include "lcn_searcher.h" #endif #ifndef MBOX_SEARCH_H #define MBOX_SEARCH_H #ifdef __cplusplus extern "C" { #endif typedef struct mbox_search_doc_t { const char* msgid; const char* list; const char* domain; const char* from; const char* subject; char date[APR_RFC822_DATE_LEN+1]; float score; } mbox_search_doc_t; typedef struct mbox_search_query_t { const char* msgid; const char* list; const char* domain; const char* from; const char* subject; const char* terms; } mbox_search_query_t; typedef struct mbox_searcher_t { void* reader; } mbox_searcher_t; typedef struct mbox_indexer_t { #ifndef NO_MBOX_SEARCH apr_pool_t* pool; apr_pool_t* tpool; lcn_analyzer_t *analyzer; lcn_index_writer_t* writer; lcn_searcher_t* searcher; const char* path; #endif } mbox_indexer_t; apr_status_t mbox_indexer_init(mbox_indexer_t** ctx, const char* path, apr_pool_t* pool); apr_status_t mbox_indexer_optimize(mbox_indexer_t* ctx); apr_status_t mbox_indexer_close(mbox_indexer_t* ctx); apr_status_t mbox_indexer_add(mbox_indexer_t* ctx, mbox_search_doc_t* doc); typedef int (query_callback_fn_t)(void* baton, int position, mbox_search_doc_t* rdoc); apr_status_t mbox_search_init(mbox_searcher_t** ctx_, const char* path, apr_pool_t* pool); apr_status_t mbox_search_query_do(mbox_searcher_t* ctx, mbox_search_query_t* qt, query_callback_fn_t* cb, void* baton); apr_status_t mbox_search_close(mbox_searcher_t* ctx); #ifdef __cplusplus } #endif #endif