API Documentation

Zend/Search/Lucene/Search/QueryParser.php

Show: inherited
Table of Contents

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Search_Lucene  
Subpackage
Search  
Version
$Id: QueryParser.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Search_Lucene_Search_QueryParser

Package: Zend\Search\Lucene\Search

Parent(s)
\Zend_Search_Lucene_FSM
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

Constant  B_OR = 0

Boolean operators constants

Constant  B_AND = 1
Constant  ST_COMMON_QUERY_ELEMENT = 0

Query parser State Machine states

Constant  ST_CLOSEDINT_RQ_START = 1
Constant  ST_CLOSEDINT_RQ_FIRST_TERM = 2
Constant  ST_CLOSEDINT_RQ_TO_TERM = 3
Constant  ST_CLOSEDINT_RQ_LAST_TERM = 4
Constant  ST_CLOSEDINT_RQ_END = 5
Constant  ST_OPENEDINT_RQ_START = 6
Constant  ST_OPENEDINT_RQ_FIRST_TERM = 7
Constant  ST_OPENEDINT_RQ_TO_TERM = 8
Constant  ST_OPENEDINT_RQ_LAST_TERM = 9
Constant  ST_OPENEDINT_RQ_END = 10

Properties

Propertyprivate\Zend_Search_Lucene_Search_QueryParserContext  $_context= ''

Current query parser context

Propertyprivatearray  $_contextStack= ''

Context stack

Details
Type
array
Propertyprivateinteger|string  $_currentToken= ''

Current token

Details
Type
integerstring
Propertyprivatestring  $_defaultEncoding= ''''

Query string default encoding

Default value''Details
Type
string
Propertyprivateinteger  $_defaultOperator= 'self::B_OR'

Default boolean queries operator

Default valueself::B_ORDetails
Type
integer
Propertyprivatestring  $_encoding= ''

Query string encoding

Details
Type
string
Propertyprivate\Zend_Search_Lucene_Search_QueryParser  $_instance= 'null'
static

Parser instance

Default valuenullDetails
Type
\Zend_Search_Lucene_Search_QueryParser
Propertyprivate\Zend_Search_Lucene_Search_QueryToken  $_lastToken= 'null'

Last token

It can be processed within FSM states, but this addirional state simplifies FSM

Default valuenullDetails
Type
\Zend_Search_Lucene_Search_QueryToken
Propertyprivate\Zend_Search_Lucene_Search_QueryLexer  $_lexer= ''

Query lexer

Propertyprivatestring  $_rqFirstTerm= 'null'

Range query first term

Default valuenullDetails
Type
string
Propertyprivateboolean  $_suppressQueryParsingExceptions= 'true'

Defines query parsing mode.

If this option is turned on, then query parser suppress query parser exceptions and constructs multi-term query using all words from a query.

That helps to avoid exceptions caused by queries, which don't conform to query language, but limits possibilities to check, that query entered by user has some inconsistencies.

Default is true.

Use {@link Zend_Search_Lucene::suppressQueryParsingExceptions()}, {@link Zend_Search_Lucene::dontSuppressQueryParsingExceptions()} and {@link Zend_Search_Lucene::checkQueryParsingExceptionsSuppressMode()} to operate with this setting.

Default valuetrueDetails
Type
boolean
Propertyprivatearray  $_tokens= ''

Tokens list Array of Zend_Search_Lucene_Search_QueryToken objects

Details
Type
array

Methods

methodpublic__construct( ) : void

Parser constructor

methodprivate_getInstance( ) : \Zend_Search_Lucene_Search_QueryParser
static

Get query parser instance

Returns
Type Description
\Zend_Search_Lucene_Search_QueryParser
methodpublicaddPhraseEntry( ) : void

Add phrase to a query

methodpublicaddTermEntry( ) : void

Add term to a query

methodpublicclosedRQFirstTerm( ) : void

Process first range query term (closed interval)

methodpublicclosedRQLastTerm( ) : void

Process last range query term (closed interval)

methodpublicdontSuppressQueryParsingExceptions( ) : void
static

Turn off 'suppress query parser exceptions' mode.

methodpublicescape( string $keyword ) : string
static

Escape keyword to force it to be parsed as one term

Parameters
Name Type Description
$keyword string
Returns
Type Description
string
methodpublicgetDefaultEncoding( ) : string
static

Get query string default encoding

Returns
Type Description
string
methodpublicgetDefaultOperator( ) : integer
static

Get default boolean operator

Returns
Type Description
integer
methodpubliclogicalOperator( ) : void

Process logical operator

methodpublicopenedRQFirstTerm( ) : void

Process first range query term (opened interval)

methodpublicopenedRQLastTerm( ) : void

Process last range query term (opened interval)

methodpublicparse( string $strQuery, string $encoding = null ) : \Zend_Search_Lucene_Search_Query
static

Parses a query string

Parameters
Name Type Description
$strQuery string
$encoding string
Returns
Type Description
\Zend_Search_Lucene_Search_Query
Throws
Exception Description
\Zend_Search_Lucene_Search_QueryParserException
methodpublicprocessFuzzyProximityModifier( ) : void

Process fuzzy search/proximity modifier - '~'

methodpublicprocessModifierParameter( ) : void

Process modifier parameter

Throws
Exception Description
\Zend_Search_Lucene_Exception
methodpublicqueryParsingExceptionsSuppressed( ) : boolean
static

Check 'suppress query parser exceptions' mode.

Returns
Type Description
boolean
methodpublicsetDefaultEncoding( string $encoding ) : void
static

Set query string default encoding

Parameters
Name Type Description
$encoding string
methodpublicsetDefaultOperator( integer $operator ) : void
static

Set default boolean operator

Parameters
Name Type Description
$operator integer
methodpublicsetField( ) : void

Set entry field

methodpublicsetSign( ) : void

Set entry sign

methodpublicsubqueryEnd( ) : void

End subquery

methodpublicsubqueryStart( ) : void

Start subquery

methodpublicsuppressQueryParsingExceptions( ) : void
static

Turn on 'suppress query parser exceptions' mode.

Documentation was generated by DocBlox 0.15.1.