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_PriorityQueue_ 00008 #define _lucene_search_PriorityQueue_ 00009 00010 #if defined(_LUCENE_PRAGMA_ONCE) 00011 # pragma once 00012 #endif 00013 00014 #include "CLucene/util/PriorityQueue.h" 00015 #include "PhrasePositions.h" 00016 00017 CL_NS_DEF(search) 00018 class PhraseQueue: public CL_NS(util)::PriorityQueue<PhrasePositions*, 00019 CL_NS(util)::Deletor::Object<PhrasePositions> > { 00020 public: 00021 PhraseQueue(const int32_t size) { 00022 initialize(size,false); 00023 } 00024 ~PhraseQueue(){ 00025 } 00026 00027 protected: 00028 bool lessThan(PhrasePositions* pp1, PhrasePositions* pp2) { 00029 if (pp1->doc == pp2->doc) 00030 return pp1->position < pp2->position; 00031 else 00032 return pp1->doc < pp2->doc; 00033 } 00034 }; 00035 CL_NS_END 00036 #endif