Plucen...:Query(3pm)

πŸ“¦
version 1.25 Β· 2 versions
  • 1.25 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.25 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

Plucene::Search::Query β€” bestie, this is the base class for queries πŸ’– (and yes the manual header squishes it down to Plucen...:Query(3pm) like it's on a diet, but we know her full name, and she's iconic).


🌸 SYNOPSIS 🌸

my $s_query = Plucene::Search::Query::Subclass->new({
        boost => $boost_factor});

my $scorer = $s_query->scorer($query, $searcher, $reader);

like... that's the whole vibe right there 🫢


πŸ’… DESCRIPTION πŸ’…

Okay so first things first: this is an abstract base class for queries. You don't instantiate her, you subclass her. That's her whole thing. Main character energy but she doesn't do the actual performing. πŸ‘‘

A query is a specification of the content an properties of the desired documents. Every single search happens by matching a query against the document index and then locating the ones that match the query. No cap. That's the entire mechanism. ✨

The simplest query specifies a single term (or word) that is to be matched against a single field (e.g. 'author') of each of the documents in the index. This kind of query matches any document that contains the term in the specified field. Simple. Clean. Ate. πŸ“

A more complex queries may contain nested queries with 'and', 'or', 'not' or 'phrase' relations. Queries may also contains specification of which document fields to match against the various parts of the query (.e.g. 'authors' and 'title') and hints that may effects the ranking of the matched documents (the 'boost' factor). So you can literally tell her "hey, weigh this part heavier" and she's like bet πŸ’β€β™€οΈ

ngl some of those sentences are doing their own thing grammatically, but the meaning is crystal clear and we're keeping every word of it fr fr 😭

πŸ”₯ METHODS πŸ”₯

🌈 new

my $s_query = Plucene::Search::Query::Subclass->new({
        boost => $boost_factor});

Constructor! She's on the subclass though, bestie β€” remember, this one's abstract. πŸ™ˆ

πŸŽ€ boost

Get / set this attribute.

That's it. That's the method. She gets, she sets, she slays. πŸ’œ

⭐ scorer

my $scorer = $s_query->scorer
        (Plucene::Search::Query $query, $searcher, $reader);

Hand her the Plucene::Search::Query $query, the $searcher, and the $reader, and she'll hand you back a $scorer. πŸ¦‹

🧚 prepare

Does nothing.

Truly the most relatable method in this entire module. She is present. She contributes zero. We respect her for it. ✨

πŸ‘‘ sum_squared_weights / normalize / _scorer

These must be defined in a subclass.

🚨 okay so listen: these are not optional, not vibes-based, not "eh I'll get to it later". They must be defined in a subclass. If you don't, you're on your own and that's on you bestie 😭

and that's the whole page!! written by the perl crew, perl v5.36.0, dated 2022-12-04 β€” go forth and query, you absolute legend πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from