PHP 클래스 SlightPHP\SphinxClient

파일 보기 프로젝트 열기: hetao29/slightphp

공개 프로퍼티들

프로퍼티 타입 설명
$_anchor < distributed retries delay
$_arrayresult < stored mbstring encoding
$_connerror < last warning message
$_cutoff < max matches to retrieve
$_error < select-list (attributes or expressions, with optional aliases)
$_fieldweights < max query time, milliseconds (default is 0, do not limit)
$_filters < max ID to match (default is 0, which means no limit)
$_groupby < search filters
$_groupdistinct < group-by sorting clause (to sort groups in result set with)
$_groupfunc < group-by attribute name
$_groupsort < group-by function (to pre-process group-by attribute value with)
$_host
$_indexweights < geographical anchor point
$_limit < how many records to seek from result-set start (default is 0)
$_max_id < min ID to match (default is 0, which means no limit)
$_maxmatches < group-by count-distinct attribute
$_maxquerytime < ranking mode (default is SPH_RANK_PROXIMITY_BM25)
$_mbenc < requests array for multi-query
$_min_id < attribute to sort by (defualt is "")
$_mode < how many records to return from result-set starting at offset (default is 20)
$_offset < searchd port (default is 9312)
$_overrides < per-field-name weights
$_port < searchd host (default is "localhost")
$_ranker < per-index weights
$_reqs < connection error vs remote error flag
$_retrycount < cutoff to stop searching at (default is 0)
$_retrydelay < distributed retries count
$_select < per-query attribute values overrides
$_sort < per-field weights (default is 1 for all fields)
$_sortby < match sorting mode (default is SPH_SORT_RELEVANCE)
$_timeout < whether $result["matches"] should be a hash or an array
$_warning < last error message
$_weights < query matching mode (default is SPH_MATCH_ALL)

공개 메소드들

메소드 설명
AddQuery ( $query, $index = "*", $comment = "" ) returns index into results array from RunQueries() call
BuildExcerpts ( $docs, $index, $words, $opts = [] ) an array of snippets on success
BuildKeywords ( $query, $index, $hits ) an array of words on success
Close ( )
EscapeString ( $string )
FlushAttributes ( )
GetLastError ( ) get last error message (string)
GetLastWarning ( ) get last warning message (string)
IsConnectError ( ) get last error flag (to tell network connection errors from searchd errors or broken responses)
Open ( )
Query ( $query, $index = "*", $comment = "" ) and return the search results
ResetFilters ( ) clear all filters (for multi-queries)
ResetGroupBy ( ) clear groupby settings (for multi-queries)
ResetOverrides ( ) clear all attribute value overrides (for multi-queries)
RunQueries ( ) connect to searchd, run queries batch, and return an array of result sets
SetArrayResult ( $arrayresult ) PHP specific; needed for group-by-MVA result sets that may contain duplicate IDs
SetConnectTimeout ( $timeout ) set server connection timeout (0 to remove)
SetFieldWeights ( $weights ) bind per-field weights by name
SetFilter ( $attribute, $values, $exclude = false ) only match records where $attribute value is in given set
SetFilterFloatRange ( $attribute, $min, $max, $exclude = false ) only match records if $attribute value is beetwen $min and $max (inclusive)
SetFilterRange ( $attribute, $min, $max, $exclude = false ) only match records if $attribute value is beetwen $min and $max (inclusive)
SetGeoAnchor ( $attrlat, $attrlong, $lat, $long ) latitude and longitude must be in radians
SetGroupBy ( $attribute, $func, $groupsort = "@group desc" ) set grouping attribute and function
SetGroupDistinct ( $attribute ) set count-distinct attribute for group-by queries
SetIDRange ( $min, $max ) only match records if document ID is beetwen $min and $max (inclusive)
SetIndexWeights ( $weights ) bind per-index weights by name
SetLimits ( $offset, $limit, $max, $cutoff ) and optionally set max-matches and cutoff limits
SetMatchMode ( $mode ) set matching mode
SetMaxQueryTime ( $max ) integer, 0 means "do not limit"
SetOverride ( $attrname, $attrtype, $values ) $values must be a hash that maps document IDs to attribute values
SetRankingMode ( $ranker ) set ranking mode
SetRetries ( $count, $delay ) set distributed retries count and delay
SetSelect ( $select ) set select-list (attributes or expressions), SQL-like syntax
SetServer ( $host, $port ) set searchd host name (string) and port (integer)
SetSortMode ( $mode, $sortby = "" ) set matches sorting mode
SetWeights ( $weights ) DEPRECATED; use SetFieldWeights() instead
Status ( )
UpdateAttributes ( $index, $attrs, $values, $mva = false ) returns amount of updated documents (0 or more) on success, or -1 on failure
_Connect ( ) connect to searchd server
_GetResponse ( $fp, $client_ver ) get and check response packet from searchd server
_MBPop ( ) leave mbstring workaround mode
_MBPush ( ) enter mbstring workaround mode
_PackFloat ( $f ) helper to pack floats in network byte order
_ParseSearchResponse ( $response, $nreqs ) parse and return search query (or queries) response
_Send ( $handle, $data, $length )
__construct ( ) create a new client object and fill defaults
__destruct ( )

