summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/clucene/src/CLucene/search/RangeQuery.h
blob: 9a7733c33b1d8541641f25acdb2308d0579f7636 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*------------------------------------------------------------------------------
* 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_RangeQuery_
#define _lucene_search_RangeQuery_
#if defined(_LUCENE_PRAGMA_ONCE)
# pragma once
#endif

#include "SearchHeader.h"
#include "Scorer.h"
#include "TermQuery.h"

#include "CLucene/index/Term.h"
#include "CLucene/index/Terms.h"

#include "CLucene/util/StringBuffer.h"


CL_NS_DEF(search)
    /** Constructs a query selecting all terms greater than
     * <code>lowerTerm</code> but less than <code>upperTerm</code>.
     * There must be at least one term and either term may be null,
     * in which case there is no bound on that side, but if there are
     * two terms, both terms <b>must</b> be for the same field.
     */
	class RangeQuery: public Query
    {
    private: 
        CL_NS(index)::Term* lowerTerm;
        CL_NS(index)::Term* upperTerm;
        bool inclusive;
	protected:
		RangeQuery(const RangeQuery& clone);
		
	public:
        // Constructs a query selecting all terms greater than 
        // <code>lowerTerm</code> but less than <code>upperTerm</code>.
        // There must be at least one term and either term may be NULL--
        // in which case there is no bound on that side, but if there are 
        // two term, both terms <b>must</b> be for the same field.
		RangeQuery(CL_NS(index)::Term* LowerTerm, CL_NS(index)::Term* UpperTerm, const bool Inclusive);
		~RangeQuery();

		const TCHAR* getQueryName() const;
		static const TCHAR* getClassName();

		Query* rewrite(CL_NS(index)::IndexReader* reader);

		Query* combine(Query** queries);
        
        // Prints a user-readable version of this query. 
        TCHAR* toString(const TCHAR* field) const;
        
		Query* clone() const;

		bool equals(Query * other) const;

		CL_NS(index)::Term* getLowerTerm(bool pointer=true) const;
		CL_NS(index)::Term* getUpperTerm(bool pointer=true) const;
		bool isInclusive() const;
        const TCHAR* getField() const;

		size_t hashCode() const;
    };

CL_NS_END
#endif