本文整理汇总了PHP中bitset_in函数的典型用法代码示例。如果您正苦于以下问题:PHP bitset_in函数的具体用法?PHP bitset_in怎么用?PHP bitset_in使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bitset_in函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isDeleted
/**
* Checks, that document is deleted
*
* @param integer
* @return boolean
*/
public function isDeleted($id)
{
if ($this->_deleted === null) {
return false;
}
if (extension_loaded('bitset')) {
return bitset_in($this->_deleted, $id);
} else {
return isset($this->_deleted[$id]);
}
}
示例2: score
/**
* Score specified document
*
* @param integer $docId
* @param Zend_Search_Lucene $reader
* @return float
*/
public function score($docId, $reader)
{
if ($this->_docVector === null) {
if (extension_loaded('bitset')) {
$this->_docVector = bitset_from_array($reader->termDocs($this->_term));
} else {
$this->_docVector = array_flip($reader->termDocs($this->_term));
}
$this->_termPositions = $reader->termPositions($this->_term);
$this->_initWeight($reader);
}
$match = extension_loaded('bitset') ? bitset_in($this->_docVector, $docId) : isset($this->_docVector[$docId]);
if ($this->_sign && $match) {
return $reader->getSimilarity()->tf(count($this->_termPositions[$docId])) * $this->_weight->getValue() * $reader->norm($docId, $this->_term->field);
} else {
return 0;
}
}
示例3: score
/**
* Score specified document
*
* @param integer $docId
* @param ZSearch $reader
* @return float
*/
public function score($docId, $reader)
{
// optimize zero-term case
if (count($this->_terms) == 0) {
return 0;
}
if ($this->_resVector === null) {
$this->_calculateResult($reader);
$this->_initWeight($reader);
}
if (extension_loaded('bitset') ? bitset_in($this->_resVector, $docId) : isset($this->_resVector[$docId])) {
if ($this->_slop == 0) {
$freq = $this->_exactPhraseFreq($docId);
} else {
$freq = $this->_sloppyPhraseFreq($docId, $reader);
}
/*
return $reader->getSimilarity()->tf($freq) *
$this->_weight->getValue() *
$reader->norm($docId, reset($this->_terms)->field);
*/
if ($freq != 0) {
$tf = $reader->getSimilarity()->tf($freq);
$weight = $this->_weight->getValue();
$norm = $reader->norm($docId, reset($this->_terms)->field);
return $tf * $weight * $norm;
}
} else {
return 0;
}
}
示例4: score
/**
* Score specified document
*
* @param integer $docId
* @param Zend_Search_Lucene $reader
* @return float
*/
public function score($docId, $reader)
{
if ($this->_resVector === null) {
if ($this->_signs === null) {
$this->_calculateConjunctionResult($reader);
} else {
$this->_calculateNonConjunctionResult($reader);
}
$this->_initWeight($reader);
}
if (extension_loaded('bitset') ? bitset_in($this->_resVector, $docId) : isset($this->_resVector[$docId])) {
if ($this->_signs === null) {
return $this->_conjunctionScore($docId, $reader);
} else {
return $this->_nonConjunctionScore($docId, $reader);
}
} else {
return 0;
}
}