Fix build with xapian-core < 1.4.10
[xapian.git] / search-xapian / XS / Enquire.xs
blob708cd46bcd12cc167fa097c21398b045542c11f3
1 MODULE = Search::Xapian  PACKAGE = Search::Xapian::Enquire
3 PROTOTYPES: ENABLE
5 Enquire *
6 Enquire::new(databases)
7     Database *  databases
8     CODE:
9         try {
10             RETVAL = XAPIAN_PERL_NEW(Enquire, (*databases));
11         } catch (...) {
12             handle_exception();
13         }
14     OUTPUT:
15         RETVAL
17 void
18 Enquire::set_query1(query)
19     Query *     query
20     CODE:
21         try {
22             THIS->set_query(*query);
23         } catch (...) {
24             handle_exception();
25         }
27 void
28 Enquire::set_query2(query, len)
29     Query *     query
30     termcount   len
31     CODE:
32         try {
33             THIS->set_query(*query, len);
34         } catch (...) {
35             handle_exception();
36         }
38 Query *
39 Enquire::get_query()
40     CODE:
41         try {
42             RETVAL = new Query(THIS->get_query());
43         } catch (...) {
44             handle_exception();
45         }
46     OUTPUT:
47         RETVAL
49 void
50 Enquire::set_collapse_key(collapse_key, collapse_max = 1)
51     valueno     collapse_key
52     doccount    collapse_max
53     CODE:
54         try {
55             THIS->set_collapse_key(collapse_key, collapse_max);
56         } catch (...) {
57             handle_exception();
58         }
60 void
61 Enquire::set_docid_order(order)
62     int  order
63     CODE:
64         try {
65             THIS->set_docid_order(static_cast<Enquire::docid_order>(order));
66         } catch (...) {
67             handle_exception();
68         }
70 void
71 Enquire::set_cutoff(percent_cutoff, weight_cutoff = NO_INIT)
72     int         percent_cutoff
73     double      weight_cutoff
74     CODE:
75         try {
76             if (items == 3) { /* items includes the hidden this pointer */
77                 THIS->set_cutoff(percent_cutoff, weight_cutoff);
78             } else {
79                 THIS->set_cutoff(percent_cutoff);
80             }
81         } catch (...) {
82             handle_exception();
83         }
85 void
86 Enquire::set_sort_by_relevance()
87     CODE:
88         // Clear reference to any currently set sorter object.
89         XAPIAN_PERL_REF(Enquire, THIS, sorter, NULL);
90         THIS->set_sort_by_relevance();
92 void
93 Enquire::set_sort_by_value(sort_key, ascending = true)
94     valueno     sort_key
95     bool        ascending
96     CODE:
97         // Clear reference to any currently set sorter object.
98         XAPIAN_PERL_REF(Enquire, THIS, sorter, NULL);
99         try {
100             THIS->set_sort_by_value(sort_key, ascending);
101         } catch (...) {
102             handle_exception();
103         }
105 void
106 Enquire::set_sort_by_value_then_relevance(sort_key, ascending = true)
107     valueno     sort_key
108     bool        ascending
109     CODE:
110         // Clear reference to any currently set sorter object.
111         XAPIAN_PERL_REF(Enquire, THIS, sorter, NULL);
112         try {
113             THIS->set_sort_by_value_then_relevance(sort_key, ascending);
114         } catch (...) {
115             handle_exception();
116         }
118 void
119 Enquire::set_sort_by_relevance_then_value(sort_key, ascending = true)
120     valueno     sort_key
121     bool        ascending
122     CODE:
123         // Clear reference to any currently set sorter object.
124         XAPIAN_PERL_REF(Enquire, THIS, sorter, NULL);
125         try {
126             THIS->set_sort_by_relevance_then_value(sort_key, ascending);
127         } catch (...) {
128             handle_exception();
129         }
131 void
132 Enquire::set_sort_by_key(sorter, ascending = true)
133     MultiValueKeyMaker * sorter
134     bool        ascending
135     CODE:
136         // Keep a reference to the currently set object.
137         XAPIAN_PERL_REF(Enquire, THIS, sorter, ST(1));
138         try {
139             THIS->set_sort_by_key(sorter, ascending);
140         } catch (...) {
141             handle_exception();
142         }
144 void
145 Enquire::set_sort_by_key_then_relevance(sorter, ascending = true)
146     MultiValueKeyMaker * sorter
147     bool        ascending
148     CODE:
149         // Keep a reference to the currently set object.
150         XAPIAN_PERL_REF(Enquire, THIS, sorter, ST(1));
151         try {
152             THIS->set_sort_by_key_then_relevance(sorter, ascending);
153         } catch (...) {
154             handle_exception();
155         }
157 void
158 Enquire::set_sort_by_relevance_then_key(sorter, ascending = true)
159     MultiValueKeyMaker * sorter
160     bool        ascending
161     CODE:
162         // Keep a reference to the currently set object.
163         XAPIAN_PERL_REF(Enquire, THIS, sorter, ST(1));
164         try {
165             THIS->set_sort_by_relevance_then_key(sorter, ascending);
166         } catch (...) {
167             handle_exception();
168         }
170 MSet *
171 Enquire::get_mset1(first, maxitems, checkatleast = NO_INIT, rset = NO_INIT, func = NO_INIT)
172     doccount    first
173     doccount    maxitems
174     doccount    checkatleast
175     RSet *      rset
176     SV *        func
177     CODE:
178         try {
179             MSet mset;
180             switch (items) { /* items includes the hidden this pointer */
181                 case 3:
182                     mset = THIS->get_mset(first, maxitems);
183                     break;
184                 case 4:
185                     mset = THIS->get_mset(first, maxitems, checkatleast);
186                     break;
187                 case 5:
188                     mset = THIS->get_mset(first, maxitems, checkatleast, rset);
189                     break;
190                 case 6: {
191                     perlMatchDecider d(func);
192                     mset = THIS->get_mset(first, maxitems, checkatleast, rset, &d);
193                     break;
194                 }
195                 default:
196                     croak("Bad parameter count for get_mset1");
197             }
198             RETVAL = new MSet(mset);
199         } catch (...) {
200             handle_exception();
201         }
202     OUTPUT:
203         RETVAL
205 MSet *
206 Enquire::get_mset2(first, maxitems, func)
207     doccount    first
208     doccount    maxitems
209     SV *        func
210     CODE:
211         try {
212             perlMatchDecider d(func);
213             RETVAL = new MSet(THIS->get_mset(first, maxitems, 0, NULL, &d));
214         } catch (...) {
215             handle_exception();
216         }
217     OUTPUT:
218         RETVAL
220 ESet *
221 Enquire::get_eset(maxitems, rset, func = NO_INIT)
222     doccount    maxitems
223     RSet *      rset
224     SV *        func
225     CODE:
226         try {
227             ESet eset;
228             switch (items) { /* items includes the hidden this pointer */
229                 case 3:
230                     eset = THIS->get_eset(maxitems, *rset);
231                     break;
232                 case 4: {
233                     perlExpandDecider d(func);
234                     eset = THIS->get_eset(maxitems, *rset, &d);
235                     break;
236                 }
237                 default:
238                     croak("Bad parameter count for get_eset");
239             }
240             RETVAL = new ESet(eset);
241         } catch (...) {
242             handle_exception();
243         }
244     OUTPUT:
245         RETVAL
247 TermIterator *
248 Enquire::get_matching_terms_begin1(docid did)
249     CODE:
250         try {
251             RETVAL = new TermIterator(THIS->get_matching_terms_begin(did));
252         } catch (...) {
253             handle_exception();
254         }
255     OUTPUT:
256         RETVAL
258 TermIterator *
259 Enquire::get_matching_terms_begin2(it)
260     MSetIterator *      it
261     CODE:
262         try {
263             RETVAL = new TermIterator(THIS->get_matching_terms_begin(* it));
264         } catch (...) {
265             handle_exception();
266         }
267     OUTPUT:
268         RETVAL
270 TermIterator *
271 Enquire::get_matching_terms_end1(docid did)
272     CODE:
273         try {
274             RETVAL = new TermIterator(THIS->get_matching_terms_end(did));
275         } catch (...) {
276             handle_exception();
277         }
278     OUTPUT:
279         RETVAL
281 TermIterator *
282 Enquire::get_matching_terms_end2(it)
283     MSetIterator *  it
284     CODE:
285         try {
286             RETVAL = new TermIterator(THIS->get_matching_terms_end(* it));
287         } catch (...) {
288             handle_exception();
289         }
290     OUTPUT:
291         RETVAL
293 void
294 Enquire::set_weighting_scheme(weight_)
295         Weight *  weight_
296     CODE:
297         try {
298             THIS->set_weighting_scheme(*weight_);
299         } catch (...) {
300             handle_exception();
301         }
303 string
304 Enquire::get_description()
306 void
307 Enquire::add_matchspy(MatchSpy * spy)
308     CODE:
309         try {
310             XAPIAN_PERL_REF(Enquire, THIS, matchspy, ST(1));
311             THIS->add_matchspy(spy);
312         } catch (...) {
313             handle_exception();
314         }
316 void
317 Enquire::clear_matchspies()
318     CODE:
319         try {
320             XAPIAN_PERL_REF(Enquire, THIS, clear_matchspies, NULL);
321             THIS->clear_matchspies();
322         } catch (...) {
323             handle_exception();
324         }
326 void
327 Enquire::DESTROY()
328     CODE:
329         XAPIAN_PERL_DESTROY(Enquire, THIS);