.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Text::Query::ParseAdvanced 3" .TH Text::Query::ParseAdvanced 3 2024-07-13 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Text::Query::ParseAdvanced \- Parse AltaVista advanced query syntax .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 5 \& use Text::Query; \& my $q=new Text::Query(\*(Aqhello and world\*(Aq, \& \-parse => \*(AqText::Query::ParseAdvanced\*(Aq, \& \-solve => \*(AqText::Query::SolveAdvancedString\*(Aq, \& \-build => \*(AqText::Query::BuildAdvancedString\*(Aq); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This module provides an object that parses a string containing a Boolean query expression similar to an AltaVista "advanced query". .PP It's base class is Text::Query::Parse; .PP Query expressions consist of literal strings (or regexps) joined by the following operators, in order of precedence from lowest to highest: .IP "OR, |" 4 .IX Item "OR, |" .PD 0 .IP "AND, &" 4 .IX Item "AND, &" .IP "NEAR, ~" 4 .IX Item "NEAR, ~" .IP "NOT, !" 4 .IX Item "NOT, !" .PD .PP Operator names are not case-sensitive. Note that if you want to use a \f(CW\*(C`|\*(C'\fR in a regexp, you need to backwhack it to keep it from being seen as a query operator. Sub-expressions may be quoted in single or double quotes to match "and," "or," or "not" literally and may be grouped in parentheses (\f(CW\*(C`(, )\*(C'\fR) to alter the precedence of evaluation. .PP A parenthesized sub-expression may also be concatenated with other sub\- expressions to match sequences: \f(CW\*(C`(Perl or Python) interpreter\*(C'\fR would match either "Perl interpreter" or "Python interpreter". Concatenation has a precedence higher than NOT but lower than AND. Juxtaposition of simple words has the highest precedence of all. .SH OPTIONS .IX Header "OPTIONS" These are the additional options of the \f(CW\*(C`prepare\*(C'\fR method and the constructor. .IP "\-near defaults to 10" 4 .IX Item "-near defaults to 10" Sets the number of words that can occur between two expressions and still satisfy the NEAR operator. .IP "\-operators defaults to and, or, not, near" 4 .IX Item "-operators defaults to and, or, not, near" Sets the operator names. The argument of the option is a pointer to a hash table mapping the default names to desired names. For instance: .Sp .Vb 6 \& { \& \*(Aqor\*(Aq => \*(Aqou\*(Aq, \& \*(Aqand\*(Aq => \*(Aqet\*(Aq, \& \*(Aqnear\*(Aq => \*(Aqproche\*(Aq, \& \*(Aqnot\*(Aq => \*(Aqnon\*(Aq, \& } .Ve .IP "\-scope_map default to {}" 4 .IX Item "-scope_map default to {}" Map the scope names to other names. If a scope is specified as \f(CW\*(C`scope:\*(C'\fR search the map for an entry whose key is \f(CW\*(C`scope\*(C'\fR and replace \f(CW\*(C`scope\*(C'\fR with the scalar found. For instance: .Sp .Vb 3 \& { \& \*(Aqscope\*(Aq => \*(Aqotherscope\*(Aq \& } .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBText::Query\fR\|(3) \&\fBText::Query::Parse\fR\|(3) .SH AUTHORS .IX Header "AUTHORS" Eric Bohlman (ebohlman@netcom.com) .PP Loic Dachary (loic@senga.org) .PP Jon Jensen, jon@endpoint.com