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.
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

integer
$_defaultOperator= 'self'
Default boolean queries operator
self
Details
\Zend_Search_Lucene_Search_QueryToken
$_lastToken= 'null'
Last token
It can be processed within FSM states, but this addirional state simplifies FSM
null
Details

boolean
$_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.
true
Details
__construct(
)
:
void
Parser constructor
$states is an array of integers or strings with a list of possible machine states constructor treats fist list element as a sturt state (assignes it to $_current state). It may be reassigned by setState() call. States list may be empty and can be extended later by addState() or addStates() calls.
$inputAphabet is the same as $states, but represents input alphabet it also may be extended later by addInputSymbols() or addInputSymbol() calls.
$rules parameter describes FSM transitions and has a structure: array( array(sourseState, input, targetState[, inputAction]), array(sourseState, input, targetState[, inputAction]), array(sourseState, input, targetState[, inputAction]), ... ) Rules also can be added later by addRules() and addRule() calls.
FSM actions are very flexible and may be defined by addEntryAction(), addExitAction(), addInputAction() and addTransitionAction() calls.

_getInstance(
)
:
\Zend_Search_Lucene_Search_QueryParser
Get query parser instance
Type | Description |
---|---|
\Zend_Search_Lucene_Search_QueryParser |

addEntryAction(
integer|string $state, \Zend_Search_Lucene_FSMAction $action
)
:
void
Add state entry action.
Inherited from: \Zend_Search_Lucene_FSM::addEntryAction()Several entry actions are allowed. Action execution order is defined by addEntryAction() calls
Name | Type | Description |
---|---|---|
$state | integer|string | |
$action | \Zend_Search_Lucene_FSMAction |

addExitAction(
integer|string $state, \Zend_Search_Lucene_FSMAction $action
)
:
void
Add state exit action.
Inherited from: \Zend_Search_Lucene_FSM::addExitAction()Several exit actions are allowed. Action execution order is defined by addEntryAction() calls
Name | Type | Description |
---|---|---|
$state | integer|string | |
$action | \Zend_Search_Lucene_FSMAction |

addInputAction(
integer|string $state, $inputSymbol, \Zend_Search_Lucene_FSMAction $action
)
:
void
Add input action (defined by {state, input} pair).
Inherited from: \Zend_Search_Lucene_FSM::addInputAction()Several input actions are allowed. Action execution order is defined by addInputAction() calls
Name | Type | Description |
---|---|---|
$state | integer|string | |
$inputSymbol | ||
$action | \Zend_Search_Lucene_FSMAction |

addInputSymbol(
integer|string $inputSymbol
)
:
void
Add symbol to the input alphabet
Inherited from: \Zend_Search_Lucene_FSM::addInputSymbol()Name | Type | Description |
---|---|---|
$inputSymbol | integer|string |

addInputSymbols(
array $inputAphabet
)
:
void
Add symbols to the input alphabet
Inherited from: \Zend_Search_Lucene_FSM::addInputSymbols()Name | Type | Description |
---|---|---|
$inputAphabet | array |

addRule(
integer|string $sourceState, integer|string $input, integer|string $targetState, \Zend_Search_Lucene_FSMAction|null $inputAction
=
null
)
:
void
Add symbol to the input alphabet
Inherited from: \Zend_Search_Lucene_FSM::addRule()Name | Type | Description |
---|---|---|
$sourceState | integer|string | |
$input | integer|string | |
$targetState | integer|string | |
$inputAction | \Zend_Search_Lucene_FSMAction|null |
Exception | Description |
---|---|
\Zend_Search_Exception |

addRules(
array $rules
)
:
void
Add transition rules
Inherited from: \Zend_Search_Lucene_FSM::addRules()array structure: array( array(sourseState, input, targetState[, inputAction]), array(sourseState, input, targetState[, inputAction]), array(sourseState, input, targetState[, inputAction]), ... )
Name | Type | Description |
---|---|---|
$rules | array |

addState(
integer|string $state
)
:
void
Add state to the state machine
Inherited from: \Zend_Search_Lucene_FSM::addState()Name | Type | Description |
---|---|---|
$state | integer|string |

addStates(
array $states
)
:
void
Add states to the state machine
Inherited from: \Zend_Search_Lucene_FSM::addStates()Name | Type | Description |
---|---|---|
$states | array |

addTransitionAction(
integer|string $sourceState, integer|string $targetState, \Zend_Search_Lucene_FSMAction $action
)
:
void
Add transition action (defined by {state, input} pair).
Inherited from: \Zend_Search_Lucene_FSM::addTransitionAction()Several transition actions are allowed. Action execution order is defined by addTransitionAction() calls
Name | Type | Description |
---|---|---|
$sourceState | integer|string | |
$targetState | integer|string | |
$action | \Zend_Search_Lucene_FSMAction |

closedRQLastTerm(
)
:
void
Process last range query term (closed interval)
Exception | Description |
---|---|
\Zend_Search_Lucene_Search_QueryParserException |

dontSuppressQueryParsingExceptions(
)
:
void
Turn off 'suppress query parser exceptions' mode.

escape(
string $keyword
)
:
string
Escape keyword to force it to be parsed as one term
Name | Type | Description |
---|---|---|
$keyword | string |
Type | Description |
---|---|
string |

getDefaultEncoding(
)
:
string
Get query string default encoding
Type | Description |
---|---|
string |

getState(
)
:
integer|string
Get FSM state.
Inherited from: \Zend_Search_Lucene_FSM::getState()Type | Description |
---|---|
integerstring | $state|null |

openedRQLastTerm(
)
:
void
Process last range query term (opened interval)
Exception | Description |
---|---|
\Zend_Search_Lucene_Search_QueryParserException |

parse(
string $strQuery, string $encoding
=
null
)
:
\Zend_Search_Lucene_Search_Query
Parses a query string
Name | Type | Description |
---|---|---|
$strQuery | string | |
$encoding | string |
Type | Description |
---|---|
\Zend_Search_Lucene_Search_Query |
Exception | Description |
---|---|
\Zend_Search_Lucene_Search_QueryParserException |

processModifierParameter(
)
:
void
Process modifier parameter
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |

queryParsingExceptionsSuppressed(
)
:
boolean
Check 'suppress query parser exceptions' mode.
Type | Description |
---|---|
boolean |

setDefaultEncoding(
string $encoding
)
:
void
Set query string default encoding
Name | Type | Description |
---|---|---|
$encoding | string |

setDefaultOperator(
integer $operator
)
:
void
Set default boolean operator
Name | Type | Description |
---|---|---|
$operator | integer |

setState(
integer|string $state
)
:
void
Set FSM state.
Inherited from: \Zend_Search_Lucene_FSM::setState()No any action is invoked
Name | Type | Description |
---|---|---|
$state | integer|string |
Exception | Description |
---|---|
\Zend_Search_Exception |