Text::Q...eSimple(3)

πŸ“¦ version 0.09, in arch rolling

okay so welcome to the Text::Q...eSimple(3) page β€” yes bestie, that's the manual name β€” and it's coming at you from User Contributed Perl Documentation. The main character here is Text::Query::ParseSimple, and it parses AltaVista simple query syntax. Let's get into it πŸ’…


✨ NAME ✨

Text::Query::ParseSimple β€” parse AltaVista simple query syntax. That's the vibe, periodt.

πŸ› οΈ SYNOPSIS πŸ› οΈ

Here's the exact invocation, no cap:

use Text::Query;
my $q=new Text::Query('hello and world',
                      -parse => 'Text::Query::ParseSimple',
                      -solve => 'Text::Query::SolveSimpleString',
                      -build => 'Text::Query::BuildSimpleString');

πŸ’– DESCRIPTION πŸ’–

This module provides an object that parses a string containing a Boolean query expression similar to an AltaVista "simple query". Elements of the query expression may be assigned weights. It's giving parser energy, fr fr.

Its base class is Text::Query::Parse. That's the parent class, iykyk.

Query expressions are compiled into an internal form when a new object is created or the prepare method is called; they are not recompiled on each match. So like, do the prep once and slay.

Query expressions consist of words (sequences of non-whitespace) or phrases (quoted strings) separated by whitespace. Here's the breakdown, bestie:

  • Words or phrases prefixed with a + must be present for the expression to match.
  • Words or phrases prefixed with a - must be absent for the expression to match.
  • Words or phrases may optionally be followed by a number in parentheses. The number specifies the weight given to the word or phrase. If a weight is not given, a weight of 1 is assumed.
okay but listen: no whitespace is allowed between the word or phrase and the parenthesized number. That's a hard no, bestie. 🫢

πŸŽ€ EXAMPLES πŸŽ€

Here's the whole example block, verbatim, no edits:

use Text::Query;
my $q=new Text::Query('+hello world',
                      -solve => 'Text::Query::SolveSimpleString',
                      -build => 'Text::Query::BuildSimpleString');
die "bad query expression" if not defined $q;
$count=$q->match;
...
$q->prepare('goodbye adios -"ta ta"', -litspace=>1);
#requires single space between the two ta's
if ($q->match($line, -case=>1)) {
#doesn't match "Goodbye"
...
$q->prepare('\\bintegrate\\b', -regexp=>1);
#won't match "disintegrated"
...
$q->prepare('information(2) retrieval');
#information has twice the weight of retrieval

πŸ”— SEE ALSO πŸ”—

πŸ‘‘ AUTHORS πŸ‘‘

  • Eric Bohlman (ebohlman@netcom.com)
  • Loic Dachary (loic@senga.org)

signing off with the footer deets, bestie: this page is from perl v5.38.2, dated 2024-07-13, and the manual name is Text::Q...eSimple(3). mwah πŸ’…πŸ’–

πŸ“¦ where this page comes from