CLucene - a full-featured, c++ search engine
API Documentation
00001 /*------------------------------------------------------------------------------ 00002 * Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team 00003 * 00004 * Distributable under the terms of either the Apache License (Version 2.0) or 00005 * the GNU Lesser General Public License, as specified in the COPYING file. 00006 ------------------------------------------------------------------------------*/ 00007 #ifndef _lucene_search_FilteredTermEnum_ 00008 #define _lucene_search_FilteredTermEnum_ 00009 00010 #if defined(_LUCENE_PRAGMA_ONCE) 00011 # pragma once 00012 #endif 00013 00014 #include "CLucene/index/Term.h" 00015 #include "CLucene/index/Terms.h" 00016 00017 CL_NS_DEF(search) 00018 //FilteredTermEnum is an abstract class for enumerating a subset of all terms. 00019 // 00020 //Term enumerations are always ordered by term->compareTo(). Each term in 00021 //the enumeration is greater than all that precede it. 00022 00023 class FilteredTermEnum: public CL_NS(index)::TermEnum { 00024 public: 00025 //Constructor 00026 FilteredTermEnum(); 00027 //Destructor 00028 virtual ~FilteredTermEnum(); 00029 00030 //Equality measure on the term 00031 virtual float_t difference() = 0; 00032 00033 //Returns the docFreq of the current Term in the enumeration. 00034 int32_t docFreq() const ; 00035 00036 //Increments the enumeration to the next element 00037 bool next() ; 00038 00039 //Returns a pointer to the current Term in the enumeration. 00040 CL_NS(index)::Term* term(); 00041 CL_NS(index)::Term* term(bool pointer); 00042 00043 //Closes the enumeration to further activity, freeing resources. 00044 void close(); 00045 00046 protected: 00047 //Equality compare on the term */ 00048 virtual bool termCompare(CL_NS(index)::Term* term) = 0; 00049 00050 //Indiciates the end of the enumeration has been reached 00051 virtual bool endEnum() = 0; 00052 00053 void setEnum(CL_NS(index)::TermEnum* actualEnum) ; 00054 00055 private: 00056 CL_NS(index)::Term* currentTerm; 00057 CL_NS(index)::TermEnum* actualEnum; 00058 00059 }; 00060 CL_NS_END 00061 #endif