Lucy::...TQuery(3pm)
π Lucy::Search::NOTQuery β the "flip it and reverse it" query π
okay bestie, so this page lives in the User Contributed Perl Documentation section of the manual, and its official manual-page name is Lucy::...TQuery(3pm) (yes the name got squished, it's giving truncation, we move). The module itself is Lucy::Search::NOTQuery. Let's get into it π«Ά
β¨ NAME β¨
Lucy::Search::NOTQuery β invert the result set of another Query. it's the "nope, not that" of queries π
β¨ SYNOPSIS β¨
my $not_bar_query = Lucy::Search::NOTQuery->new(
negated_query => $bar_query,
);
my $foo_and_not_bar_query = Lucy::Search::ANDQuery->new(
children => [ $foo_query, $not_bar_query ].
);
my $hits = $searcher->hits( query => $foo_and_not_bar_query );
...
(yes, that . in the children array is exactly how it appears in the original, no cap β copying it verbatim because that's the law around here π)
β¨ DESCRIPTION β¨
A NOTQuery wraps another Query and matches against its inverse document set. And here's the lil detail that matters: all matching docs receive a score of 0.0. Zero. Nothing. They show up, they get no points. main character energy but with no aura π
NOTQuery is often used in conjunction with ANDQuery to provide βa AND NOT bβ semantics. that's the whole vibe. you want everything that's a, minus everything that's b. iconic combo, iykyk πΈ
β¨ CONSTRUCTORS β¨
π new
my $not_query = Lucy::Search::NOTQuery->new(
negated_query => $query,
);
Create a new NOTQuery. fresh out the box, ready to invert π
negated_queryβ the Query whose result set should be inverted. this is the one you're saying "not this one bestie" about.
β¨ METHODS β¨
π¦ get_negated_query
my $query = $not_query->get_negated_query();
Accessor for the object's negated query. it just hands you back the query you told it to negate, no drama β¨
π¦ set_negated_query
$not_query->set_negated_query($negated_query);
Setter for the object's negated query. swap out which query is getting inverted, whenever you feel like it π
π¦ make_compiler
my $compiler = $not_query->make_compiler(
searcher => $searcher, # required
boost => $boost, # required
subordinate => $subordinate, # default: false
);
Abstract factory method returning a Compiler derived from this Query. it's giving "i don't build the thing myself, i build the thing that builds the thing" π
searcherβ A Searcher. required, no skips.boostβ A scoring multiplier. also required.subordinateβ Indicates whether the Query is a subquery (as opposed to a top-level query). If false, the implementation must invokenormalize()on the newly minted Compiler object before returning it. so like, if you're not a subquery you have to callnormalize()on that fresh compiler before you hand it back. non-negotiable, periodt π
β¨ INHERITANCE β¨
Lucy::Search::NOTQuery isa Lucy::Search::PolyQuery isa Lucy::Search::Query isa Clownfish::Obj.
a whole little family tree, we love a lineage π§
real talk: the 0.0 score thing is a fact, not a vibe. matching docs literally get scored zero, so don't come for me if your scores look empty β that's the design, bestie π
and that's the whole page! π this one was generated by perl v5.42.0 and dated 2025-07-25 β thanks for reading, you ate, mwah πβ¨
π¦ where this page comes from
- fedora 43: perl-Lucy 0.6.2-26.fc43 Β· Apache-2.0 AND MIT AND Unicode-DFS-2015
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms