00001 /* Copyright 2005 The Apache Software Foundation or its licensors, as 00002 * applicable. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 /** 00018 * @file lcn_document.h 00019 * @brief Routines for manipulating lucene documents 00020 */ 00021 00022 #ifndef _LCN_DOCUMENT_H 00023 #define _LCN_DOCUMENT_H 00024 00025 #include "lcn_types.h" 00026 #include "lcn_field.h" 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif /* __cplusplus */ 00031 00032 /** Opaque structure representing a document in the index. */ 00033 typedef struct lcn_document_t lcn_document_t; 00034 00035 /** Create an empty document, allocated from @a pool. */ 00036 lcn_document_t * 00037 lcn_document_create (apr_pool_t *pool); 00038 00039 /** Return the number of fields in document @a doc. */ 00040 apr_uint32_t lcn_document_numfields (lcn_document_t *doc); 00041 00042 /** Add @a field to @a doc. */ 00043 void lcn_document_add_field (lcn_document_t *doc, lcn_field_t *field); 00044 00045 /** Return field number @a num from @a doc, or @c NULL if it does not exist. */ 00046 const lcn_field_t * 00047 lcn_document_field_by_num (const lcn_document_t *doc, 00048 apr_uint32_t num); 00049 00050 /** Return field @a name from @a doc, or @c NULL if it does not exist. */ 00051 const lcn_field_t * 00052 lcn_document_field_by_name (const lcn_document_t *doc, 00053 const lcn_char_t *name); 00054 00055 #ifdef __cplusplus 00056 } 00057 #endif /* __cplusplus */ 00058 00059 #endif /* _LCN_DOCUMENT_H */