Свойство | Type | Description | |
---|---|---|---|
$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) | ||
$maxid | min ID to match (default is 0, which means no limit) | ||
$maxmatches | group-by count-distinct attribute | ||
$maxquerytime | ranking mode expression (for SPH_RANK_EXPR) | ||
$mbenc | requests array for multi-query | ||
$minid | attribute to sort by (default is "") | ||
$mode | how many records to return from result-set starting at offset (default is 20) | ||
$offset | socket connection | ||
$overrides | per-field-name weights | ||
$path | searchd port (default is 9312) | ||
$port | searchd host (default is "localhost") | ||
$ranker | per-index weights | ||
$rankexpr | ranking mode (default is SPH_RANK_PROXIMITY_BM25) | ||
$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 | ||
$socket | socket path | ||
$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) |
Méthode | Description | |
---|---|---|
__construct ( ) | Create a new client object and fill defaults | |
__destruct ( ) | Close the socket upon exit | |
addQuery ( string $query, string $index = '*', string $comment = '' ) : integer | Add a query to a multi-query batch. Returns index into results array from runQueries() call | |
buildExcerpts ( array $docs, string $index, string $words, array $opts = [] ) : array | false | Connect to searchd and generate excerpts (snippets) from given documents for a given query | |
buildKeywords ( string $query, string $index, boolean $hits ) : array | false | Extracts keywords from query using tokenizer settings for a given index | |
close ( ) : boolean | Close a persistent connection | |
create ( ) : |
Creates a SphinxClient object. Chainable | |
escapeString ( string $string ) : string | Escapes characters that are treated as special operators by the query language parser | |
fixUint ( integer $value ) : integer | Fix broken unsigned int | |
flushAttributes ( ) : integer | Forces searchd to flush pending attribute updates to disk, and blocks until completion | |
getLastError ( ) : string | Get last error message | |
getLastWarning ( ) : string | Get last warning message | |
isConnectError ( ) : boolean | Get last error flag, to tell network connection errors from searchd errors or broken responses | |
open ( ) : boolean | Open a persistent connection | |
packI64 ( integer | string $v ) : string | Pack 64-bit signed | |
packU64 ( integer | string $v ) : string | Pack 64-bit unsigned | |
query ( string $query, string $index = '*', string $comment = '' ) : array | false | Connect to searchd server, run given search query through given indexes, and return the 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 ( ) : array | Connect to searchd, run batch queries, and return an array of results | |
setArrayResult ( boolean $arrayresult ) : |
Set resultset format to either hash or array; hash is the default format | |
setConnectTimeout ( integer $timeout ) : |
Set server connection timeout | |
setFieldWeights ( array $weights ) : |
Bind per-field weights by name | |
setFilter ( string $attribute, array $values, boolean $exclude = false ) : |
Set values filter; only match records where $attribute value is in (or not in) the given set | |
setFilterFloatRange ( string $attribute, float $min, float $max, boolean $exclude = false ) : |
Set float range filter; only match records if $attribute value between $min and $max (inclusive) | |
setFilterRange ( string $attribute, integer $min, integer $max, boolean $exclude = false ) : |
Set range filter; only match records if $attribute value between $min and $max (inclusive) | |
setGeoAnchor ( string $attrlat, string $attrlong, float $lat, float $long ) : |
Set up anchor point for geosphere distance calculations. Required to use @geodist in filters and sorting | |
setGroupBy ( string $attribute, integer $func, string $groupsort = '@group desc' ) : |
Set grouping attribute and function | |
setGroupDistinct ( string $attribute ) : |
Set count-distinct attribute for group-by queries | |
setIdRange ( integer $min, integer $max ) : |
Limit the ID range; only match records if document ID is between $min and $max (inclusive) | |
setIndexWeights ( array $weights ) : |
Bind per-index weights by name | |
setLimits ( integer $offset, integer $limit, integer $max, integer $cutoff ) : |
Set offset and count into result set, optionally set max-matches and cutoff limits | |
setMatchMode ( integer $mode ) : |
Set matching mode | |
setMaxQueryTime ( integer $max ) : |
Set maximum query time, in milliseconds, per-index. 0 means "do not limit" | |
setOverride ( string $attrname, integer $attrtype, array $values ) : |
Set attribute values override. Only one override per attribute | |
setRankingMode ( integer $ranker, string $rankexpr = '' ) : |
Set ranking mode | |
setRetries ( integer $count, integer $delay ) : |
Set distributed retries count and delay | |
setSelect ( string $select ) : |
Set select-list (attributes or expressions), SQL-like syntax | |
setServer ( string $host, integer $port ) : |
Set searchd host name and port | |
setSortMode ( integer $mode, string $sortby = '' ) : |
Set matches sorting mode | |
setWeights ( array $weights ) : |
Bind per-field weights by order | |
status ( ) : array | false | Queries searchd status | |
unpackI64 ( string $v ) : integer | string | Unpack 64-bit signed | |
unpackU64 ( string $v ) : integer | string | Unpack 64-bit unsigned | |
updateAttributes ( string $index, array $attrs, array $values, boolean $mva = false ) : integer | Batch update given attributes in given documents |
Méthode | Description | |
---|---|---|
connect ( ) : resource | false | Connect to searchd server | |
getResponse ( resource $fp, string $clientVer ) : string | false | Get and check response packet from searchd server | |
mbPop ( ) | Leave mbstring workaround mode | |
mbPush ( ) | Enter mbstring workaround mode, when function overloading is enabled | |
packFloat ( float $float ) : string | Helper to pack floats in network byte order | |
parseSearchResponse ( string $response, integer $nreqs ) : array | Parse and return search query (or queries) response | |
send ( resource $handle, string $data, integer $length ) : boolean | Write message to socket |
public buildExcerpts ( array $docs, string $index, string $words, array $opts = [] ) : array | false | ||
$docs | array | array of strings that carry the document contents |
$index | string | name of the index |
$words | string | string that contains the keywords to highlight |
$opts | array | hash which contains additional optional highlighting parameters |
Résultat | array | false | Array of snippets, or false on failure. |
public buildKeywords ( string $query, string $index, boolean $hits ) : array | false | ||
$query | string | query to extract keywords from |
$index | string | name of the index to get tokenizing settings and keyword occurrence statistics from |
$hits | boolean | whether keyword occurrence statistics are required |
Résultat | array | false | Array of hashes with per-keyword information, or false on failure. |
public static create ( ) : |
||
Résultat |
public escapeString ( string $string ) : string | ||
$string | string | unescaped string |
Résultat | string | Escaped string. |
public flushAttributes ( ) : integer | ||
Résultat | integer | Flush tag, -1 on error. |
public getLastError ( ) : string | ||
Résultat | string |
public getLastWarning ( ) : string | ||
Résultat | string |
public isConnectError ( ) : boolean | ||
Résultat | boolean |
public resetFilters ( ) : |
||
Résultat |
public resetGroupBy ( ) : |
||
Résultat |
public resetOverrides ( ) : |
||
Résultat |
public runQueries ( ) : array | ||
Résultat | array | Result array. |
public setArrayResult ( boolean $arrayresult ) : |
||
$arrayresult | boolean | whether to return results as array keyed by ID |
Résultat |
public setConnectTimeout ( integer $timeout ) : |
||
$timeout | integer | |
Résultat |
public setFieldWeights ( array $weights ) : |
||
$weights | array | |
Résultat |
public setFilterFloatRange ( string $attribute, float $min, float $max, boolean $exclude = false ) : |
||
$attribute | string | attribute name |
$min | float | minimum attribute value |
$max | float | maximum attribute value |
$exclude | boolean | whether the filter is exclusive or inclusive |
Résultat |
public setFilterRange ( string $attribute, integer $min, integer $max, boolean $exclude = false ) : |
||
$attribute | string | attribute name |
$min | integer | minimum attribute value |
$max | integer | maximum attribute value |
$exclude | boolean | whether the filter is exclusive or inclusive |
Résultat |
public setGroupDistinct ( string $attribute ) : |
||
$attribute | string | attribute name |
Résultat |
public setIdRange ( integer $min, integer $max ) : |
||
$min | integer | minimum document ID |
$max | integer | maximum document ID |
Résultat |
public setIndexWeights ( array $weights ) : |
||
$weights | array | |
Résultat |
public setMatchMode ( integer $mode ) : |
||
$mode | integer | |
Résultat |
public setMaxQueryTime ( integer $max ) : |
||
$max | integer | |
Résultat |
public setRankingMode ( integer $ranker, string $rankexpr = '' ) : |
||
$ranker | integer | |
$rankexpr | string | |
Résultat |
public setRetries ( integer $count, integer $delay ) : |
||
$count | integer | |
$delay | integer | |
Résultat |
public setSortMode ( integer $mode, string $sortby = '' ) : |
||
$mode | integer | |
$sortby | string | |
Résultat |
public setWeights ( array $weights ) : |
||
$weights | array | |
Résultat |
public updateAttributes ( string $index, array $attrs, array $values, boolean $mva = false ) : integer | ||
$index | string | search index |
$attrs | array | array of attribute names |
$values | array | hash of arrays of new attribute values keyed by document ID |
$mva | boolean | whether to treat attributes as MVAs |
Résultat | integer | Amount of updated documents (0 or more) on success, -1 on failure |
public $error |
public $fieldweights |
public $groupdistinct |
public $groupsort |
public $limit |
public $mode |