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_index_termvector_h 00008 #define _lucene_index_termvector_h 00009 00010 00011 //#include "FieldInfos.h" 00012 #include "CLucene/util/Array.h" 00013 00014 CL_NS_DEF(index) 00015 00016 //predefine classes 00017 struct TermVectorOffsetInfo; 00018 class TermPositionVector; 00019 00025 class TermFreqVector:LUCENE_BASE { 00026 public: 00027 virtual ~TermFreqVector(){ 00028 } 00029 00035 virtual const TCHAR* getField() = 0; 00036 00040 virtual int32_t size() = 0; 00041 00045 virtual const TCHAR** getTerms() = 0; 00046 00047 00056 virtual const CL_NS(util)::Array<int32_t>* getTermFrequencies() = 0; 00057 00058 00064 virtual int32_t indexOf(const TCHAR* term) = 0; 00065 00066 00076 virtual void indexesOf(const TCHAR** terms, const int32_t start, const int32_t len, CL_NS(util)::Array<int32_t>& ret) = 0; 00077 00081 virtual TermPositionVector* __asTermPositionVector()=0; 00082 }; 00083 00084 00085 00086 struct TermVectorOffsetInfo { 00087 int startOffset; 00088 int endOffset; 00089 public: 00090 static CL_NS(util)::Array<TermVectorOffsetInfo> EMPTY_OFFSET_INFO; 00091 TermVectorOffsetInfo(); 00092 ~TermVectorOffsetInfo(); 00093 TermVectorOffsetInfo(int32_t startOffset, int32_t endOffset); 00094 int32_t getEndOffset() const; 00095 void setEndOffset(int32_t endOffset); 00096 int32_t getStartOffset() const; 00097 void setStartOffset(int32_t startOffset); 00098 bool equals(TermVectorOffsetInfo* o); 00099 size_t hashCode() const; 00100 }; 00101 00102 00107 class TermPositionVector: public virtual TermFreqVector { 00108 public: 00109 00115 virtual CL_NS(util)::Array<int32_t>* getTermPositions(int32_t index) = 0; 00116 00126 virtual CL_NS(util)::Array<TermVectorOffsetInfo>* getOffsets(int32_t index) = 0; 00127 00128 virtual ~TermPositionVector(){ 00129 } 00130 }; 00131 00132 CL_NS_END 00133 #endif