/* 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. */ #ifndef _LCN_INDEX_WRITER_H #define _LCN_INDEX_WRITER_H #include "lcn_document.h" #include "lcn_analyzer.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** An index writer object. */ typedef struct lcn_index_writer_t lcn_index_writer_t; /** Open a new @a writer that will create an index at @a path, using * @a analyzer, allocated in @a pool. */ lcn_error_t * lcn_index_writer_create (lcn_index_writer_t **writer, const char *path, lcn_analyzer_t *analyzer, apr_pool_t *pool); /** Open a new @a writer that will write to an index that already exists at * @a path, using @a analyzer, allocated in @a pool. */ lcn_error_t * lcn_index_writer_open (lcn_index_writer_t **writer, const char *path, lcn_analyzer_t *analyzer, apr_pool_t *pool); /** Add @a document to the index referred to by @a writer, using @a pool for * temporary allocations. */ lcn_error_t * lcn_index_writer_add_document (lcn_index_writer_t *writer, lcn_document_t *document, apr_pool_t *pool); /** Optimize @a writer. * Merges all segments together into a single segment, optimizing an index * for search. */ lcn_error_t * lcn_index_writer_optimize (lcn_index_writer_t *writer); /** Close @a writer. * * Strictly speaking, this is not needed, as it will be closed when the pool * @a writer was allocated in is cleared, but it can be useful when you need * to close a writer before its pool is cleared. */ lcn_error_t * lcn_index_writer_close (lcn_index_writer_t *writer); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _LCN_INDEX_WRITER_H */