[omega] Compute date spans in days
[xapian.git] / xapian-bindings / perl / Xapian / Enquire.pm
blob50880fb75bdb4f42cb1dd7f07a97acef322551c8
1 package Xapian::Enquire;
3 =head1 NAME
5 Xapian::Enquire - Make queries against a database
7 =head1 DESCRIPTION
9 This class provides an interface to the information retrieval system for the
10 purpose of searching.
12 =head1 METHODS
14 =over 4
16 =item new
18 =item set_query
20 takes either a ready made L<Xapian::Query> or a scalar containing
21 a query, which in that case will be passed to L<Xapian::Query>'s
22 constructor, together with any other passed arguments.
24 =item set_query_object <query>
26 =item get_query
28 =item matches <start> <size> [<check_at_least>]
30 Takes the start element, and maximum number of elements (and optionally
31 the minimum number of matches to check), and returns an array tied to
32 L<Xapian::MSet::Tied>.
34 =item get_matching_terms_begin
36 Returns a L<Xapian::TermIterator>, pointing to the start
37 of the stream.
39 =item get_matching_terms_end
41 Returns a L<Xapian::TermIterator>, pointing to the end
42 of the stream.
44 =item set_collapse_key <collapse_key>
46 =item set_docid_order <order>
48 Set the direction in which documents are ordered by document id
49 in the returned MSet.
51 This order only has an effect on documents which would otherwise
52 have equal rank. When ordering by relevance without a sort key,
53 this means documents with equal weight. For a boolean match
54 with no sort key, this means all documents. And if a sort key
55 is used, this means documents with equal sort key (and also equal
56 weight if ordering on relevance before or after the sort key).
58 order can be ENQ_ASCENDING (the default, docids sort in ascending order),
59 ENQ_DESCENDING (docds sort in descending order), or ENQ_DONT_CARE (docids sort
60 in whatever order is most efficient for the backend.)
62 Note: If you add documents in strict date order, then a boolean
63 search - i.e. set_weighting_scheme(Xapian::BoolWeight()) - with
64 set_docid_order(Xapian::Enquire::DESCENDING) is an efficient
65 way to perform "sort by date, newest first", and with
66 set_docid_order(Xapian::Enquire::ASCENDING) a very efficient way
67 to perform "sort by date, oldest first".
69 =item set_cutoff <percent_cutoff> [<weight_cutoff>]
71 =item set_sort_by_relevance
73 Set the sorting to be by relevance only. This is the default.
75 =item set_sort_by_value <sort_key> [<ascending>]
77 Set the sorting to be by value only.
79 sort_key - value number to reorder on. Sorting is with a
80 string compare. If ascending is true (the default) higher
81 is better; if ascending is false, lower is better.
83 ascending - If true, document values which sort higher by
84 string compare are better. If false, the sort order
85 is reversed. (default true)
87 =item set_sort_by_value_then_relevance <sort_key> [<ascending>]
89 Set the sorting to be by value, then by relevance for documents
90 with the same value.
92 sort_key - value number to reorder on. Sorting is with a
93 string compare. If ascending is true (the default) higher
94 is better; if ascending is false, lower is better.
96 ascending - If true, document values which sort higher by
97 string compare are better. If false, the sort order
98 is reversed. (default true)
100 =item set_sort_by_relevance_then_value <sort_key> [<ascending>]
102 Set the sorting to be by relevance then value.
104 Note that with the default BM25 weighting scheme parameters,
105 non-identical documents will rarely have the same weight, so
106 this setting will give very similar results to
107 set_sort_by_relevance(). It becomes more useful with particular
108 BM25 parameter settings (e.g. BM25Weight(1,0,1,0,0)) or custom
109 weighting schemes.
111 sort_key - value number to reorder on. Sorting is with a
112 string compare. If ascending is true (the default) higher
113 is better; if ascending is false, lower is better.
115 ascending - If true, document values which sort higher by
116 string compare are better. If false, the sort order
117 is reversed. (default true)
119 =item set_sort_by_key <sorter> [<ascending>]
121 Set the sorting to be by key only.
123 sorter - the functor to use to build the key.
125 ascending - If true, keys which sort higher by
126 string compare are better. If false, the sort order
127 is reversed. (default true)
129 =item set_sort_by_key_then_relevance <sorter> [<ascending>]
131 Set the sorting to be by key, then by relevance for documents
132 with the same key.
134 sorter - the functor to use to build the key.
136 ascending - If true, keys which sort higher by
137 string compare are better. If false, the sort order
138 is reversed. (default true)
140 =item set_sort_by_relevance_then_key <sorter> [<ascending>]
142 Set the sorting to be by relevance then key.
144 sorter - the functor to use to build the key.
146 ascending - If true, keys which sort higher by
147 string compare are better. If false, the sort order
148 is reversed. (default true)
150 =item get_mset
152 Get match set.
154 =item get_eset
156 Get set of query expansion terms.
158 =item get_description
160 Return a description of this object.
162 =back
164 =head1 SEE ALSO
166 L<Xapian::Query>,
167 L<Xapian::Database>
169 =cut