1Lucy::Search::RequiredOUpsteironCaolnQtureirbyu(t3e)d PeLrulcyD:o:cSuemaernctha:t:iRoenquiredOptionalQuery(3)
2
3
4
6 Lucy::Search::RequiredOptionalQuery - Join results for two Queries, one
7 required, one optional.
8
10 my $foo_and_maybe_bar = Lucy::Search::RequiredOptionalQuery->new(
11 required_query => $foo_query,
12 optional_query => $bar_query,
13 );
14 my $hits = $searcher->hits( query => $foo_and_maybe_bar );
15 ...
16
18 RequiredOptionalQuery joins the result sets of one Query which MUST
19 match, and one Query which SHOULD match. When only the required Query
20 matches, its score is passed along; when both match, the scores are
21 summed.
22
24 new
25 my $reqopt_query = Lucy::Search::RequiredOptionalQuery->new(
26 required_query => $foo_query, # required
27 optional_query => $bar_query, # required
28 );
29
30 Create a new RequiredOptionalQuery.
31
32 • required_query - Query must must match.
33
34 • optional_query - Query which should match.
35
37 get_required_query
38 my $query = $required_optional_query->get_required_query();
39
40 Getter for the required Query.
41
42 set_required_query
43 $required_optional_query->set_required_query($required_query);
44
45 Setter for the required Query.
46
47 get_optional_query
48 my $query = $required_optional_query->get_optional_query();
49
50 Getter for the optional Query.
51
52 set_optional_query
53 $required_optional_query->set_optional_query($optional_query);
54
55 Setter for the optional Query.
56
57 make_compiler
58 my $compiler = $required_optional_query->make_compiler(
59 searcher => $searcher, # required
60 boost => $boost, # required
61 subordinate => $subordinate, # default: false
62 );
63
64 Abstract factory method returning a Compiler derived from this Query.
65
66 • searcher - A Searcher.
67
68 • boost - A scoring multiplier.
69
70 • subordinate - Indicates whether the Query is a subquery (as opposed
71 to a top-level query). If false, the implementation must invoke
72 normalize() on the newly minted Compiler object before returning
73 it.
74
76 Lucy::Search::RequiredOptionalQuery isa Lucy::Search::PolyQuery isa
77 Lucy::Search::Query isa Clownfish::Obj.
78
79
80
81perl v5.34.0 2021-07L-u2c2y::Search::RequiredOptionalQuery(3)