Lucy::...TQuery(3pm)

πŸ“¦
version 0.6.2 Β· 2 versions
, in fedora 43

πŸ’– 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 invoke normalize() on the newly minted Compiler object before returning it. so like, if you're not a subquery you have to call normalize() 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