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

lcn_scorer.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_scorer.h
00019  * @brief Routines for working with scorers
00020  */
00021 
00022 #ifndef _LCN_SCORER_H
00023 #define _LCN_SCORER_H
00024 
00025 #include "lcn_types.h"
00026 #include "lcn_index.h"
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif /* __cplusplus */
00031 
00032 /** The structure that stores data about a query that must be modified
00033  * during a search. This allows a given query to be reused for more than
00034  * one search.
00035  *
00036  * This is declared here rather than in lcn_query.h to avoid circular
00037  * dependencies.
00038  */
00039 typedef struct lcn_weight_t lcn_weight_t;
00040 
00041 /** Abstract scorer object. */
00042 typedef struct lcn_scorer_t lcn_scorer_t;
00043 
00044 /** Create a @a scorer that returns scores for each document matched
00045  * by @a weight in @a iter, allocated in @a pool.
00046  */
00047 lcn_error_t *
00048 lcn_term_scorer_create (lcn_scorer_t **scorer,
00049                         lcn_weight_t *weight,
00050                         lcn_doc_iter_t *iter,
00051                         apr_pool_t *pool);
00052 
00053 /** Create a @a scorer that returns scores for documents matched by the
00054  * arrays of queries @a must, @a should, and @a must_not, searching in
00055  * @a index, allocated in @a pool.
00056  */
00057 lcn_error_t *
00058 lcn_boolean_scorer_create (lcn_scorer_t **scorer,
00059                            apr_array_header_t *must,
00060                            apr_array_header_t *should,
00061                            apr_array_header_t *must_not,
00062                            lcn_index_t *index,
00063                            apr_pool_t *pool);
00064 
00065 /** Advance @a scorer to the next document.
00066  *
00067  * If there is another document in the sequence @a next is set to TRUE,
00068  * otherwise @a next is set to FALSE.
00069  */
00070 lcn_error_t * lcn_scorer_next (lcn_boolean_t *next, lcn_scorer_t *scorer);
00071 
00072 /** Return the current document for @a scorer. */
00073 apr_uint32_t lcn_scorer_doc (lcn_scorer_t *scorer);
00074 
00075 /** Return the score for the current document for @a scorer. */
00076 float lcn_scorer_score (lcn_scorer_t *scorer);
00077 
00078 #ifdef __cplusplus
00079 }
00080 #endif /* __cplusplus */
00081 
00082 #endif /* _LCN_SCORER_H */

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