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_fieldinfos.h 00019 * @brief Routines for reading information about a segment's fields 00020 */ 00021 00022 #ifndef _LCN_FIELDINFOS_H 00023 #define _LCN_FIELDINFOS_H 00024 00025 #include "lcn_types.h" 00026 #include "lcn_directory.h" 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif /* __cplusplus */ 00031 00032 /** Information about a particular field in a segment. */ 00033 typedef struct { 00034 /** The name of the field */ 00035 const lcn_char_t *name; 00036 00037 /** Is the field indexed? */ 00038 lcn_boolean_t is_indexed; 00039 00040 /** The field's number */ 00041 apr_int32_t number; 00042 00043 /** Is the field stored in the term vector? */ 00044 lcn_boolean_t store_term_vector; 00045 } lcn_fieldinfo_t; 00046 00047 /** Opaque structure representing a segment's fieldinfos file. */ 00048 typedef struct lcn_fieldinfos_t lcn_fieldinfos_t; 00049 00050 /** Return in @a fis an @c lcn_fieldinfos_t corresponding to segment @a s in 00051 * directory @a d, allocated in @a pool. 00052 */ 00053 lcn_error_t * 00054 lcn_fieldinfos_read (lcn_fieldinfos_t **fis, 00055 const lcn_directory_t *d, 00056 const lcn_char_t *s, 00057 apr_pool_t *pool); 00058 00059 /** Return a pointer to the @c lcn_fieldinfo_t that corresponds to number 00060 * @a i, or @c NULL if none exists. 00061 */ 00062 lcn_fieldinfo_t * 00063 lcn_fieldinfos_get_by_number (const lcn_fieldinfos_t *fis, 00064 int i); 00065 00066 /** Return a pointer to the @c lcn_fieldinfo_t that corresponds to @a name, 00067 * or @c NULL if none exists. 00068 */ 00069 lcn_fieldinfo_t * 00070 lcn_fieldinfos_get_by_name (const lcn_fieldinfos_t *fis, 00071 const lcn_char_t *name); 00072 00073 /** Return the number of fieldinfos within @a fis */ 00074 int lcn_fieldinfos_get_count (const lcn_fieldinfos_t *fis); 00075 00076 #ifdef __cplusplus 00077 } 00078 #endif /* __cplusplus */ 00079 00080 #endif