Index: include/lcn_index_writer.h =================================================================== --- include/lcn_index_writer.h (revision 179487) +++ include/lcn_index_writer.h (working copy) @@ -24,8 +24,10 @@ extern "C" { #endif /* __cplusplus */ +#ifndef LCN_INTERNAL /** An index writer object. */ typedef struct lcn_index_writer_t lcn_index_writer_t; +#endif /** Open a new @a writer that will create an index at @a path, using * @a analyzer, allocated in @a pool. */ Index: src/index/writer.cxx =================================================================== --- src/index/writer.cxx (revision 179487) +++ src/index/writer.cxx (working copy) @@ -18,21 +18,24 @@ #include -#include "lcn_index_writer.h" - #include "../util/exception.h" #include "../analysis/analyzer.hxx" #include "../document/document.hxx" +/* declare lcn_index_writer_t so lcn_index_writer.h works in internal mode */ +extern "C" { + typedef org::apache::lucene::index::IndexWriter lcn_index_writer_t; +} + +#define LCN_INTERNAL +#include "lcn_index_writer.h" +#undef LCN_INTERNAL + using namespace org::apache::lucene::index; extern "C" { -struct lcn_index_writer_t { - IndexWriter *impl; -}; - struct index_writer_make_baton { lcn_index_writer_t **writer; const char *path; @@ -63,14 +66,9 @@ { index_writer_make_baton *iwcb = static_cast(b); - *iwcb->writer = static_cast - (apr_palloc (iwcb->pool, sizeof (lcn_index_writer_t))); - jstring path = JvNewStringUTF (iwcb->path); - (*iwcb->writer)->impl = new IndexWriter (path, - iwcb->analyzer->impl, - iwcb->create); + *iwcb->writer = new IndexWriter (path, iwcb->analyzer->impl, iwcb->create); apr_pool_cleanup_register (iwcb->pool, *iwcb->writer, run_close, NULL); } @@ -120,7 +118,7 @@ index_writer_add_document_baton *iwadb = static_cast(b); - iwadb->writer->impl->addDocument (iwadb->document->impl); + iwadb->writer->addDocument (iwadb->document->impl); } lcn_error_t * @@ -141,7 +139,7 @@ { lcn_index_writer_t *writer = static_cast(b); - writer->impl->optimize (); + writer->optimize (); } lcn_error_t * @@ -155,7 +153,7 @@ { lcn_index_writer_t *writer = static_cast(b); - writer->impl->close (); + writer->close (); } lcn_error_t *