Fix build with xapian-core < 1.4.10
[xapian.git] / search-xapian / XS / QueryParser.xs
blob047afa5ce8650c8cd352a31a69f39705437e0769
1 MODULE = Search::Xapian                 PACKAGE = Search::Xapian::QueryParser
3 PROTOTYPES: ENABLE
5 QueryParser *
6 new0()
7     CODE:
8         RETVAL = XAPIAN_PERL_NEW(QueryParser, ());
9     OUTPUT:
10         RETVAL
12 void
13 QueryParser::set_stemmer(stemmer)
14     Stem * stemmer
15     CODE:
16         THIS->set_stemmer(*stemmer);
18 void
19 QueryParser::set_stemming_strategy(strategy)
20     int strategy
21     CODE:
22         THIS->set_stemming_strategy(static_cast<QueryParser::stem_strategy>(strategy));
24 void
25 QueryParser::set_stopper(stopper)
26     Stopper * stopper
27     CODE:
28         // Keep a reference to the currently set object.
29         XAPIAN_PERL_REF(QueryParser, THIS, stopper, ST(1));
30         THIS->set_stopper(stopper);
32 void
33 QueryParser::set_default_op(op)
34     int op
35     CODE:
36         THIS->set_default_op(static_cast<Query::op>(op));
38 int
39 QueryParser::get_default_op()
40     CODE:
41         RETVAL = static_cast<int>(THIS->get_default_op());
42     OUTPUT:
43         RETVAL
45 void
46 QueryParser::set_database(database)
47     Database * database
48     CODE:
49         THIS->set_database(*database);
51 void
52 QueryParser::set_max_wildcard_expansion(termcount limit)
53     CODE:
54 #if XAPIAN_AT_LEAST(1,5,0)
55         THIS->set_max_expansion(limit,
56                                 Xapian::Query::WILDCARD_LIMIT_ERROR,
57                                 Xapian::QueryParser::FLAG_WILDCARD);
58 #else
59         THIS->set_max_wildcard_expansion(limit);
60 #endif
62 Query *
63 QueryParser::parse_query(q, flags = QueryParser::FLAG_DEFAULT)
64     string q
65     int flags
66     CODE:
67         try {
68             RETVAL = new Query(THIS->parse_query(q,flags));
69         } catch (...) {
70             handle_exception();
71         }
72     OUTPUT:
73         RETVAL
75 void
76 QueryParser::add_prefix(string field, string prefix)
78 void
79 QueryParser::add_boolean_prefix(string field, string prefix)
81 TermIterator *
82 QueryParser::stoplist_begin()
83     CODE:
84         RETVAL = new TermIterator(THIS->stoplist_begin());
85     OUTPUT:
86         RETVAL
88 TermIterator *
89 QueryParser::stoplist_end()
90     CODE:
91         RETVAL = new TermIterator(THIS->stoplist_end());
92     OUTPUT:
93         RETVAL
95 TermIterator *
96 QueryParser::unstem_begin(term)
97     string term
98     CODE:
99         RETVAL = new TermIterator(THIS->unstem_begin(term));
100     OUTPUT:
101         RETVAL
103 TermIterator *
104 QueryParser::unstem_end(term)
105     string term
106     CODE:
107         RETVAL = new TermIterator(THIS->unstem_end(term));
108     OUTPUT:
109         RETVAL
111 string
112 QueryParser::get_corrected_query_string()
113     CODE:
114     try {
115         RETVAL = THIS->get_corrected_query_string();
116     } catch (...) {
117         handle_exception();
118     }
119     OUTPUT:
120         RETVAL
122 string
123 QueryParser::get_description()
125 void
126 QueryParser::add_valuerangeprocessor(ValueRangeProcessor * vrproc)
127     CODE:
128         // Keep a reference to the currently set object.
129         XAPIAN_PERL_REF(QueryParser, THIS, vrp, ST(1));
130         THIS->add_valuerangeprocessor(vrproc);
132 void
133 QueryParser::DESTROY()
134     CODE:
135         XAPIAN_PERL_DESTROY(QueryParser, THIS);