Plucen...:Query(3pm)
β¨ 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
- debian bookworm: libplucene-perl 1.25-5
- debian trixie: libplucene-perl 1.25-5
- ubuntu noble: libplucene-perl 1.25-5
- ubuntu resolute: libplucene-perl 1.25-5
- ubuntu stonking: libplucene-perl 1.25-5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms