summaryrefslogtreecommitdiff
path: root/3rdparty/clucene/src/CLucene/search/WildcardQuery.h
blob: cfc38f648faf382841e86b7cbaa63d5353b07113 (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
/*------------------------------------------------------------------------------
* 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_WildcardQuery_
#define _lucene_search_WildcardQuery_
#if defined(_LUCENE_PRAGMA_ONCE)
# pragma once
#endif

#include "CLucene/index/IndexReader.h"
#include "CLucene/index/Term.h"
#include "MultiTermQuery.h"
#include "WildcardTermEnum.h"

CL_NS_DEF(search)

    /** Implements the wildcard search query. Supported wildcards are <code>*</code>, which
		 * matches any character sequence (including the empty one), and <code>?</code>,
		 * which matches any single character. Note this query can be slow, as it
		 * needs to iterate over all terms. In order to prevent extremely slow WildcardQueries,
		 * a Wildcard term must not start with one of the wildcards <code>*</code> or
		 * <code>?</code>.
		 * 
		 * @see WildcardTermEnum
		 */
    class WildcardQuery: public MultiTermQuery {
    protected:
    	FilteredTermEnum* getEnum(CL_NS(index)::IndexReader* reader);
		WildcardQuery(const WildcardQuery& clone);
    public:
		WildcardQuery(CL_NS(index)::Term* term);
		~WildcardQuery();
    
	    //Returns the string "WildcardQuery"
    	const TCHAR* getQueryName() const;
		static const TCHAR* getClassName();
		
		size_t hashCode() const;
		bool equals(Query* other) const;
		Query* clone() const;
    };
    
    
    
class WildcardFilter: public Filter 
{
private:
	CL_NS(index)::Term* term;
protected:
	WildcardFilter( const WildcardFilter& copy );
	
public:
	WildcardFilter(CL_NS(index)::Term* term);
	~WildcardFilter();

	/** Returns a BitSet with true for documents which should be permitted in
	search results, and false for those that should not. */
	CL_NS(util)::BitSet* bits( CL_NS(index)::IndexReader* reader );
	
	Filter* clone() const;
	TCHAR* toString();
};


CL_NS_END
#endif