메소드 상세

AddQuery() 공개 메소드

returns index into results array from RunQueries() call
public AddQuery ( $query, $index = "*", $comment = "" )

BuildExcerpts() 공개 메소드

an array of snippets on success
public BuildExcerpts ( $docs, $index, $words, $opts = [] )

BuildKeywords() 공개 메소드

an array of words on success
public BuildKeywords ( $query, $index, $hits )

Close() 공개 메소드

public Close ( )

EscapeString() 공개 메소드

public EscapeString ( $string )

FlushAttributes() 공개 메소드

public FlushAttributes ( )

GetLastError() 공개 메소드

get last error message (string)
public GetLastError ( )

GetLastWarning() 공개 메소드

get last warning message (string)
public GetLastWarning ( )

IsConnectError() 공개 메소드

get last error flag (to tell network connection errors from searchd errors or broken responses)
public IsConnectError ( )

Open() 공개 메소드

public Open ( )

Query() 공개 메소드

and return the search results
public Query ( $query, $index = "*", $comment = "" )

ResetFilters() 공개 메소드

clear all filters (for multi-queries)
public ResetFilters ( )

ResetGroupBy() 공개 메소드

clear groupby settings (for multi-queries)
public ResetGroupBy ( )

ResetOverrides() 공개 메소드

clear all attribute value overrides (for multi-queries)
public ResetOverrides ( )

RunQueries() 공개 메소드

connect to searchd, run queries batch, and return an array of result sets
public RunQueries ( )

SetArrayResult() 공개 메소드

PHP specific; needed for group-by-MVA result sets that may contain duplicate IDs
public SetArrayResult ( $arrayresult )

SetConnectTimeout() 공개 메소드

set server connection timeout (0 to remove)
public SetConnectTimeout ( $timeout )

SetFieldWeights() 공개 메소드

bind per-field weights by name
public SetFieldWeights ( $weights )

SetFilter() 공개 메소드

only match records where $attribute value is in given set
public SetFilter ( $attribute, $values, $exclude = false )

SetFilterFloatRange() 공개 메소드

only match records if $attribute value is beetwen $min and $max (inclusive)
public SetFilterFloatRange ( $attribute, $min, $max, $exclude = false )

SetFilterRange() 공개 메소드

only match records if $attribute value is beetwen $min and $max (inclusive)
public SetFilterRange ( $attribute, $min, $max, $exclude = false )

SetGeoAnchor() 공개 메소드

latitude and longitude must be in radians
public SetGeoAnchor ( $attrlat, $attrlong, $lat, $long )

SetGroupBy() 공개 메소드

set grouping attribute and function
public SetGroupBy ( $attribute, $func, $groupsort = "@group desc" )

SetGroupDistinct() 공개 메소드

set count-distinct attribute for group-by queries
public SetGroupDistinct ( $attribute )

SetIDRange() 공개 메소드

only match records if document ID is beetwen $min and $max (inclusive)
public SetIDRange ( $min, $max )

SetIndexWeights() 공개 메소드

bind per-index weights by name
public SetIndexWeights ( $weights )

SetLimits() 공개 메소드

and optionally set max-matches and cutoff limits
public SetLimits ( $offset, $limit, $max, $cutoff )

SetMatchMode() 공개 메소드

set matching mode
public SetMatchMode ( $mode )

SetMaxQueryTime() 공개 메소드

integer, 0 means "do not limit"
public SetMaxQueryTime ( $max )

SetOverride() 공개 메소드

$values must be a hash that maps document IDs to attribute values
public SetOverride ( $attrname, $attrtype, $values )

SetRankingMode() 공개 메소드

set ranking mode
public SetRankingMode ( $ranker )

SetRetries() 공개 메소드

set distributed retries count and delay
public SetRetries ( $count, $delay )

SetSelect() 공개 메소드

set select-list (attributes or expressions), SQL-like syntax
public SetSelect ( $select )

SetServer() 공개 메소드

set searchd host name (string) and port (integer)
public SetServer ( $host, $port )

SetSortMode() 공개 메소드

