略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: SphinxClient::setFieldWeights

2024-05-05

SphinxClient::setFieldWeights

(PECL sphinx >= 0.1.0)

SphinxClient::setFieldWeightsSet field weights

说明

public SphinxClient::setFieldWeights ( array $weights ) : bool

Binds per-field weights by name.

Match ranking can be affected by per-field weights. See » Sphinx documentation for an explanation on how phrase proximity ranking is affected. This call lets you specify non-default weights for full-text fields.

The weights must be positive 32-bit integers, so be careful not to hit 32-bit integer maximum. The final weight is a 32-bit integer too. Default weight value is 1. Unknown field names are silently ignored.

参数

weights

Associative array of field names and field weights.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

add a note add a note

User Contributed Notes 1 note

up
-2
george dot oslobanu at gmail dot com
5 years ago
although the specs (both php & sphinx manuals) states that field weight should be positive integer, values lower than 1 (0 for example) would not work. Found this on a blog and i hope this will help you ...

官方地址:https://www.php.net/manual/en/sphinxclient.setfieldweights.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3