KinoSe...yParser(3pm)
π KinoSearch1::QueryParser::QueryParser π
okay bestie, gather round, because this one is literally the glow-up station for your search strings π
in the KinoSearch1 family of Perl modules (you know, the ones in User Contributed Perl Documentation). It takes a plain lil string and turns it into a whole Query object. iconic behavior, no cap β¨
β¨ NAME β¨
KinoSearch1::QueryParser::QueryParser β the thing that transforms a string into a Query object π¦
πΈ SYNOPSIS πΈ
my $query_parser = KinoSearch1::QueryParser::QueryParser->new(
analyzer => $analyzer,
fields => [ 'bodytext' ],
);
my $query = $query_parser->parse( $query_string );
my $hits = $searcher->search( query => $query );
π DESCRIPTION π
So basically: QueryParser takes search strings as input, and it hands you back Query objects. Those are exactly the kind of objects you feed straight into KinoSearch1::Searcher. match made in heaven fr fr π«Ά
π₯ Syntax π₯
Here's the tea β these are the constructs QueryParser actually recognizes:
- Boolean operators
'AND','OR', and'AND NOT'π - A
+plus or-minus stuck on the front, which means the labeled entity is either required or forbidden. And by "entity" I mean literally anything β a single word, a phrase, a whole parenthetical group, all of it. she's flexible like that π - Logical groups, living inside parentheses.
- Phrases, wrapped in double quotes.
- Field-specific terms, shaped like
"fieldname:termtext". (When you do this, the field you named infieldnamegets used instead of the QueryParser's default fields. very demure, very mindful.)
And plot twist β you can give a field to a logical group too! It works out to the exact same thing as prepending that field onto every single term in the group. For example: "foo:(bar baz)" is the same as "foo:bar foo:baz". periodt π
π METHODS π
π new
my $query_parser = KinoSearch1::QueryParser::QueryParser->new(
analyzer => $analyzer, # required
fields => [ 'bodytext' ], # required
default_boolop => 'AND', # default: 'OR'
);
Constructor, babes. It takes hash-style parameters:
analyzerβ an object that subclassesKinoSearch1::Analysis::Analyzer. π¨ listen: this has to be identical to the Analyzer you used at index-time, otherwise your results will not match up. not even a little. pls do not play with this one πfieldsβ the names of the fields that are gonna get searched against. Must be supplied as an arrayref, okay? Not a plain list, an arrayref. πΈdefault_fieldβ deprecated. Use"fields"instead. she's retired, let her rest πdefault_boolopβ two possible values:'AND'and'OR'. The default is'OR', which means: return documents that match any of the query terms. If you only want documents that match all of the query terms, set this to'AND'. choose your fighter β
π¦ parse
my $query = $query_parser->parse( $query_string );
Turn a query string into a Query object. And depending on what's inside that query string, the returned object could be any one of several subclasses of KinoSearch1::Search::Query. surprise! main character energy, you never know who's gonna show up π
π COPYRIGHT π
Copyright 2005-2010 Marvin Humphrey
π LICENSE, DISCLAIMER, BUGS, etc. π
See KinoSearch1 version 1.01.
okay that's the whole page, you ate it π
and just so you have the receipts: this was the KinoSearch1::QueryParser::QueryParser page from perl v5.42.3, dated 2026-08-20, filed under User Contributed Perl Documentation. go forth and parse, bestie π§πβ¨
π¦ 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