.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" 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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' '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 turned on, 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. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Xapian::QueryParser 3pm" .TH Xapian::QueryParser 3pm "2012-05-09" "perl v5.14.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" Search::Xapian::QueryParser \- Parse a query string into a Search::Xapian::Query object .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module turns a human readable string into something Xapian can understand. The syntax supported is designed to be similar to other web based search engines, so that users familiar with them don't have to learn a whole new syntax. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Search::Xapian qw/:standard/; \& \& my $qp = new Search::Xapian::QueryParser( [$database] ); \& $qp\->set_stemmer(new Search::Xapian::Stem("english")); \& $qp\->set_default_op(OP_AND); \& \& $database\->enquire($qp\->parse_query(\*(Aqa NEAR word OR "a phrase" NOT (too difficult) +eh\*(Aq)); .Ve .SH "METHODS" .IX Header "METHODS" .IP "new " 4 .IX Item "new " QueryParser constructor. .IP "set_stemmer " 4 .IX Item "set_stemmer " Set the Search::Xapian::Stem object to be used for stemming query terms. .IP "set_stemming_strategy " 4 .IX Item "set_stemming_strategy " Set the stemming strategy. Valid values are \f(CW\*(C`STEM_ALL\*(C'\fR, \f(CW\*(C`STEM_SOME\*(C'\fR, \&\f(CW\*(C`STEM_NONE\*(C'\fR. .IP "set_stopper " 4 .IX Item "set_stopper " Set the Search::Xapian::Stopper object to be used for identifying stopwords. .IP "set_default_op " 4 .IX Item "set_default_op " Set the default operator. .Sp This operator is used to combine non-filter query items when no explicit operator is used. .Sp The most useful values for this are \s-1OP_OR\s0 (the default) and \s-1OP_AND\s0. \&\s-1OP_NEAR\s0 and \s-1OP_PHRASE\s0 can also be useful. .Sp See Search::Xapian for descriptions of these constants. .IP "get_default_op" 4 .IX Item "get_default_op" Returns the current default operator. .IP "set_database " 4 .IX Item "set_database " Pass a Search::Xapian::Database object which is used to check whether terms exist in some situations. .IP "parse_query []" 4 .IX Item "parse_query []" Parses the query string according to the rules defined in the query parser documentation below. You can specify certain flags to modify the searching behaviour: .Sp .Vb 3 \& FLAG_BOOLEAN, FLAG_PHRASE, FLAG_LOVEHATE, FLAG_BOOLEAN_ANY_CASE, \& FLAG_WILDCARD, FLAG_PURE_NOT, FLAG_PARTIAL, FLAG_SPELLING_CORRECTION, \& FLAG_SYNONYM, FLAG_AUTO_SYNONYMS, FLAG_AUTO_MULTIWORD_SYNONYMS .Ve .Sp To specify multiple flags, \*(L"bitwise or\*(R" them together (with \f(CW\*(C`|\*(C'\fR). The default flags are \f(CW\*(C`FLAG_PHRASE|FLAG_BOOLEAN|FLAG_LOVEHATE\*(C'\fR .IP "add_prefix " 4 .IX Item "add_prefix " Add a probabilistic term prefix. E.g. \f(CW$qp\fR\->add_prefix(\*(L"author\*(R", \*(L"A\*(R"); .Sp Allows the user to search for author:orwell which will search for the term \&\*(L"Aorwel\*(R" (assuming English stemming is in use). Multiple fields can be mapped to the same prefix (so you can e.g. make title: and subject: aliases for each other). .Sp Parameters: field The user visible field name prefix The term prefix to map this to .IP "add_boolean_prefix prefix" 4 .IX Item "add_boolean_prefix prefix" Add a boolean term prefix allowing the user to restrict a search with a boolean filter specified in the free text query. E.g. .Sp .Vb 1 \& $p\->add_boolean_prefix("site", "H"); .Ve .Sp Allows the user to restrict a search with site:xapian.org which will be converted to Hxapian.org combined with any probabilistic query with \&\f(CW\*(C`OP_FILTER\*(C'\fR. .Sp Multiple fields can be mapped to the same prefix (so you can e.g. make site: and domain: aliases for each other). .Sp Parameters: field The user visible field name prefix The term prefix to map this to .IP "stoplist_begin" 4 .IX Item "stoplist_begin" .PD 0 .IP "stoplist_end" 4 .IX Item "stoplist_end" .IP "unstem_begin" 4 .IX Item "unstem_begin" .IP "unstem_end" 4 .IX Item "unstem_end" .IP "get_description" 4 .IX Item "get_description" .PD Returns a string describing this object. .IP "get_corrected_query_string" 4 .IX Item "get_corrected_query_string" Get the spelling-corrected query string. .Sp This will only be set if \s-1FLAG_SPELLING_CORRECTION\s0 is specified when \&\fIQueryParser::parse_query()\fR was last called. .Sp If there were no corrections, an empty string is returned. .IP "set_max_wildcard_expansion " 4 .IX Item "set_max_wildcard_expansion " Specify the maximum expansion of a wildcard term. .Sp Note: you must also set \s-1FLAG_WILDCARD\s0 for wildcard expansion to happen. .Sp Parameter limit is the maximum number of terms each wildcard in the query can expand to, or 0 for no limit (which is the default). .SH "REFERENCE" .IX Header "REFERENCE" .Vb 2 \& http://www.xapian.org/docs/queryparser.html \& http://www.xapian.org/docs/sourcedoc/html/classXapian_1_1QueryParser.html .Ve