本文整理汇总了PHP中bitset_empty函数的典型用法代码示例。如果您正苦于以下问题:PHP bitset_empty函数的具体用法?PHP bitset_empty怎么用?PHP bitset_empty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bitset_empty函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Deletes a document from the index segment.
* $id is an internal document id
*
* @param integer
*/
public function delete($id)
{
$this->_deletedDirty = true;
if (extension_loaded('bitset')) {
if ($this->_deleted === null) {
$this->_deleted = bitset_empty($id);
}
bitset_incl($this->_deleted, $id);
} else {
if ($this->_deleted === null) {
$this->_deleted = array();
}
$this->_deleted[$id] = 1;
}
}
示例2: _calculateNonConjunctionResult
/**
* Calculate result vector for non Conjunction query
* (like '+something -another')
*
* @param Zend_Search_Lucene $reader
*/
private function _calculateNonConjunctionResult($reader)
{
if (extension_loaded('bitset')) {
$required = null;
$neither = bitset_empty();
$prohibited = bitset_empty();
foreach ($this->_terms as $termId => $term) {
$termDocs = bitset_from_array($reader->termDocs($term));
if ($this->_signs[$termId] === true) {
// required
if ($required !== null) {
$required = bitset_intersection($required, $termDocs);
} else {
$required = $termDocs;
}
} elseif ($this->_signs[$termId] === false) {
// prohibited
$prohibited = bitset_union($prohibited, $termDocs);
} else {
// neither required, nor prohibited
$neither = bitset_union($neither, $termDocs);
}
$this->_termsPositions[$termId] = $reader->termPositions($term);
}
if ($required === null) {
$required = $neither;
}
$this->_resVector = bitset_intersection($required, bitset_invert($prohibited, $reader->count()));
} else {
$required = null;
$neither = array();
$prohibited = array();
foreach ($this->_terms as $termId => $term) {
$termDocs = array_flip($reader->termDocs($term));
if ($this->_signs[$termId] === true) {
// required
if ($required !== null) {
// substitute for bitset_intersection
foreach ($required as $key => $value) {
if (!isset($termDocs[$key])) {
unset($required[$key]);
}
}
} else {
$required = $termDocs;
}
} elseif ($this->_signs[$termId] === false) {
// prohibited
// substitute for bitset_union
foreach ($termDocs as $key => $value) {
$prohibited[$key] = $value;
}
} else {
// neither required, nor prohibited
// substitute for bitset_union
foreach ($termDocs as $key => $value) {
$neither[$key] = $value;
}
}
$this->_termsPositions[$termId] = $reader->termPositions($term);
}
if ($required === null) {
$required = $neither;
}
foreach ($required as $key => $value) {
if (isset($prohibited[$key])) {
unset($required[$key]);
}
}
$this->_resVector = $required;
}
}