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

lcn_index.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_index.h
00019  * @brief Routines for manipulating a lucene index
00020  */
00021 
00022 #ifndef _LCN_INDEX_H
00023 #define _LCN_INDEX_H
00024 
00025 #include "lcn_types.h"
00026 #include "lcn_term.h"
00027 #include "lcn_document.h"
00028 
00029 #include <apr_file_io.h>
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif /* __cplusplus */
00034 
00035 /** Opaque structure representing a lucene index. */
00036 typedef struct lcn_index_t lcn_index_t;
00037 
00038 /** Return the index contained in directory @a d in @a idx, allocated in
00039  * @a pool.
00040  */
00041 lcn_error_t *
00042 lcn_index_open (lcn_index_t **idx,
00043                 const char *d,
00044                 apr_pool_t *pool);
00045 
00046 /** Return the maximum document number contained in index @a idx. */
00047 apr_uint32_t
00048 lcn_index_max_docs (lcn_index_t *idx);
00049 
00050 /** Opaque iterator for iterating over a list of documents. */
00051 typedef struct lcn_doc_iter_t lcn_doc_iter_t;
00052 
00053 /** Return the current document number from @a itr. */
00054 apr_uint32_t lcn_doc_iter_doc (lcn_doc_iter_t *itr);
00055 
00056 /** Return the maximum document number that can be returned from @a itr. */
00057 apr_uint32_t lcn_doc_iter_max_docs (lcn_doc_iter_t *itr);
00058 
00059 /** Return the current document's frequency from @a itr. */
00060 apr_uint32_t lcn_doc_iter_freq (lcn_doc_iter_t *itr);
00061 
00062 /** Return the total number of hits for the term in the current segment. */
00063 apr_uint32_t lcn_doc_iter_term_freq (lcn_doc_iter_t *itr);
00064 
00065 /** Move @a itr to the next document.
00066  *
00067  * If the increment was successful, @a next is TRUE, if it moved us past
00068  * the end of the sequence @a next is FALSE.
00069  */
00070 lcn_error_t * lcn_doc_iter_next (lcn_boolean_t *next, lcn_doc_iter_t *itr);
00071 
00072 /* XXX need an interface to read multiple doc/freq pairs at once. */
00073 
00074 /* XXX need an interface to skip to a certain document. */
00075 
00076 /** Close @a itr. */
00077 lcn_error_t * lcn_doc_iter_close (lcn_doc_iter_t *itr);
00078 
00079 /** Return an iterator @a itr for iterating over all documents that contain
00080  * @a term within @a idx, allocated from within @a pool.
00081  */
00082 lcn_error_t *
00083 lcn_index_term_docs (lcn_doc_iter_t **itr,
00084                      lcn_index_t *idx,
00085                      lcn_term_t *term,
00086                      apr_pool_t *pool);
00087 
00088 /** Return the document @a doc from @a idx that has the number @a docnum,
00089  * allocated from @a pool.
00090  */
00091 lcn_error_t *
00092 lcn_index_get_document (lcn_document_t **doc,
00093                         lcn_index_t *idx,
00094                         apr_uint32_t docnum,
00095                         apr_pool_t *pool);
00096 
00097 #ifdef __cplusplus
00098 }
00099 #endif /* __cplusplus */
00100 
00101 #endif

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