Lucy::...ORQuery(3pm)

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

πŸ’– Lucy::Search::ORQuery πŸ’–

okay bestie, welcome to the Lucy::Search::ORQuery page β€” part of the User Contributed Perl Documentation, no big deal, just iconic behaviour. it's Lucy::Search::ORQuery, and its whole job is union multiple result sets. yep. that's the vibe. πŸ¦‹


✨ SYNOPSIS ✨

like, literally just do this:

my $foo_or_bar_query = Lucy::Search::ORQuery->new(
    children => [ $foo_query, $bar_query ],
);
my $hits = $searcher->hits( query => $foo_or_bar_query );
...

and that's it, you ate. πŸ’…


🌸 DESCRIPTION 🌸

so ORQuery is a composite Query, which is a fancy way of saying it's a query made of other queries. it matches whenever any of its children match, which means its result set is literally the union of all their result sets. no cap. 🫢

and when a document matches, it gets a summed score from all the matching child Queries. so if three children are into the same doc, that doc is getting all three scores stacked. main character energy fr fr. πŸ‘‘


πŸŽ€ CONSTRUCTORS πŸŽ€

new

my $foo_or_bar_query = Lucy::Search::ORQuery->new(
    children => [ $foo_query, $bar_query ],
);

creates a brand new ORQuery. obsessed. ✨

  • children β€” an array of child Queries. that's the whole thing, bestie, that's the squad. πŸ«‚

πŸ’œ METHODS πŸ’œ

make_compiler

my $compiler = $or_query->make_compiler(
    searcher    => $searcher,     # required
    boost       => $boost,        # required
    subordinate => $subordinate,  # default: false
);

this is an abstract factory method β€” it returns a Compiler derived from this Query. think of it as the glow-up station where your Query turns into something the searcher can actually run. 🧚

  • searcher β€” a Searcher</scyan>. required, don't skip it. 😀
  • boost β€” a scoring multiplier. also required. it's giving "make this count more". πŸ”₯
  • subordinate β€” tells you whether the Query is a subquery, as opposed to a top-level query. default is false. and here's the important bit: if it's false, the implementation must invoke normalize() on the newly minted Compiler object before returning it. don't forget that part or it's gonna be a whole situation. πŸ’€

πŸ‘‘ INHERITANCE πŸ‘‘

the family tree, periodt:

  • Lucy::Search::ORQuery isa Lucy::Search::PolyQuery isa Lucy::Search::Query isa Clownfish::Obj.

generations of icons, honestly. 🌈


and that's the page, bestie!! this was perl v5.42.0, dated 2025-07-25, served up fresh from the User Contributed Perl Documentation collection. go union some result sets, you've got this. πŸŽ€πŸ’–βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from