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_Compare_ 00008 #define _lucene_search_Compare_ 00009 00010 00011 //#include "FieldSortedHitQueue.h" 00012 #include "Sort.h" 00013 #include "FieldCache.h" 00014 00015 CL_NS_DEF(search) 00016 00017 00018 class CLUCENE_EXPORT ScoreDocComparators:LUCENE_BASE { 00019 protected: 00020 ScoreDocComparators(); 00021 public: 00022 ~ScoreDocComparators(); 00023 00024 class Relevance:public ScoreDocComparator { 00025 public: 00026 int32_t compare (struct ScoreDoc* i, struct ScoreDoc* j); 00027 CL_NS(util)::Comparable* sortValue (struct ScoreDoc* i); 00028 int32_t sortType(); 00029 }; 00030 00031 class IndexOrder:public ScoreDocComparator{ 00032 public: 00033 IndexOrder(); 00034 int32_t compare (struct ScoreDoc* i, struct ScoreDoc* j); 00035 CL_NS(util)::Comparable* sortValue (struct ScoreDoc* i); 00036 int32_t sortType(); 00037 }; 00038 00039 00040 class String: public ScoreDocComparator { 00041 FieldCache::StringIndex* index; 00042 int32_t length; 00043 public: 00044 String(FieldCache::StringIndex* index, int32_t len); 00045 int32_t compare (struct ScoreDoc* i, struct ScoreDoc* j); 00046 CL_NS(util)::Comparable* sortValue (struct ScoreDoc* i); 00047 00048 int32_t sortType(); 00049 }; 00050 00051 class Int32:public ScoreDocComparator{ 00052 int32_t* fieldOrder; 00053 int32_t length; 00054 public: 00055 Int32(int32_t* fieldOrder, int32_t len); 00056 int32_t compare (struct ScoreDoc* i, struct ScoreDoc* j); 00057 CL_NS(util)::Comparable* sortValue (struct ScoreDoc* i); 00058 int32_t sortType(); 00059 }; 00060 00061 class Float:public ScoreDocComparator { 00062 float_t* fieldOrder; 00063 int32_t length; 00064 public: 00065 Float(float_t* fieldOrder, int32_t len); 00066 int32_t compare (struct ScoreDoc* i, struct ScoreDoc* j); 00067 CL_NS(util)::Comparable* sortValue (struct ScoreDoc* i); 00068 int32_t sortType(); 00069 }; 00070 }; 00071 00072 00073 CL_NS_END 00074 #endif