Search/Lucene/Search/QueryParser.php

Show: PublicProtectedPrivateinherited
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-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Search_Lucene  
Subpackage
Search  
Version
$Id$  

\Zend_Search_Lucene_Search_QueryParser

Package: Zend_Search_Lucene\Search
Abstract Finite State Machine
Take a look on Wikipedia state machine description: http://en.wikipedia.org/wiki/Finite_state_machine Any type of Transducers (Moore machine or Mealy machine) also may be implemented by using this abstract FSM. process() methods invokes a specified actions which may construct FSM output. Actions may be also used to signal, that we have reached Accept State
Parent(s)
\Zend_Search_Lucene_FSM
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

>VConstant  B_OR = 0
Boolean operators constants
>VConstant  B_AND = 1
>VConstant  ST_COMMON_QUERY_ELEMENT = 0
Query parser State Machine states
>VConstant  ST_CLOSEDINT_RQ_START = 1
>VConstant  ST_CLOSEDINT_RQ_FIRST_TERM = 2
>VConstant  ST_CLOSEDINT_RQ_TO_TERM = 3
>VConstant  ST_CLOSEDINT_RQ_LAST_TERM = 4
>VConstant  ST_CLOSEDINT_RQ_END = 5
>VConstant  ST_OPENEDINT_RQ_START = 6
>VConstant  ST_OPENEDINT_RQ_FIRST_TERM = 7
>VConstant  ST_OPENEDINT_RQ_TO_TERM = 8
>VConstant  ST_OPENEDINT_RQ_LAST_TERM = 9
>VConstant  ST_OPENEDINT_RQ_END = 10

Properties

>VPropertyprivate\Zend_Search_Lucene_Search_QueryParserContext $_context
Current query parser context
>VPropertyprivatearray $_contextStack
Context stack
Details
Type
array
>VPropertyprivateinteger|string $_currentToken
Current token
Details
Type
integer | string
>VPropertyprivatestring $_defaultEncoding = ''
Query string default encoding
Default value''Details
Type
string
>VPropertyprivateinteger $_defaultOperator = self::B_OR
Default boolean queries operator
Default valueself::B_ORDetails
Type
integer
>VPropertyprivatestring $_encoding
Query string encoding
Details
Type
string
>VPropertyprivate\Zend_Search_Lucene_Search_QueryParser $_instance = null
static
Parser instance
Default valuenullDetails
Type
\Zend_Search_Lucene_Search_QueryParser
>VPropertyprivate\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
>VPropertyprivate\Zend_Search_Lucene_Search_QueryLexer $_lexer
Query lexer
>VPropertyprivatestring $_rqFirstTerm = null
Range query first term
Default valuenullDetails
Type
string
>VPropertyprivateboolean $_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
>VPropertyprivatearray $_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

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
NameTypeDescription
$keywordstring
Returns
TypeDescription
string
methodpublicgetDefaultEncoding() : string
static

Get query string default encoding

Returns
TypeDescription
string
methodpublicgetDefaultOperator() : integer
static

Get default boolean operator

Returns
TypeDescription
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
NameTypeDescription
$strQuerystring
$encodingstring
Returns
TypeDescription
\Zend_Search_Lucene_Search_Query
Throws
ExceptionDescription
\Zend_Search_Lucene_Search_QueryParserException
methodpublicprocessFuzzyProximityModifier() : void

Process fuzzy search/proximity modifier - '~'

methodpublicprocessModifierParameter() : void

Process modifier parameter

Throws
ExceptionDescription
\Zend_Search_Lucene_Exception
methodpublicqueryParsingExceptionsSuppressed() : boolean
static

Check 'suppress query parser exceptions' mode.

Returns
TypeDescription
boolean
methodpublicsetDefaultEncoding(string $encoding) : void
static

Set query string default encoding

Parameters
NameTypeDescription
$encodingstring
methodpublicsetDefaultOperator(integer $operator) : void
static

Set default boolean operator

Parameters
NameTypeDescription
$operatorinteger
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 phpDocumentor 2.2.0 .