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_RangeQuery_ 00008 #define _lucene_search_RangeQuery_ 00009 #if defined(_LUCENE_PRAGMA_ONCE) 00010 # pragma once 00011 #endif 00012 00013 #include "SearchHeader.h" 00014 #include "Scorer.h" 00015 #include "TermQuery.h" 00016 00017 #include "CLucene/index/Term.h" 00018 #include "CLucene/index/Terms.h" 00019 00020 #include "CLucene/util/StringBuffer.h" 00021 00022 00023 CL_NS_DEF(search) 00030 class RangeQuery: public Query 00031 { 00032 private: 00033 CL_NS(index)::Term* lowerTerm; 00034 CL_NS(index)::Term* upperTerm; 00035 bool inclusive; 00036 protected: 00037 RangeQuery(const RangeQuery& clone); 00038 00039 public: 00040 // Constructs a query selecting all terms greater than 00041 // <code>lowerTerm</code> but less than <code>upperTerm</code>. 00042 // There must be at least one term and either term may be NULL-- 00043 // in which case there is no bound on that side, but if there are 00044 // two term, both terms <b>must</b> be for the same field. 00045 RangeQuery(CL_NS(index)::Term* LowerTerm, CL_NS(index)::Term* UpperTerm, const bool Inclusive); 00046 ~RangeQuery(); 00047 00048 const TCHAR* getQueryName() const; 00049 static const TCHAR* getClassName(); 00050 00051 Query* rewrite(CL_NS(index)::IndexReader* reader); 00052 00053 Query* combine(Query** queries); 00054 00055 // Prints a user-readable version of this query. 00056 TCHAR* toString(const TCHAR* field) const; 00057 00058 Query* clone() const; 00059 00060 bool equals(Query * other) const; 00061 00062 CL_NS(index)::Term* getLowerTerm(bool pointer=true) const; 00063 CL_NS(index)::Term* getUpperTerm(bool pointer=true) const; 00064 bool isInclusive() const; 00065 const TCHAR* getField() const; 00066 00067 size_t hashCode() const; 00068 }; 00069 00070 CL_NS_END 00071 #endif