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_FieldCache_ 00008 #define _lucene_search_FieldCache_ 00009 00010 //#include "Sort.h" 00011 00012 CL_CLASS_DEF(index,IndexReader) 00013 CL_CLASS_DEF(search,SortComparator) 00014 CL_CLASS_DEF(search,ScoreDocComparator) 00015 CL_CLASS_DEF(util,Comparable) 00016 00017 CL_NS_DEF(search) 00018 00019 class FieldCacheAuto; //predefine 00020 00025 class CLUCENE_EXPORT FieldCache :LUCENE_BASE { 00026 public: 00027 virtual ~FieldCache(){ 00028 } 00029 00031 class StringIndex:LUCENE_BASE { 00032 public: 00034 TCHAR** lookup; 00035 00037 int32_t* order; 00038 00039 int count; 00040 00044 StringIndex (int32_t* values, TCHAR** lookup, int count) { 00045 this->count = count; 00046 this->order = values; 00047 this->lookup = lookup; 00048 } 00049 00050 ~StringIndex(){ 00051 _CLDELETE_ARRAY(order); 00052 00053 for ( int i=0;i<count;i++ ) 00054 _CLDELETE_CARRAY(lookup[i]); 00055 _CLDELETE_ARRAY(lookup); 00056 } 00057 }; 00058 00059 00064 static int32_t STRING_INDEX; 00065 00067 static FieldCache* DEFAULT; 00068 00078 virtual FieldCacheAuto* getInts (CL_NS(index)::IndexReader* reader, const TCHAR* field) = 0; 00079 00089 virtual FieldCacheAuto* getFloats (CL_NS(index)::IndexReader* reader, const TCHAR* field) = 0; 00090 00100 virtual FieldCacheAuto* getStrings (CL_NS(index)::IndexReader* reader, const TCHAR* field) = 0; 00101 00111 virtual FieldCacheAuto* getStringIndex (CL_NS(index)::IndexReader* reader, const TCHAR* field) = 0; 00112 00124 virtual FieldCacheAuto* getAuto (CL_NS(index)::IndexReader* reader, const TCHAR* field) = 0; 00125 00137 virtual FieldCacheAuto* getCustom (CL_NS(index)::IndexReader* reader, const TCHAR* field, SortComparator* comparator) = 0; 00138 }; 00139 00150 class FieldCacheAuto:LUCENE_BASE{ 00151 public: 00152 enum{ 00153 INT_ARRAY=1, 00154 FLOAT_ARRAY=2, 00155 STRING_INDEX=3, 00156 STRING_ARRAY=4, 00157 COMPARABLE_ARRAY=5, 00158 SORT_COMPARATOR=6, 00159 SCOREDOC_COMPARATOR=7 00160 }; 00161 00162 FieldCacheAuto(int32_t len, int32_t type); 00163 ~FieldCacheAuto(); 00165 bool ownContents; 00166 int32_t contentLen; //number of items in the list 00167 uint8_t contentType; 00168 int32_t* intArray; //item 1 00169 float_t* floatArray; //item 2 00170 FieldCache::StringIndex* stringIndex; //item 3 00171 TCHAR** stringArray; //item 4 00172 CL_NS(util)::Comparable** comparableArray; //item 5 00173 SortComparator* sortComparator; //item 6 00174 ScoreDocComparator* scoreDocComparator; //item 7 00175 00176 }; 00177 00178 00179 CL_NS_END 00180 00181 #endif