1 /*------------------------------------------------------------------------------
2 * Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
3 *
4 * Distributable under the terms of either the Apache License (Version 2.0) or
5 * the GNU Lesser General Public License, as specified in the COPYING file.
6 ------------------------------------------------------------------------------*/
7 #ifndef _lucene_search_TermQuery_
8 #define _lucene_search_TermQuery_
9 
CL_CLASS_DEF(index,Term)10 CL_CLASS_DEF(index,Term)
11 CL_CLASS_DEF(util,StringBuffer)
12 
13 #include "Query.h"
14 
15 CL_NS_DEF(search)
16     /** A Query that matches documents containing a term.
17 	This may be combined with other terms with a {@link BooleanQuery}.
18 	*/
19     class CLUCENE_EXPORT TermQuery: public Query {
20     private:
21 		CL_NS(index)::Term* term;
22     protected:
23         Weight* _createWeight(Searcher* searcher);
24         TermQuery(const TermQuery& clone);
25 	public:
26 		// Constructs a query for the term <code>t</code>.
27 		TermQuery(CL_NS(index)::Term* t);
28 		virtual ~TermQuery();
29 
30 		static const char* getClassName();
31 		const char* getObjectName() const;
32 
33 		/** Returns the term of this query. */
34 		CL_NS(index)::Term* getTerm(bool pointer=true) const;
35 
36 		/** Prints a user-readable version of this query. */
37 		TCHAR* toString(const TCHAR* field) const;
38 
39 		/** Returns true if <code>o</code> is equal to this. */
40 		bool equals(Query* other) const;
41 		Query* clone() const;
42 
43 		/** Returns a hash code value for this object.*/
44 		size_t hashCode() const;
45 
46         /** Expert: adds all terms occurring in this query to the termset set. */
47         void extractTerms( TermSet * termset ) const;
48 
49     };
50 CL_NS_END
51 #endif
52 
53