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_field.h 00019 * @brief Routines for manipulating lucene fields 00020 */ 00021 00022 #ifndef _LCN_FIELD_H 00023 #define _LCN_FIELD_H 00024 00025 #include "lcn_types.h" 00026 00027 #ifdef __cplusplus 00028 extern "C" { 00029 #endif /* __cplusplus */ 00030 00031 /** Opaque structure representing a field in a document. */ 00032 typedef struct lcn_field_t lcn_field_t; 00033 00034 /** Indicates if a field is stored in the index or not. */ 00035 typedef enum { 00036 LCN_STORED_NO, /**< Field is not stored */ 00037 LCN_STORED_YES, /**< Field is stored */ 00038 LCN_STORED_COMPRESS /**< Field is stored in compressed form */ 00039 } lcn_field_stored_t; 00040 00041 /** Indicates if a field is indexed or not. */ 00042 typedef enum { 00043 LCN_INDEXED_NO, /**< Field is not indexed */ 00044 LCN_INDEXED_TOKENIZED, /**< Field is indexed in tokenized form */ 00045 LCN_INDEXED_UNTOKENIZED /**< Field is indexed without being tokenized */ 00046 } lcn_field_indexed_t; 00047 00048 /** Indicates if a field is stored in the index's termvector. */ 00049 typedef enum { 00050 /** Field is not stored in the termvector */ 00051 LCN_TERMVECTOR_NO, 00052 00053 /** Field is stored in the termvector */ 00054 LCN_TERMVECTOR_YES, 00055 00056 /** Field is stored in the termvector along with its positions */ 00057 LCN_TERMVECTOR_WITH_POSITIONS, 00058 00059 /** Field is stored in the termvector along with its offsets */ 00060 LCN_TERMVECTOR_WITH_OFFSETS, 00061 00062 /** Field is stored in the termvector along with its positions and offsets */ 00063 LCN_TERMVECTOR_WITH_POSITIONS_OFFSETS 00064 } lcn_field_termvector_t; 00065 00066 /** Create new field. 00067 * 00068 * The field will have the name @a name, the value @a value, and its status 00069 * with regard to storage, indexing, and termvector are determined by the 00070 * @a stored, @a indexed, and @a termvector arguments. 00071 * 00072 * All allocation is done with @a pool. 00073 */ 00074 lcn_field_t * 00075 lcn_field_create (const lcn_char_t *name, 00076 const lcn_char_t *value, 00077 lcn_field_stored_t stored, 00078 lcn_field_indexed_t indexed, 00079 lcn_field_termvector_t termvector, 00080 apr_pool_t *pool); 00081 00082 /** Return the name of field @a f. */ 00083 const lcn_char_t * 00084 lcn_field_name (const lcn_field_t *f); 00085 00086 /** Return the content of field @a f. */ 00087 const lcn_char_t * 00088 lcn_field_content (const lcn_field_t *f); 00089 00090 #ifdef __cplusplus 00091 } 00092 #endif /* __cplusplus */ 00093 00094 #endif /* _LCN_FIELD_H */