GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Text::Query::ParseSimple(3) User Contributed Perl Documentation Text::Query::ParseSimple(3)

Text::Query::ParseSimple - Parse AltaVista simple query syntax

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

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 base class is Text::Query::Parse;

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.

Query expressions consist of words (sequences of non-whitespace) or phrases (quoted strings) separated by whitespace. 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 (no whitespace is allowed between the word or phrase and the parenthesized number). This number specifies the weight given to the word or phrase. If a weight is not given, a weight of 1 is assumed.

  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

Text::Query(3) Text::Query::Parse(3)

Eric Bohlman (ebohlman@netcom.com)

Loic Dachary (loic@senga.org)

2013-08-13 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.