KinoSe...anQuery(3pm)
π KinoSearch1::Search::BooleanQuery β the whole vibe π
okay so bestie, this page is from the User Contributed Perl Documentation and it's literally about KinoSearch1::Search::BooleanQuery π¦ β match boolean combinations of Queries. iykyk.
β¨ NAME β¨
KinoSearch1::Search::BooleanQuery β match boolean combinations of Queries π
πΈ SYNOPSIS πΈ
my $bool_query = KinoSearch1::Search::BooleanQuery->new;
$bool_query->add_clause( query => $term_query, occur => 'MUST' );
my $hits = $searcher->search( query => $bool_query );
that's it, that's the vibe π«Ά
π DESCRIPTION π
so BooleanQuery objects are like... the super-Query objects π. they match boolean combinations of other Queries. main character energy honestly.
one way to cook up a BooleanQuery is to feed a query string along the lines of "this AND NOT that" to a QueryParser object:
my $bool_query = $query_parser->parse( 'this AND NOT that' );
it's also possible to achieve the same end by manually constructing the query piece by piece:
my $bool_query = KinoSearch1::Search::BooleanQuery->new;
my $this_query = KinoSearch1::Search::TermQuery->new(
term => KinoSearch1::Index::Term->new( 'bodytext', 'this' ),
);
$bool_query->add_clause( query => $this_query, occur => 'MUST' );
my $that_query = KinoSearch1::Search::TermQuery->new(
term => KinoSearch1::Index::Term->new( 'bodytext', 'that' ),
);
$bool_query->add_clause( query => $that_query, occur => 'MUST_NOT' );
and no cap, QueryParser objects and hand-rolled Queries can work together π§:
my $general_query = $query_parser->parse($q);
my $news_only = KinoSearch1::Search::TermQuery->new(
term => KinoSearch1::Index::Term->new( 'category', 'news' );
);
$bool_query->add_clause( query => $general_query, occur => 'MUST' );
$bool_query->add_clause( query => $news_only, occur => 'MUST' );
π METHODS π
π new
my $bool_query = KinoSearch1::Search::BooleanQuery->new;
Constructor π. Takes no arguments. she's low maintenance like that.
π add_clause
$bool_query->add_clause(
query => $query, # required
occur => 'MUST', # default: 'SHOULD'
);
Add a clause to the BooleanQuery. takes hash-style parameters:
queryβ an object which belongs to a subclass ofKinoSearch1::Search::Query. yes bestie, it has to be that type, don't try anything funny πoccurβ must be one of three possible values:'SHOULD','MUST', or'MUST_NOT'. literally only those three, periodt π
π COPYRIGHT π
Copyright 2005-2010 Marvin Humphrey
π LICENSE, DISCLAIMER, BUGS, etc. π
See KinoSearch1 version 1.01. that's where the whole saga lives, go check it π¦
ok and that's the page!! every flag, every param, every default, all present and accounted for β obsessed with her honestly.
π bye bestie, go write some queries π
β from the Perl docs, perl v5.42.3, dated 2026-08-20. slay βπΈ
π¦ where this page comes from
- ubuntu stonking: libkinosearch1-perl 1.01-6build2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms