summaryrefslogtreecommitdiff
path: root/3rdparty/clucene/src/CLucene/search/PhraseQueue.h
blob: c0682fcaf1443b946982bcf0b9bc957c5f9a22c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*------------------------------------------------------------------------------
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
* 
* Distributable under the terms of either the Apache License (Version 2.0) or 
* the GNU Lesser General Public License, as specified in the COPYING file.
------------------------------------------------------------------------------*/
#ifndef _lucene_search_PriorityQueue_
#define _lucene_search_PriorityQueue_

#if defined(_LUCENE_PRAGMA_ONCE)
# pragma once
#endif

#include "CLucene/util/PriorityQueue.h"
#include "PhrasePositions.h"

CL_NS_DEF(search)
	class PhraseQueue: public CL_NS(util)::PriorityQueue<PhrasePositions*,
		CL_NS(util)::Deletor::Object<PhrasePositions> > {
	public:
		PhraseQueue(const int32_t size) {
			initialize(size,false);
		}
		~PhraseQueue(){
		}

	protected:
		bool lessThan(PhrasePositions* pp1, PhrasePositions* pp2) {
			if (pp1->doc == pp2->doc) 
				return pp1->position < pp2->position;
			else
				return pp1->doc < pp2->doc;
		}
	};
CL_NS_END
#endif