LucyX:...tyQuery(3pm)

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

πŸ’– LucyX::Search::ProximityQuery β€” it's giving "find my words, in order" ✨

okay bestie, welcome to the 3pm section of the manual, and this one is a whole little icon: LucyX::Search::ProximityQuery, aka the query that's like "these terms, in this order, close together, or it's not happening." 🌸


✨ NAME ✨

LucyX::Search::ProximityQuery β€” a Query that matches an ordered list of terms. πŸ’…


🌈 SYNOPSIS 🌈

my $proximity_query = LucyX::Search::ProximityQuery->new(
    field  => 'content',
    terms  => [qw( the who )],
    within => 10,    # match within 10 positions
);
my $hits = $searcher->hits( query => $proximity_query );

like, look at her go 🫢 β€” you hand her a field, a little terms array, and a within window, and she goes and finds stuff.


πŸ¦‹ DESCRIPTION πŸ¦‹

ProximityQuery is a subclass of Query, and her whole personality is matching against an ordered sequence of terms. no cap. πŸ’œ


πŸŽ€ CONSTRUCTORS πŸŽ€

🧚 new

my $proximity_query = LucyX::Search::ProximityQuery->new(
    field  => $field,   # required
    terms  => $terms,   # required
    within => $within,  # required
);

Create a new ProximityQuery. she's fresh, she's new, she's ready to search. ✨

  • field β€” the field that the phrase has to occur in. πŸ“
  • terms β€” the ordered array of terms that must match. the order matters, bestie, don't play. πŸ‘‘

πŸ’… METHODS πŸ’…

πŸ“ get_field

my $string = $proximity_query->get_field();

Accessor for the object's field attribute. lowkey just hands you back the field. 🌸

⭐ get_terms

my $arrayref = $proximity_query->get_terms();

Accessor for the object's array of terms. it's giving arrayref. πŸ”₯

πŸ’œ get_within

my $int = $proximity_query->get_within();

Accessor for the object's within attribute. an int, as promised. ✨

πŸ‘‘ make_compiler

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

Abstract factory method returning a Compiler derived from this Query. very "build me a compiler, but make it fashion." πŸŽ€

  • searcher β€” a Searcher. πŸ”
  • boost β€” a scoring multiplier. πŸ“ˆ
  • subordinate β€” indicates whether the Query is a subquery (as opposed to a top-level query). if it's false, the implementation must invoke normalize() on the newly minted Compiler object before returning it. not optional, not a suggestion, that's the rule. πŸ’€

🌸 INHERITANCE 🌸

LucyX::Search::ProximityQuery isa Lucy::Search::Query isa Clownfish::Obj. the family tree ate, fr fr. 🌈


and that's the whole page, bestie πŸ’– this one came from perl v5.42.0, dated 2025-07-25 β€” shoutout to the Perl docs girlies, periodt. 🫢✨

πŸ“¦ where this page comes from