Main Page | Data Structures | Directories | File List | Data Fields | Globals

lcn_segments.h

Go to the documentation of this file.
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_segments.h
00019  * @brief Routines for reading the segments contained within a lucen index
00020  */
00021 
00022 #ifndef _LCN_SEGMENTS_H
00023 #define _LCN_SEGMENTS_H
00024 
00025 #include "lcn_types.h"
00026 #include "lcn_directory.h"
00027 #include "lcn_term.h"
00028 #include "lcn_document.h"
00029 
00030 #include <apr_pools.h>
00031 #include <apr_tables.h>
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif /* __cplusplus */
00036 
00037 /** Opaque structure representing the segments within an index. */
00038 typedef struct lcn_segments_t lcn_segments_t;
00039 
00040 /** Read in the segments file contained in @a directory and return it in
00041  * @a segments, allocated within @a pool.
00042  */
00043 lcn_error_t *
00044 lcn_segments_read (lcn_segments_t **segments,
00045                    const lcn_directory_t *directory,
00046                    apr_pool_t *pool);
00047 
00048 /** Return the version of @a segments.
00049  *
00050  * This can be used to detect if the segment has been modified.
00051  */
00052 apr_uint64_t lcn_segments_version (const lcn_segments_t *segments);
00053 
00054 /** Return the number of segments within @a segments. */
00055 unsigned int lcn_segments_count (const lcn_segments_t *segments);
00056 
00057 /** Return the size (in documents) of segment @a name within @a segments. */
00058 apr_uint32_t lcn_segments_segsize (const lcn_segments_t *segments,
00059                                    const lcn_char_t *name);
00060 
00061 /** Return the names of the segments within @a segments, allocated in @a pool.
00062  *
00063  * The array holds @c lcn_char_t pointers.
00064  */
00065 apr_array_header_t *
00066 lcn_segments_names (const lcn_segments_t *segments, apr_pool_t *pool);
00067 
00068 /** Return the max docs contained within @a segments. */
00069 apr_uint32_t
00070 lcn_segments_max_docs (const lcn_segments_t *segments);
00071 
00072 /** Return the document freqency @a doc_freq, document numbers @a docs, and
00073  * frequencies @a freqs of the documents containing @a term in segment number
00074  * @a segnum within @a segments, using @a pool for allocation.
00075  */
00076 lcn_error_t *
00077 lcn_segments_term_docs (apr_uint32_t *doc_freq,
00078                         apr_uint32_t **docs,
00079                         apr_uint32_t **freqs,
00080                         lcn_segments_t *segments,
00081                         apr_uint32_t segnum,
00082                         const lcn_term_t *term,
00083                         apr_pool_t *pool);
00084 
00085 /** Return the document @a docnum from @a segs in @a doc, using @a pool for
00086  * allocation.
00087  */
00088 lcn_error_t *
00089 lcn_segments_get_document (lcn_document_t **doc,
00090                            lcn_segments_t *segs,
00091                            apr_uint32_t docnum,
00092                            apr_pool_t *pool);
00093 
00094 #ifdef __cplusplus
00095 }
00096 #endif /* __cplusplus */
00097 
00098 #endif

Generated on Sat Mar 26 08:12:11 2005 for Lucene4c by  doxygen 1.4.0