FirteX-高性能全文索引和检索平台API Documentation |
00001 // 00002 // Copyright(C) 2005--2006 Institute of Computing Tech, Chinese Academy of Sciences. 00003 // All rights reserved. 00004 // This file is part of FirteX (www.firtex.org) 00005 // 00006 // Use of the FirteX is subject to the terms of the software license set forth in 00007 // the LICENSE file included with this software, and also available at 00008 // http://www.firtex.org/license.html 00009 // 00010 // Author : 郭瑞杰(GuoRuijie) 00011 // Email : ruijieguo@software.ict.ac.cn,ruijieguo@gmail.com 00012 // Created : 2006/7/15 00013 // 00014 #ifndef _HITQUEUE_H 00015 #define _HITQUEUE_H 00016 00017 #if _MSC_VER > 1000 00018 #pragma once 00019 #endif // _MSC_VER > 1000 00020 #pragma once 00021 00022 #include "../utility/PriorityQueue.h" 00023 #include "../index/IndexReader.h" 00024 #include "Sort.h" 00025 #include "ScoreDoc.h" 00026 00027 using namespace firtex::utility; 00028 using namespace firtex::index; 00029 00030 00031 namespace firtex 00032 { 00033 namespace search 00034 { 00035 class CHitQueue : public CPriorityQueue<CScoreDoc*> 00036 { 00037 public: 00038 CHitQueue(size_t maxSize); 00039 virtual~CHitQueue(); 00040 protected: 00041 bool lessThan(CScoreDoc* pDoc1,CScoreDoc* pDoc2) 00042 { 00043 if (pDoc1->m_fScore == pDoc2->m_fScore) 00044 return pDoc1->m_docID > pDoc2->m_docID; 00045 else 00046 return pDoc1->m_fScore > pDoc2->m_fScore; 00047 } 00048 }; 00049 00050 class CFieldDocSortedHitQueue : public CHitQueue 00051 { 00052 public: 00053 CFieldDocSortedHitQueue(CIndexReader* pReader,CSort* pSort,int32_t size); 00054 ~CFieldDocSortedHitQueue(void); 00055 public: 00056 bool lessThan(CScoreDoc* pDoc1,CScoreDoc* pDoc2) 00057 { 00058 return !m_pSort->lessThan(pDoc1,pDoc2); 00059 } 00060 private: 00061 CSort* m_pSort; 00062 }; 00063 } 00064 } 00065 00066 00067 #endif
http://www.firtex.org http://www.sourceforge.net/projects/firtex