| @@ 214-244 (lines=31) @@ | ||
| 211 | * |
|
| 212 | * @param Zend_Search_Lucene $reader |
|
| 213 | */ |
|
| 214 | private function _calculateConjunctionResult($reader) |
|
| 215 | { |
|
| 216 | if (extension_loaded('bitset')) { |
|
| 217 | foreach( $this->_terms as $termId=>$term ) { |
|
| 218 | if($this->_resVector === null) { |
|
| 219 | $this->_resVector = bitset_from_array($reader->termDocs($term)); |
|
| 220 | } else { |
|
| 221 | $this->_resVector = bitset_intersection( |
|
| 222 | $this->_resVector, |
|
| 223 | bitset_from_array($reader->termDocs($term)) ); |
|
| 224 | } |
|
| 225 | ||
| 226 | $this->_termsPositions[$termId] = $reader->termPositions($term); |
|
| 227 | } |
|
| 228 | } else { |
|
| 229 | foreach( $this->_terms as $termId=>$term ) { |
|
| 230 | if($this->_resVector === null) { |
|
| 231 | $this->_resVector = array_flip($reader->termDocs($term)); |
|
| 232 | } else { |
|
| 233 | $termDocs = array_flip($reader->termDocs($term)); |
|
| 234 | foreach($this->_resVector as $key=>$value) { |
|
| 235 | if (!isset( $termDocs[$key] )) { |
|
| 236 | unset( $this->_resVector[$key] ); |
|
| 237 | } |
|
| 238 | } |
|
| 239 | } |
|
| 240 | ||
| 241 | $this->_termsPositions[$termId] = $reader->termPositions($term); |
|
| 242 | } |
|
| 243 | } |
|
| 244 | } |
|
| 245 | ||
| 246 | ||
| 247 | /** |
|
| @@ 224-254 (lines=31) @@ | ||
| 221 | * |
|
| 222 | * @param Zend_Search_Lucene $reader |
|
| 223 | */ |
|
| 224 | private function _calculateResult($reader) |
|
| 225 | { |
|
| 226 | if (extension_loaded('bitset')) { |
|
| 227 | foreach( $this->_terms as $termId=>$term ) { |
|
| 228 | if($this->_resVector === null) { |
|
| 229 | $this->_resVector = bitset_from_array($reader->termDocs($term)); |
|
| 230 | } else { |
|
| 231 | $this->_resVector = bitset_intersection( |
|
| 232 | $this->_resVector, |
|
| 233 | bitset_from_array($reader->termDocs($term)) ); |
|
| 234 | } |
|
| 235 | ||
| 236 | $this->_termsPositions[$termId] = $reader->termPositions($term); |
|
| 237 | } |
|
| 238 | } else { |
|
| 239 | foreach( $this->_terms as $termId=>$term ) { |
|
| 240 | if($this->_resVector === null) { |
|
| 241 | $this->_resVector = array_flip($reader->termDocs($term)); |
|
| 242 | } else { |
|
| 243 | $termDocs = array_flip($reader->termDocs($term)); |
|
| 244 | foreach($this->_resVector as $key=>$value) { |
|
| 245 | if (!isset( $termDocs[$key] )) { |
|
| 246 | unset( $this->_resVector[$key] ); |
|
| 247 | } |
|
| 248 | } |
|
| 249 | } |
|
| 250 | ||
| 251 | $this->_termsPositions[$termId] = $reader->termPositions($term); |
|
| 252 | } |
|
| 253 | } |
|
| 254 | } |
|
| 255 | ||
| 256 | ||
| 257 | /** |
|