Fix build with xapian-core < 1.4.10
[xapian.git] / search-xapian / XS / Query.xs
blob8ec3d7964b60ee55bc089606e7b9d3a81d17bc97
1 MODULE = Search::Xapian                 PACKAGE = Search::Xapian::Query
3 PROTOTYPES: ENABLE
5 Query *
6 new0()
7     CODE:
8         RETVAL = new Query();
9     OUTPUT:
10         RETVAL
12 Query *
13 new1(term)
14     string      term
15     CODE:
16         RETVAL = new Query(term);
17     OUTPUT:
18         RETVAL
20 Query *
21 new1weight(term, wqf, pos)
22     string      term
23     termcount   wqf
24     termpos     pos
25     CODE:
26         RETVAL = new Query(term, wqf, pos);
27     OUTPUT:
28         RETVAL
30 Query *
31 new3scale(int op, Query * query, double factor)
32     CODE:
33         RETVAL = new Query( (Query::op) op, *query, factor );
34     OUTPUT:
35         RETVAL
37 Query *
38 new3range(op, valno, limit)
39     int         op
40     valueno     valno
41     string      limit
42     CODE:
43         RETVAL = new Query( (Query::op) op, valno, limit );
44     OUTPUT:
45         RETVAL
47 Query *
48 new4range(op, valno, start, end)
49     int         op
50     valueno     valno
51     string      start
52     string      end
53     CODE:
54         RETVAL = new Query( (Query::op) op, valno, start, end );
55     OUTPUT:
56         RETVAL
58 Query *
59 newN(int op_, ...)
60     CODE:
61         Query::op op = (Query::op)op_;
62         try {
63             vector<Query> queries;
64             queries.reserve(items - 1);
65             for( int i = 1; i < items; i++ ) {
66                 SV *sv = ST (i);
67                 if (sv_isa(sv, "Search::Xapian::Query")) {
68                     Query *query = (Query*) SvIV((SV*) SvRV(sv));
69                     queries.push_back(*query);
70                 } else if ( SvOK(sv) ) {
71                     STRLEN len;
72                     const char * ptr = SvPV(sv, len);
73                     queries.push_back(Query(string(ptr, len)));
74                 } else {
75                     croak( "USAGE: Search::Xapian::Query->new(OP, @TERMS_OR_QUERY_OBJECTS)" );
76                 }
77             }
78             RETVAL = new Query(op, queries.begin(), queries.end());
79         } catch (...) {
80             handle_exception();
81         }
82     OUTPUT:
83         RETVAL
85 termcount
86 Query::get_length()
88 TermIterator *
89 Query::get_terms_begin()
90     CODE:
91         RETVAL = new TermIterator(THIS->get_terms_begin());
92     OUTPUT:
93         RETVAL
95 TermIterator *
96 Query::get_terms_end()
97     CODE:
98         RETVAL = new TermIterator(THIS->get_terms_end());
99     OUTPUT:
100         RETVAL
102 bool
103 Query::empty()
105 string
106 Query::get_description()
108 void
109 Query::DESTROY()