set matches sorting mode
public SetSortMode ( $mode, $sortby = "" )

SetWeights() 공개 메소드

DEPRECATED; use SetFieldWeights() instead
public SetWeights ( $weights )

Status() 공개 메소드

public Status ( )

UpdateAttributes() 공개 메소드

returns amount of updated documents (0 or more) on success, or -1 on failure
public UpdateAttributes ( $index, $attrs, $values, $mva = false )

_Connect() 공개 메소드

connect to searchd server
public _Connect ( )

_GetResponse() 공개 메소드

get and check response packet from searchd server
public _GetResponse ( $fp, $client_ver )

_MBPop() 공개 메소드

leave mbstring workaround mode
public _MBPop ( )

_MBPush() 공개 메소드

enter mbstring workaround mode
public _MBPush ( )

_PackFloat() 공개 메소드

helper to pack floats in network byte order
public _PackFloat ( $f )

_ParseSearchResponse() 공개 메소드

parse and return search query (or queries) response
public _ParseSearchResponse ( $response, $nreqs )

_Send() 공개 메소드

public _Send ( $handle, $data, $length )

__construct() 공개 메소드

create a new client object and fill defaults
public __construct ( )

__destruct() 공개 메소드

public __destruct ( )

프로퍼티 상세

$_anchor 공개적으로 프로퍼티

< distributed retries delay
public $_anchor

$_arrayresult 공개적으로 프로퍼티

< stored mbstring encoding
public $_arrayresult

$_connerror 공개적으로 프로퍼티

< last warning message
public $_connerror

$_cutoff 공개적으로 프로퍼티

< max matches to retrieve
public $_cutoff

$_error 공개적으로 프로퍼티

< select-list (attributes or expressions, with optional aliases)
public $_error

$_fieldweights 공개적으로 프로퍼티

< max query time, milliseconds (default is 0, do not limit)
public $_fieldweights

$_filters 공개적으로 프로퍼티

< max ID to match (default is 0, which means no limit)
public $_filters

$_groupby 공개적으로 프로퍼티

< search filters
public $_groupby

$_groupdistinct 공개적으로 프로퍼티

< group-by sorting clause (to sort groups in result set with)
public $_groupdistinct

$_groupfunc 공개적으로 프로퍼티

< group-by attribute name
public $_groupfunc

$_groupsort 공개적으로 프로퍼티

< group-by function (to pre-process group-by attribute value with)
public $_groupsort

$_host 공개적으로 프로퍼티

public $_host

$_indexweights 공개적으로 프로퍼티

< geographical anchor point
public $_indexweights

$_limit 공개적으로 프로퍼티

< how many records to seek from result-set start (default is 0)
public $_limit

$_max_id 공개적으로 프로퍼티

< min ID to match (default is 0, which means no limit)
public $_max_id

$_maxmatches 공개적으로 프로퍼티

< group-by count-distinct attribute
public $_maxmatches

$_maxquerytime 공개적으로 프로퍼티

< ranking mode (default is SPH_RANK_PROXIMITY_BM25)
public $_maxquerytime

$_mbenc 공개적으로 프로퍼티

< requests array for multi-query
public $_mbenc

$_min_id 공개적으로 프로퍼티

< attribute to sort by (defualt is "")
public $_min_id

$_mode 공개적으로 프로퍼티

< how many records to return from result-set starting at offset (default is 20)
public $_mode

$_offset 공개적으로 프로퍼티

< searchd port (default is 9312)
public $_offset

$_overrides 공개적으로 프로퍼티

< per-field-name weights
public $_overrides

$_port 공개적으로 프로퍼티

< searchd host (default is "localhost")
public $_port

$_ranker 공개적으로 프로퍼티

< per-index weights
public $_ranker

$_reqs 공개적으로 프로퍼티

< connection error vs remote error flag
public $_reqs

$_retrycount 공개적으로 프로퍼티

< cutoff to stop searching at (default is 0)
public $_retrycount

$_retrydelay 공개적으로 프로퍼티

< distributed retries count
public $_retrydelay

$_select 공개적으로 프로퍼티

< per-query attribute values overrides
public $_select

$_sort 공개적으로 프로퍼티

< per-field weights (default is 1 for all fields)
public $_sort

$_sortby 공개적으로 프로퍼티

< match sorting mode (default is SPH_SORT_RELEVANCE)
public $_sortby

$_timeout 공개적으로 프로퍼티

< whether $result["matches"] should be a hash or an array
public $_timeout

$_warning 공개적으로 프로퍼티

< last error message
public $_warning

$_weights 공개적으로 프로퍼티

< query matching mode (default is SPH_MATCH_ALL)
public $_weights