API Documentation

Search/Lucene/Search/Query/Fuzzy.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Search_Lucene
subpackage
Search
version
$Id: Fuzzy.php 20096 2010-01-06 02:05:09Z bkarwin $
Classes
Zend_Search_Lucene_Search_Query_Fuzzy

Description

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.

Zend_Search_Lucene_Search_Query_Fuzzy

Extends from
Zend_Search_Lucene_Search_Query
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Search_Lucene
subpackage
Search
Constants
DEFAULT_MIN_SIMILARITY
MAX_CLAUSE_COUNT
Properties
$_maxDistances
$_term
$_minimumSimilarity
$_prefixLength
$_matches
$_scores
$_termKeys
$_defaultPrefixLength
Methods
__construct
getDefaultPrefixLength
setDefaultPrefixLength
_calculateMaxDistance
rewrite
optimize
getQueryTerms
createWeight
execute
matchedDocs
score
_highlightMatches
__toString

Description

Constants

DEFAULT_MIN_SIMILARITY

 DEFAULT_MIN_SIMILARITY = '0.5'

Default minimum similarity

Details

value
0.5

MAX_CLAUSE_COUNT

 MAX_CLAUSE_COUNT = '1024'

Maximum number of matched terms.

Apache Lucene defines this limitation as boolean query maximum number of clauses: org.apache.lucene.search.BooleanQuery.getMaxClauseCount()

Details

value
1024

Properties

$_defaultPrefixLength

integer $_defaultPrefixLength = '3'

Default non-fuzzy prefix length

Details

$_defaultPrefixLength
integer
visibility
private
default
3
final
false
static
true

$_matches

array $_matches = 'null'

Matched terms.

Matched terms list. It's filled during the search (rewrite operation) and may be used for search result post-processing

Array of Zend_Search_Lucene_Index_Term objects

Details

$_matches
array
visibility
private
default
null
final
false
static
false

$_maxDistances

 $_maxDistances = 'array'

Array of precalculated max distances

keys are integers representing a word size

Details

visibility
private
default
array
final
false
static
false

$_minimumSimilarity

float $_minimumSimilarity = ''

A value between 0 and 1 to set the required similarity between the query term and the matching terms. For example, for a _minimumSimilarity of 0.5 a term of the same length as the query term is considered similar to the query term if the edit distance between both terms is less than length(term)*0.5

Details

$_minimumSimilarity
float
visibility
private
default
final
false
static
false

$_prefixLength

integer $_prefixLength = ''

The length of common (non-fuzzy) prefix

Details

$_prefixLength
integer
visibility
private
default
final
false
static
false

$_scores

array $_scores = 'null'

Matched terms scores

Details

$_scores
array
visibility
private
default
null
final
false
static
false

$_term

Zend_Search_Lucene_Index_Term $_term = ''

Base searching term.

Details

$_term
Zend_Search_Lucene_Index_Term
visibility
private
default
final
false
static
false

$_termKeys

array $_termKeys = 'null'

Array of the term keys.

Used to sort terms in alphabetical order if terms have the same socres

Details

$_termKeys
array
visibility
private
default
null
final
false
static
false

Methods

__construct

__construct( Zend_Search_Lucene_Index_Term $term, float $minimumSimilarity = self, integer $prefixLength = null ) :

Zend_Search_Lucene_Search_Query_Wildcard constructor.

Arguments
$term
Zend_Search_Lucene_Index_Term
$minimumSimilarity
float
$prefixLength
integer
Details
visibility
public
final
false
static
false
throws

__toString

__toString( ) : string

Print a query

Output
string
Details
visibility
public
final
false
static
false

_calculateMaxDistance

_calculateMaxDistance( integer $prefixLength, integer $termLength, integer $length ) : integer

Calculate maximum distance for specified word length

Arguments
$prefixLength
integer
$termLength
integer
$length
integer
Output
integer
Details
visibility
private
final
false
static
false

_highlightMatches

_highlightMatches( Zend_Search_Lucene_Search_Highlighter_Interface $highlighter ) :

Query specific matches highlighting

Arguments
$highlighter
Zend_Search_Lucene_Search_Highlighter_Interface
Highlighter object (also contains doc for highlighting)
Details
visibility
protected
final
false
static
false

createWeight

createWeight( Zend_Search_Lucene_Interface $reader ) : Zend_Search_Lucene_Search_Weight

Constructs an appropriate Weight implementation for this query.

Arguments
$reader
Zend_Search_Lucene_Interface
Details
visibility
public
final
false
static
false
throws

execute

execute( Zend_Search_Lucene_Interface $reader, Zend_Search_Lucene_Index_DocsFilter|null $docsFilter = null ) :

Execute query in context of index reader It also initializes necessary internal structures

Arguments
$reader
Zend_Search_Lucene_Interface
$docsFilter
Zend_Search_Lucene_Index_DocsFilternull
Details
visibility
public
final
false
static
false
throws

getDefaultPrefixLength

getDefaultPrefixLength( ) : integer

Get default non-fuzzy prefix length

Output
integer
Details
visibility
public
final
false
static
true

getQueryTerms

getQueryTerms( ) : array

Return query terms

Output
array
Details
visibility
public
final
false
static
false
throws

matchedDocs

matchedDocs( ) : array

Get document ids likely matching the query

It's an array with document ids as keys (performance considerations)

Output
array
Details
visibility
public
final
false
static
false
throws

optimize

optimize( Zend_Search_Lucene_Interface $index ) : Zend_Search_Lucene_Search_Query

Optimize query in the context of specified index

Arguments
$index
Zend_Search_Lucene_Interface
Details
visibility
public
final
false
static
false

rewrite

rewrite( Zend_Search_Lucene_Interface $index ) : Zend_Search_Lucene_Search_Query

Re-write query into primitive queries in the context of specified index

Arguments
$index
Zend_Search_Lucene_Interface
Details
visibility
public
final
false
static
false
throws

score

score( integer $docId, Zend_Search_Lucene_Interface $reader ) : float

Score specified document

Arguments
$docId
integer
$reader
Zend_Search_Lucene_Interface
Output
float
Details
visibility
public
final
false
static
false
throws

setDefaultPrefixLength

setDefaultPrefixLength( integer $defaultPrefixLength ) :

Set default non-fuzzy prefix length

Arguments
$defaultPrefixLength
integer
Details
visibility
public
final
false
static
true
Documentation was generated by DocBlox.