1Lucy::Search::RangeQuerUys(e3r)Contributed Perl DocumentLautciyo:n:Search::RangeQuery(3)
2
3
4
6 Lucy::Search::RangeQuery - Match a range of values.
7
9 # Match all articles by "Foo" published since the year 2000.
10 my $range_query = Lucy::Search::RangeQuery->new(
11 field => 'publication_date',
12 lower_term => '2000-01-01',
13 include_lower => 1,
14 );
15 my $author_query = Lucy::Search::TermQuery->new(
16 field => 'author_last_name',
17 text => 'Foo',
18 );
19 my $and_query = Lucy::Search::ANDQuery->new(
20 children => [ $range_query, $author_query ],
21 );
22 my $hits = $searcher->hits( query => $and_query );
23 ...
24
26 RangeQuery matches documents where the value for a particular field
27 falls within a given range.
28
30 new
31 my $range_query = Lucy::Search::RangeQuery->new(
32 field => 'product_number', # required
33 lower_term => '003', # see below
34 upper_term => '060', # see below
35 include_lower => 0, # default true
36 include_upper => 0, # default true
37 );
38
39 Create a new RangeQuery.
40
41 Takes 5 parameters; "field" is required, as is at least one of either
42 "lower_term" or "upper_term".
43
44 · field - The name of a "sortable" field.
45
46 · lower_term - Lower delimiter. If not supplied, all values less
47 than "upper_term" will pass.
48
49 · upper_term - Upper delimiter. If not supplied, all values greater
50 than "lower_term" will pass.
51
52 · include_lower - Indicates whether docs which match "lower_term"
53 should be included in the results.
54
55 · include_upper - Indicates whether docs which match "upper_term"
56 should be included in the results.
57
59 make_compiler
60 my $compiler = $range_query->make_compiler(
61 searcher => $searcher, # required
62 boost => $boost, # required
63 subordinate => $subordinate, # default: false
64 );
65
66 Abstract factory method returning a Compiler derived from this Query.
67
68 · searcher - A Searcher.
69
70 · boost - A scoring multiplier.
71
72 · subordinate - Indicates whether the Query is a subquery (as opposed
73 to a top-level query). If false, the implementation must invoke
74 normalize() on the newly minted Compiler object before returning
75 it.
76
78 Lucy::Search::RangeQuery isa Lucy::Search::Query isa Clownfish::Obj.
79
80
81
82perl v5.32.0 2020-07-28 Lucy::Search::RangeQuery(3)