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 of KinoSearch1::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 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