|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Zend Framework |
|
4
|
|
|
* |
|
5
|
|
|
* LICENSE |
|
6
|
|
|
* |
|
7
|
|
|
* This source file is subject to the new BSD license that is bundled |
|
8
|
|
|
* with this package in the file LICENSE.txt. |
|
9
|
|
|
* It is also available through the world-wide-web at this URL: |
|
10
|
|
|
* http://framework.zend.com/license/new-bsd |
|
11
|
|
|
* If you did not receive a copy of the license and are unable to |
|
12
|
|
|
* obtain it through the world-wide-web, please send an email |
|
13
|
|
|
* to [email protected] so we can send you a copy immediately. |
|
14
|
|
|
* |
|
15
|
|
|
* @category Zend |
|
16
|
|
|
* @package Zend_Search_Lucene |
|
17
|
|
|
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
|
18
|
|
|
* @license http://framework.zend.com/license/new-bsd New BSD License |
|
19
|
|
|
* @version $Id: MultiSearcher.php 24862 2012-06-02 00:04:53Z adamlundrigan $ |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
|
|
23
|
|
|
/** Zend_Search_Lucene_Interface */ |
|
24
|
|
|
require_once 'Zend/Search/Lucene/Interface.php'; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Import Zend_Search_Lucene_Interface_MultiSearcher for BC (see ZF-12067) |
|
28
|
|
|
* @see Zend_Search_Lucene_Interface_MultiSearcher |
|
29
|
|
|
*/ |
|
30
|
|
|
require_once 'Zend/Search/Lucene/Interface/MultiSearcher.php'; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Multisearcher allows to search through several independent indexes. |
|
34
|
|
|
* |
|
35
|
|
|
* @category Zend |
|
36
|
|
|
* @package Zend_Search_Lucene |
|
37
|
|
|
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
|
38
|
|
|
* @license http://framework.zend.com/license/new-bsd New BSD License |
|
39
|
|
|
*/ |
|
40
|
|
|
class Zend_Search_Lucene_MultiSearcher implements Zend_Search_Lucene_Interface |
|
41
|
|
|
{ |
|
42
|
|
|
/** |
|
43
|
|
|
* List of indices for searching. |
|
44
|
|
|
* Array of Zend_Search_Lucene_Interface objects |
|
45
|
|
|
* |
|
46
|
|
|
* @var array |
|
47
|
|
|
*/ |
|
48
|
|
|
protected $_indices; |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Object constructor. |
|
52
|
|
|
* |
|
53
|
|
|
* @param array $indices Arrays of indices for search |
|
54
|
|
|
* @throws Zend_Search_Lucene_Exception |
|
55
|
|
|
*/ |
|
56
|
|
|
public function __construct($indices = array()) |
|
57
|
|
|
{ |
|
58
|
|
|
$this->_indices = $indices; |
|
59
|
|
|
|
|
60
|
|
|
foreach ($this->_indices as $index) { |
|
61
|
|
|
if (!$index instanceof Zend_Search_Lucene_Interface) { |
|
62
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
63
|
|
|
throw new Zend_Search_Lucene_Exception('sub-index objects have to implement Zend_Search_Lucene_Interface.'); |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* Add index for searching. |
|
70
|
|
|
* |
|
71
|
|
|
* @param Zend_Search_Lucene_Interface $index |
|
72
|
|
|
*/ |
|
73
|
|
|
public function addIndex(Zend_Search_Lucene_Interface $index) |
|
74
|
|
|
{ |
|
75
|
|
|
$this->_indices[] = $index; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* Get current generation number |
|
81
|
|
|
* |
|
82
|
|
|
* Returns generation number |
|
83
|
|
|
* 0 means pre-2.1 index format |
|
84
|
|
|
* -1 means there are no segments files. |
|
85
|
|
|
* |
|
86
|
|
|
* @param Zend_Search_Lucene_Storage_Directory $directory |
|
87
|
|
|
* @return integer |
|
88
|
|
|
* @throws Zend_Search_Lucene_Exception |
|
89
|
|
|
*/ |
|
90
|
|
|
public static function getActualGeneration(Zend_Search_Lucene_Storage_Directory $directory) |
|
91
|
|
|
{ |
|
92
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
93
|
|
|
throw new Zend_Search_Lucene_Exception("Generation number can't be retrieved for multi-searcher"); |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* Get segments file name |
|
98
|
|
|
* |
|
99
|
|
|
* @param integer $generation |
|
100
|
|
|
* @return string |
|
101
|
|
|
*/ |
|
102
|
|
|
public static function getSegmentFileName($generation) |
|
103
|
|
|
{ |
|
104
|
|
|
return Zend_Search_Lucene::getSegmentFileName($generation); |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* Get index format version |
|
109
|
|
|
* |
|
110
|
|
|
* @return integer |
|
111
|
|
|
* @throws Zend_Search_Lucene_Exception |
|
112
|
|
|
*/ |
|
113
|
|
|
public function getFormatVersion() |
|
114
|
|
|
{ |
|
115
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
116
|
|
|
throw new Zend_Search_Lucene_Exception("Format version can't be retrieved for multi-searcher"); |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* Set index format version. |
|
121
|
|
|
* Index is converted to this format at the nearest upfdate time |
|
122
|
|
|
* |
|
123
|
|
|
* @param int $formatVersion |
|
124
|
|
|
*/ |
|
125
|
|
|
public function setFormatVersion($formatVersion) |
|
126
|
|
|
{ |
|
127
|
|
|
foreach ($this->_indices as $index) { |
|
128
|
|
|
$index->setFormatVersion($formatVersion); |
|
129
|
|
|
} |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* Returns the Zend_Search_Lucene_Storage_Directory instance for this index. |
|
134
|
|
|
* |
|
135
|
|
|
* @return Zend_Search_Lucene_Storage_Directory |
|
136
|
|
|
*/ |
|
137
|
|
|
public function getDirectory() |
|
138
|
|
|
{ |
|
139
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
140
|
|
|
throw new Zend_Search_Lucene_Exception("Index directory can't be retrieved for multi-searcher"); |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
/** |
|
144
|
|
|
* Returns the total number of documents in this index (including deleted documents). |
|
145
|
|
|
* |
|
146
|
|
|
* @return integer |
|
147
|
|
|
*/ |
|
148
|
|
|
public function count() |
|
149
|
|
|
{ |
|
150
|
|
|
$count = 0; |
|
151
|
|
|
|
|
152
|
|
|
foreach ($this->_indices as $index) { |
|
153
|
|
|
$count += $index->count(); |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
return $count; |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* Returns one greater than the largest possible document number. |
|
161
|
|
|
* This may be used to, e.g., determine how big to allocate a structure which will have |
|
162
|
|
|
* an element for every document number in an index. |
|
163
|
|
|
* |
|
164
|
|
|
* @return integer |
|
165
|
|
|
*/ |
|
166
|
|
|
public function maxDoc() |
|
167
|
|
|
{ |
|
168
|
|
|
return $this->count(); |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
/** |
|
172
|
|
|
* Returns the total number of non-deleted documents in this index. |
|
173
|
|
|
* |
|
174
|
|
|
* @return integer |
|
175
|
|
|
*/ |
|
176
|
|
|
public function numDocs() |
|
177
|
|
|
{ |
|
178
|
|
|
$docs = 0; |
|
179
|
|
|
|
|
180
|
|
|
foreach ($this->_indices as $index) { |
|
181
|
|
|
$docs += $index->numDocs(); |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
return $docs; |
|
185
|
|
|
} |
|
186
|
|
|
|
|
187
|
|
|
/** |
|
188
|
|
|
* Checks, that document is deleted |
|
189
|
|
|
* |
|
190
|
|
|
* @param integer $id |
|
191
|
|
|
* @return boolean |
|
192
|
|
|
* @throws Zend_Search_Lucene_Exception Exception is thrown if $id is out of the range |
|
193
|
|
|
*/ |
|
194
|
|
|
public function isDeleted($id) |
|
195
|
|
|
{ |
|
196
|
|
|
foreach ($this->_indices as $index) { |
|
197
|
|
|
$indexCount = $index->count(); |
|
198
|
|
|
|
|
199
|
|
|
if ($indexCount > $id) { |
|
200
|
|
|
return $index->isDeleted($id); |
|
201
|
|
|
} |
|
202
|
|
|
|
|
203
|
|
|
$id -= $indexCount; |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
207
|
|
|
throw new Zend_Search_Lucene_Exception('Document id is out of the range.'); |
|
208
|
|
|
} |
|
209
|
|
|
|
|
210
|
|
|
/** |
|
211
|
|
|
* Set default search field. |
|
212
|
|
|
* |
|
213
|
|
|
* Null means, that search is performed through all fields by default |
|
214
|
|
|
* |
|
215
|
|
|
* Default value is null |
|
216
|
|
|
* |
|
217
|
|
|
* @param string $fieldName |
|
218
|
|
|
*/ |
|
219
|
|
|
public static function setDefaultSearchField($fieldName) |
|
220
|
|
|
{ |
|
221
|
|
|
foreach ($this->_indices as $index) { |
|
222
|
|
|
$index->setDefaultSearchField($fieldName); |
|
223
|
|
|
} |
|
224
|
|
|
} |
|
225
|
|
|
|
|
226
|
|
|
|
|
227
|
|
|
/** |
|
228
|
|
|
* Get default search field. |
|
229
|
|
|
* |
|
230
|
|
|
* Null means, that search is performed through all fields by default |
|
231
|
|
|
* |
|
232
|
|
|
* @return string |
|
233
|
|
|
* @throws Zend_Search_Lucene_Exception |
|
234
|
|
|
*/ |
|
235
|
|
|
public static function getDefaultSearchField() |
|
236
|
|
|
{ |
|
237
|
|
|
if (count($this->_indices) == 0) { |
|
238
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
239
|
|
|
throw new Zend_Search_Lucene_Exception('Indices list is empty'); |
|
240
|
|
|
} |
|
241
|
|
|
|
|
242
|
|
|
$defaultSearchField = reset($this->_indices)->getDefaultSearchField(); |
|
243
|
|
|
|
|
244
|
|
|
foreach ($this->_indices as $index) { |
|
245
|
|
|
if ($index->getDefaultSearchField() !== $defaultSearchField) { |
|
246
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
247
|
|
|
throw new Zend_Search_Lucene_Exception('Indices have different default search field.'); |
|
248
|
|
|
} |
|
249
|
|
|
} |
|
250
|
|
|
|
|
251
|
|
|
return $defaultSearchField; |
|
252
|
|
|
} |
|
253
|
|
|
|
|
254
|
|
|
/** |
|
255
|
|
|
* Set result set limit. |
|
256
|
|
|
* |
|
257
|
|
|
* 0 (default) means no limit |
|
258
|
|
|
* |
|
259
|
|
|
* @param integer $limit |
|
260
|
|
|
*/ |
|
261
|
|
|
public static function setResultSetLimit($limit) |
|
262
|
|
|
{ |
|
263
|
|
|
foreach ($this->_indices as $index) { |
|
264
|
|
|
$index->setResultSetLimit($limit); |
|
265
|
|
|
} |
|
266
|
|
|
} |
|
267
|
|
|
|
|
268
|
|
|
/** |
|
269
|
|
|
* Set result set limit. |
|
270
|
|
|
* |
|
271
|
|
|
* 0 means no limit |
|
272
|
|
|
* |
|
273
|
|
|
* @return integer |
|
274
|
|
|
* @throws Zend_Search_Lucene_Exception |
|
275
|
|
|
*/ |
|
276
|
|
|
public static function getResultSetLimit() |
|
277
|
|
|
{ |
|
278
|
|
|
if (count($this->_indices) == 0) { |
|
279
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
280
|
|
|
throw new Zend_Search_Lucene_Exception('Indices list is empty'); |
|
281
|
|
|
} |
|
282
|
|
|
|
|
283
|
|
|
$defaultResultSetLimit = reset($this->_indices)->getResultSetLimit(); |
|
284
|
|
|
|
|
285
|
|
|
foreach ($this->_indices as $index) { |
|
286
|
|
|
if ($index->getResultSetLimit() !== $defaultResultSetLimit) { |
|
287
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
288
|
|
|
throw new Zend_Search_Lucene_Exception('Indices have different default search field.'); |
|
289
|
|
|
} |
|
290
|
|
|
} |
|
291
|
|
|
|
|
292
|
|
|
return $defaultResultSetLimit; |
|
293
|
|
|
} |
|
294
|
|
|
|
|
295
|
|
|
/** |
|
296
|
|
|
* Retrieve index maxBufferedDocs option |
|
297
|
|
|
* |
|
298
|
|
|
* maxBufferedDocs is a minimal number of documents required before |
|
299
|
|
|
* the buffered in-memory documents are written into a new Segment |
|
300
|
|
|
* |
|
301
|
|
|
* Default value is 10 |
|
302
|
|
|
* |
|
303
|
|
|
* @return integer |
|
304
|
|
|
* @throws Zend_Search_Lucene_Exception |
|
305
|
|
|
*/ |
|
306
|
|
|
public function getMaxBufferedDocs() |
|
307
|
|
|
{ |
|
308
|
|
|
if (count($this->_indices) == 0) { |
|
309
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
310
|
|
|
throw new Zend_Search_Lucene_Exception('Indices list is empty'); |
|
311
|
|
|
} |
|
312
|
|
|
|
|
313
|
|
|
$maxBufferedDocs = reset($this->_indices)->getMaxBufferedDocs(); |
|
314
|
|
|
|
|
315
|
|
|
foreach ($this->_indices as $index) { |
|
316
|
|
|
if ($index->getMaxBufferedDocs() !== $maxBufferedDocs) { |
|
317
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
318
|
|
|
throw new Zend_Search_Lucene_Exception('Indices have different default search field.'); |
|
319
|
|
|
} |
|
320
|
|
|
} |
|
321
|
|
|
|
|
322
|
|
|
return $maxBufferedDocs; |
|
323
|
|
|
} |
|
324
|
|
|
|
|
325
|
|
|
/** |
|
326
|
|
|
* Set index maxBufferedDocs option |
|
327
|
|
|
* |
|
328
|
|
|
* maxBufferedDocs is a minimal number of documents required before |
|
329
|
|
|
* the buffered in-memory documents are written into a new Segment |
|
330
|
|
|
* |
|
331
|
|
|
* Default value is 10 |
|
332
|
|
|
* |
|
333
|
|
|
* @param integer $maxBufferedDocs |
|
334
|
|
|
*/ |
|
335
|
|
|
public function setMaxBufferedDocs($maxBufferedDocs) |
|
336
|
|
|
{ |
|
337
|
|
|
foreach ($this->_indices as $index) { |
|
338
|
|
|
$index->setMaxBufferedDocs($maxBufferedDocs); |
|
339
|
|
|
} |
|
340
|
|
|
} |
|
341
|
|
|
|
|
342
|
|
|
/** |
|
343
|
|
|
* Retrieve index maxMergeDocs option |
|
344
|
|
|
* |
|
345
|
|
|
* maxMergeDocs is a largest number of documents ever merged by addDocument(). |
|
346
|
|
|
* Small values (e.g., less than 10,000) are best for interactive indexing, |
|
347
|
|
|
* as this limits the length of pauses while indexing to a few seconds. |
|
348
|
|
|
* Larger values are best for batched indexing and speedier searches. |
|
349
|
|
|
* |
|
350
|
|
|
* Default value is PHP_INT_MAX |
|
351
|
|
|
* |
|
352
|
|
|
* @return integer |
|
353
|
|
|
* @throws Zend_Search_Lucene_Exception |
|
354
|
|
|
*/ |
|
355
|
|
|
public function getMaxMergeDocs() |
|
356
|
|
|
{ |
|
357
|
|
|
if (count($this->_indices) == 0) { |
|
358
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
359
|
|
|
throw new Zend_Search_Lucene_Exception('Indices list is empty'); |
|
360
|
|
|
} |
|
361
|
|
|
|
|
362
|
|
|
$maxMergeDocs = reset($this->_indices)->getMaxMergeDocs(); |
|
363
|
|
|
|
|
364
|
|
|
foreach ($this->_indices as $index) { |
|
365
|
|
|
if ($index->getMaxMergeDocs() !== $maxMergeDocs) { |
|
366
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
367
|
|
|
throw new Zend_Search_Lucene_Exception('Indices have different default search field.'); |
|
368
|
|
|
} |
|
369
|
|
|
} |
|
370
|
|
|
|
|
371
|
|
|
return $maxMergeDocs; |
|
372
|
|
|
} |
|
373
|
|
|
|
|
374
|
|
|
/** |
|
375
|
|
|
* Set index maxMergeDocs option |
|
376
|
|
|
* |
|
377
|
|
|
* maxMergeDocs is a largest number of documents ever merged by addDocument(). |
|
378
|
|
|
* Small values (e.g., less than 10,000) are best for interactive indexing, |
|
379
|
|
|
* as this limits the length of pauses while indexing to a few seconds. |
|
380
|
|
|
* Larger values are best for batched indexing and speedier searches. |
|
381
|
|
|
* |
|
382
|
|
|
* Default value is PHP_INT_MAX |
|
383
|
|
|
* |
|
384
|
|
|
* @param integer $maxMergeDocs |
|
385
|
|
|
*/ |
|
386
|
|
|
public function setMaxMergeDocs($maxMergeDocs) |
|
387
|
|
|
{ |
|
388
|
|
|
foreach ($this->_indices as $index) { |
|
389
|
|
|
$index->setMaxMergeDocs($maxMergeDocs); |
|
390
|
|
|
} |
|
391
|
|
|
} |
|
392
|
|
|
|
|
393
|
|
|
/** |
|
394
|
|
|
* Retrieve index mergeFactor option |
|
395
|
|
|
* |
|
396
|
|
|
* mergeFactor determines how often segment indices are merged by addDocument(). |
|
397
|
|
|
* With smaller values, less RAM is used while indexing, |
|
398
|
|
|
* and searches on unoptimized indices are faster, |
|
399
|
|
|
* but indexing speed is slower. |
|
400
|
|
|
* With larger values, more RAM is used during indexing, |
|
401
|
|
|
* and while searches on unoptimized indices are slower, |
|
402
|
|
|
* indexing is faster. |
|
403
|
|
|
* Thus larger values (> 10) are best for batch index creation, |
|
404
|
|
|
* and smaller values (< 10) for indices that are interactively maintained. |
|
405
|
|
|
* |
|
406
|
|
|
* Default value is 10 |
|
407
|
|
|
* |
|
408
|
|
|
* @return integer |
|
409
|
|
|
* @throws Zend_Search_Lucene_Exception |
|
410
|
|
|
*/ |
|
411
|
|
|
public function getMergeFactor() |
|
412
|
|
|
{ |
|
413
|
|
|
if (count($this->_indices) == 0) { |
|
414
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
415
|
|
|
throw new Zend_Search_Lucene_Exception('Indices list is empty'); |
|
416
|
|
|
} |
|
417
|
|
|
|
|
418
|
|
|
$mergeFactor = reset($this->_indices)->getMergeFactor(); |
|
419
|
|
|
|
|
420
|
|
|
foreach ($this->_indices as $index) { |
|
421
|
|
|
if ($index->getMergeFactor() !== $mergeFactor) { |
|
422
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
423
|
|
|
throw new Zend_Search_Lucene_Exception('Indices have different default search field.'); |
|
424
|
|
|
} |
|
425
|
|
|
} |
|
426
|
|
|
|
|
427
|
|
|
return $mergeFactor; |
|
428
|
|
|
} |
|
429
|
|
|
|
|
430
|
|
|
/** |
|
431
|
|
|
* Set index mergeFactor option |
|
432
|
|
|
* |
|
433
|
|
|
* mergeFactor determines how often segment indices are merged by addDocument(). |
|
434
|
|
|
* With smaller values, less RAM is used while indexing, |
|
435
|
|
|
* and searches on unoptimized indices are faster, |
|
436
|
|
|
* but indexing speed is slower. |
|
437
|
|
|
* With larger values, more RAM is used during indexing, |
|
438
|
|
|
* and while searches on unoptimized indices are slower, |
|
439
|
|
|
* indexing is faster. |
|
440
|
|
|
* Thus larger values (> 10) are best for batch index creation, |
|
441
|
|
|
* and smaller values (< 10) for indices that are interactively maintained. |
|
442
|
|
|
* |
|
443
|
|
|
* Default value is 10 |
|
444
|
|
|
* |
|
445
|
|
|
* @param integer $maxMergeDocs |
|
|
|
|
|
|
446
|
|
|
*/ |
|
447
|
|
|
public function setMergeFactor($mergeFactor) |
|
448
|
|
|
{ |
|
449
|
|
|
foreach ($this->_indices as $index) { |
|
450
|
|
|
$index->setMaxMergeDocs($mergeFactor); |
|
451
|
|
|
} |
|
452
|
|
|
} |
|
453
|
|
|
|
|
454
|
|
|
/** |
|
455
|
|
|
* Performs a query against the index and returns an array |
|
456
|
|
|
* of Zend_Search_Lucene_Search_QueryHit objects. |
|
457
|
|
|
* Input is a string or Zend_Search_Lucene_Search_Query. |
|
458
|
|
|
* |
|
459
|
|
|
* @param mixed $query |
|
460
|
|
|
* @return array Zend_Search_Lucene_Search_QueryHit |
|
461
|
|
|
* @throws Zend_Search_Lucene_Exception |
|
462
|
|
|
*/ |
|
463
|
|
|
public function find($query) |
|
464
|
|
|
{ |
|
465
|
|
|
if (count($this->_indices) == 0) { |
|
466
|
|
|
return array(); |
|
467
|
|
|
} |
|
468
|
|
|
|
|
469
|
|
|
$hitsList = array(); |
|
470
|
|
|
|
|
471
|
|
|
$indexShift = 0; |
|
472
|
|
|
foreach ($this->_indices as $index) { |
|
473
|
|
|
$hits = $index->find($query); |
|
474
|
|
|
|
|
475
|
|
|
if ($indexShift != 0) { |
|
476
|
|
|
foreach ($hits as $hit) { |
|
477
|
|
|
$hit->id += $indexShift; |
|
478
|
|
|
} |
|
479
|
|
|
} |
|
480
|
|
|
|
|
481
|
|
|
$indexShift += $index->count(); |
|
482
|
|
|
$hitsList[] = $hits; |
|
483
|
|
|
} |
|
484
|
|
|
|
|
485
|
|
|
/** @todo Implement advanced sorting */ |
|
486
|
|
|
|
|
487
|
|
|
return call_user_func_array('array_merge', $hitsList); |
|
488
|
|
|
} |
|
489
|
|
|
|
|
490
|
|
|
/** |
|
491
|
|
|
* Returns a list of all unique field names that exist in this index. |
|
492
|
|
|
* |
|
493
|
|
|
* @param boolean $indexed |
|
494
|
|
|
* @return array |
|
495
|
|
|
*/ |
|
496
|
|
|
public function getFieldNames($indexed = false) |
|
497
|
|
|
{ |
|
498
|
|
|
$fieldNamesList = array(); |
|
499
|
|
|
|
|
500
|
|
|
foreach ($this->_indices as $index) { |
|
501
|
|
|
$fieldNamesList[] = $index->getFieldNames($indexed); |
|
502
|
|
|
} |
|
503
|
|
|
|
|
504
|
|
|
return array_unique(call_user_func_array('array_merge', $fieldNamesList)); |
|
505
|
|
|
} |
|
506
|
|
|
|
|
507
|
|
|
/** |
|
508
|
|
|
* Returns a Zend_Search_Lucene_Document object for the document |
|
509
|
|
|
* number $id in this index. |
|
510
|
|
|
* |
|
511
|
|
|
* @param integer|Zend_Search_Lucene_Search_QueryHit $id |
|
512
|
|
|
* @return Zend_Search_Lucene_Document |
|
513
|
|
|
* @throws Zend_Search_Lucene_Exception Exception is thrown if $id is out of the range |
|
514
|
|
|
*/ |
|
515
|
|
|
public function getDocument($id) |
|
516
|
|
|
{ |
|
517
|
|
|
if ($id instanceof Zend_Search_Lucene_Search_QueryHit) { |
|
518
|
|
|
/* @var $id Zend_Search_Lucene_Search_QueryHit */ |
|
519
|
|
|
$id = $id->id; |
|
520
|
|
|
} |
|
521
|
|
|
|
|
522
|
|
|
foreach ($this->_indices as $index) { |
|
523
|
|
|
$indexCount = $index->count(); |
|
524
|
|
|
|
|
525
|
|
|
if ($indexCount > $id) { |
|
526
|
|
|
return $index->getDocument($id); |
|
527
|
|
|
} |
|
528
|
|
|
|
|
529
|
|
|
$id -= $indexCount; |
|
530
|
|
|
} |
|
531
|
|
|
|
|
532
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
533
|
|
|
throw new Zend_Search_Lucene_Exception('Document id is out of the range.'); |
|
534
|
|
|
} |
|
535
|
|
|
|
|
536
|
|
|
/** |
|
537
|
|
|
* Returns true if index contain documents with specified term. |
|
538
|
|
|
* |
|
539
|
|
|
* Is used for query optimization. |
|
540
|
|
|
* |
|
541
|
|
|
* @param Zend_Search_Lucene_Index_Term $term |
|
542
|
|
|
* @return boolean |
|
543
|
|
|
*/ |
|
544
|
|
|
public function hasTerm(Zend_Search_Lucene_Index_Term $term) |
|
545
|
|
|
{ |
|
546
|
|
|
foreach ($this->_indices as $index) { |
|
547
|
|
|
if ($index->hasTerm($term)) { |
|
548
|
|
|
return true; |
|
549
|
|
|
} |
|
550
|
|
|
} |
|
551
|
|
|
|
|
552
|
|
|
return false; |
|
553
|
|
|
} |
|
554
|
|
|
|
|
555
|
|
|
/** |
|
556
|
|
|
* Returns IDs of all the documents containing term. |
|
557
|
|
|
* |
|
558
|
|
|
* @param Zend_Search_Lucene_Index_Term $term |
|
559
|
|
|
* @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter |
|
560
|
|
|
* @return array |
|
561
|
|
|
* @throws Zend_Search_Lucene_Exception |
|
562
|
|
|
*/ |
|
563
|
|
|
public function termDocs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) |
|
564
|
|
|
{ |
|
565
|
|
|
if ($docsFilter != null) { |
|
566
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
567
|
|
|
throw new Zend_Search_Lucene_Exception('Document filters could not used with multi-searcher'); |
|
568
|
|
|
} |
|
569
|
|
|
|
|
570
|
|
|
$docsList = array(); |
|
571
|
|
|
|
|
572
|
|
|
$indexShift = 0; |
|
573
|
|
|
foreach ($this->_indices as $index) { |
|
574
|
|
|
$docs = $index->termDocs($term); |
|
575
|
|
|
|
|
576
|
|
|
if ($indexShift != 0) { |
|
577
|
|
|
foreach ($docs as $id => $docId) { |
|
578
|
|
|
$docs[$id] += $indexShift; |
|
579
|
|
|
} |
|
580
|
|
|
} |
|
581
|
|
|
|
|
582
|
|
|
$indexShift += $index->count(); |
|
583
|
|
|
$docsList[] = $docs; |
|
584
|
|
|
} |
|
585
|
|
|
|
|
586
|
|
|
return call_user_func_array('array_merge', $docsList); |
|
587
|
|
|
} |
|
588
|
|
|
|
|
589
|
|
|
/** |
|
590
|
|
|
* Returns documents filter for all documents containing term. |
|
591
|
|
|
* |
|
592
|
|
|
* It performs the same operation as termDocs, but return result as |
|
593
|
|
|
* Zend_Search_Lucene_Index_DocsFilter object |
|
594
|
|
|
* |
|
595
|
|
|
* @param Zend_Search_Lucene_Index_Term $term |
|
596
|
|
|
* @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter |
|
597
|
|
|
* @return Zend_Search_Lucene_Index_DocsFilter |
|
598
|
|
|
* @throws Zend_Search_Lucene_Exception |
|
599
|
|
|
*/ |
|
600
|
|
|
public function termDocsFilter(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) |
|
601
|
|
|
{ |
|
602
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
603
|
|
|
throw new Zend_Search_Lucene_Exception('Document filters could not used with multi-searcher'); |
|
604
|
|
|
} |
|
605
|
|
|
|
|
606
|
|
|
/** |
|
607
|
|
|
* Returns an array of all term freqs. |
|
608
|
|
|
* Return array structure: array( docId => freq, ...) |
|
609
|
|
|
* |
|
610
|
|
|
* @param Zend_Search_Lucene_Index_Term $term |
|
611
|
|
|
* @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter |
|
612
|
|
|
* @return integer |
|
613
|
|
|
* @throws Zend_Search_Lucene_Exception |
|
614
|
|
|
*/ |
|
615
|
|
|
public function termFreqs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) |
|
616
|
|
|
{ |
|
617
|
|
|
if ($docsFilter != null) { |
|
618
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
619
|
|
|
throw new Zend_Search_Lucene_Exception('Document filters could not used with multi-searcher'); |
|
620
|
|
|
} |
|
621
|
|
|
|
|
622
|
|
|
$freqsList = array(); |
|
623
|
|
|
|
|
624
|
|
|
$indexShift = 0; |
|
625
|
|
|
foreach ($this->_indices as $index) { |
|
626
|
|
|
$freqs = $index->termFreqs($term); |
|
627
|
|
|
|
|
628
|
|
|
if ($indexShift != 0) { |
|
629
|
|
|
$freqsShifted = array(); |
|
630
|
|
|
|
|
631
|
|
|
foreach ($freqs as $docId => $freq) { |
|
632
|
|
|
$freqsShifted[$docId + $indexShift] = $freq; |
|
633
|
|
|
} |
|
634
|
|
|
$freqs = $freqsShifted; |
|
635
|
|
|
} |
|
636
|
|
|
|
|
637
|
|
|
$indexShift += $index->count(); |
|
638
|
|
|
$freqsList[] = $freqs; |
|
639
|
|
|
} |
|
640
|
|
|
|
|
641
|
|
|
return call_user_func_array('array_merge', $freqsList); |
|
642
|
|
|
} |
|
643
|
|
|
|
|
644
|
|
|
/** |
|
645
|
|
|
* Returns an array of all term positions in the documents. |
|
646
|
|
|
* Return array structure: array( docId => array( pos1, pos2, ...), ...) |
|
647
|
|
|
* |
|
648
|
|
|
* @param Zend_Search_Lucene_Index_Term $term |
|
649
|
|
|
* @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter |
|
650
|
|
|
* @return array |
|
651
|
|
|
* @throws Zend_Search_Lucene_Exception |
|
652
|
|
|
*/ |
|
653
|
|
|
public function termPositions(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) |
|
654
|
|
|
{ |
|
655
|
|
|
if ($docsFilter != null) { |
|
656
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
657
|
|
|
throw new Zend_Search_Lucene_Exception('Document filters could not used with multi-searcher'); |
|
658
|
|
|
} |
|
659
|
|
|
|
|
660
|
|
|
$termPositionsList = array(); |
|
661
|
|
|
|
|
662
|
|
|
$indexShift = 0; |
|
663
|
|
|
foreach ($this->_indices as $index) { |
|
664
|
|
|
$termPositions = $index->termPositions($term); |
|
665
|
|
|
|
|
666
|
|
|
if ($indexShift != 0) { |
|
667
|
|
|
$termPositionsShifted = array(); |
|
668
|
|
|
|
|
669
|
|
|
foreach ($termPositions as $docId => $positions) { |
|
670
|
|
|
$termPositions[$docId + $indexShift] = $positions; |
|
671
|
|
|
} |
|
672
|
|
|
$termPositions = $termPositionsShifted; |
|
673
|
|
|
} |
|
674
|
|
|
|
|
675
|
|
|
$indexShift += $index->count(); |
|
676
|
|
|
$termPositionsList[] = $termPositions; |
|
677
|
|
|
} |
|
678
|
|
|
|
|
679
|
|
|
return call_user_func_array('array_merge', $termPositions); |
|
680
|
|
|
} |
|
681
|
|
|
|
|
682
|
|
|
/** |
|
683
|
|
|
* Returns the number of documents in this index containing the $term. |
|
684
|
|
|
* |
|
685
|
|
|
* @param Zend_Search_Lucene_Index_Term $term |
|
686
|
|
|
* @return integer |
|
687
|
|
|
*/ |
|
688
|
|
|
public function docFreq(Zend_Search_Lucene_Index_Term $term) |
|
689
|
|
|
{ |
|
690
|
|
|
$docFreq = 0; |
|
691
|
|
|
|
|
692
|
|
|
foreach ($this->_indices as $index) { |
|
693
|
|
|
$docFreq += $index->docFreq($term); |
|
694
|
|
|
} |
|
695
|
|
|
|
|
696
|
|
|
return $docFreq; |
|
697
|
|
|
} |
|
698
|
|
|
|
|
699
|
|
|
/** |
|
700
|
|
|
* Retrive similarity used by index reader |
|
701
|
|
|
* |
|
702
|
|
|
* @return Zend_Search_Lucene_Search_Similarity |
|
703
|
|
|
* @throws Zend_Search_Lucene_Exception |
|
704
|
|
|
*/ |
|
705
|
|
|
public function getSimilarity() |
|
706
|
|
|
{ |
|
707
|
|
|
if (count($this->_indices) == 0) { |
|
708
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
709
|
|
|
throw new Zend_Search_Lucene_Exception('Indices list is empty'); |
|
710
|
|
|
} |
|
711
|
|
|
|
|
712
|
|
|
$similarity = reset($this->_indices)->getSimilarity(); |
|
713
|
|
|
|
|
714
|
|
|
foreach ($this->_indices as $index) { |
|
715
|
|
|
if ($index->getSimilarity() !== $similarity) { |
|
716
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
717
|
|
|
throw new Zend_Search_Lucene_Exception('Indices have different similarity.'); |
|
718
|
|
|
} |
|
719
|
|
|
} |
|
720
|
|
|
|
|
721
|
|
|
return $similarity; |
|
722
|
|
|
} |
|
723
|
|
|
|
|
724
|
|
|
/** |
|
725
|
|
|
* Returns a normalization factor for "field, document" pair. |
|
726
|
|
|
* |
|
727
|
|
|
* @param integer $id |
|
728
|
|
|
* @param string $fieldName |
|
729
|
|
|
* @return float |
|
730
|
|
|
*/ |
|
731
|
|
|
public function norm($id, $fieldName) |
|
732
|
|
|
{ |
|
733
|
|
|
foreach ($this->_indices as $index) { |
|
734
|
|
|
$indexCount = $index->count(); |
|
735
|
|
|
|
|
736
|
|
|
if ($indexCount > $id) { |
|
737
|
|
|
return $index->norm($id, $fieldName); |
|
738
|
|
|
} |
|
739
|
|
|
|
|
740
|
|
|
$id -= $indexCount; |
|
741
|
|
|
} |
|
742
|
|
|
|
|
743
|
|
|
return null; |
|
744
|
|
|
} |
|
745
|
|
|
|
|
746
|
|
|
/** |
|
747
|
|
|
* Returns true if any documents have been deleted from this index. |
|
748
|
|
|
* |
|
749
|
|
|
* @return boolean |
|
750
|
|
|
*/ |
|
751
|
|
|
public function hasDeletions() |
|
752
|
|
|
{ |
|
753
|
|
|
foreach ($this->_indices as $index) { |
|
754
|
|
|
if ($index->hasDeletions()) { |
|
755
|
|
|
return true; |
|
756
|
|
|
} |
|
757
|
|
|
} |
|
758
|
|
|
|
|
759
|
|
|
return false; |
|
760
|
|
|
} |
|
761
|
|
|
|
|
762
|
|
|
/** |
|
763
|
|
|
* Deletes a document from the index. |
|
764
|
|
|
* $id is an internal document id |
|
765
|
|
|
* |
|
766
|
|
|
* @param integer|Zend_Search_Lucene_Search_QueryHit $id |
|
767
|
|
|
* @throws Zend_Search_Lucene_Exception |
|
768
|
|
|
*/ |
|
769
|
|
|
public function delete($id) |
|
770
|
|
|
{ |
|
771
|
|
|
foreach ($this->_indices as $index) { |
|
772
|
|
|
$indexCount = $index->count(); |
|
773
|
|
|
|
|
774
|
|
|
if ($indexCount > $id) { |
|
775
|
|
|
$index->delete($id); |
|
776
|
|
|
return; |
|
777
|
|
|
} |
|
778
|
|
|
|
|
779
|
|
|
$id -= $indexCount; |
|
780
|
|
|
} |
|
781
|
|
|
|
|
782
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
783
|
|
|
throw new Zend_Search_Lucene_Exception('Document id is out of the range.'); |
|
784
|
|
|
} |
|
785
|
|
|
|
|
786
|
|
|
|
|
787
|
|
|
/** |
|
788
|
|
|
* Callback used to choose target index for new documents |
|
789
|
|
|
* |
|
790
|
|
|
* Function/method signature: |
|
791
|
|
|
* Zend_Search_Lucene_Interface callbackFunction(Zend_Search_Lucene_Document $document, array $indices); |
|
792
|
|
|
* |
|
793
|
|
|
* null means "default documents distributing algorithm" |
|
794
|
|
|
* |
|
795
|
|
|
* @var callback |
|
796
|
|
|
*/ |
|
797
|
|
|
protected $_documentDistributorCallBack = null; |
|
798
|
|
|
|
|
799
|
|
|
/** |
|
800
|
|
|
* Set callback for choosing target index. |
|
801
|
|
|
* |
|
802
|
|
|
* @param callback $callback |
|
803
|
|
|
* @throws Zend_Search_Lucene_Exception |
|
804
|
|
|
*/ |
|
805
|
|
|
public function setDocumentDistributorCallback($callback) |
|
806
|
|
|
{ |
|
807
|
|
|
if ($callback !== null && !is_callable($callback)) { |
|
808
|
|
|
require_once 'Zend/Search/Lucene/Exception.php'; |
|
809
|
|
|
throw new Zend_Search_Lucene_Exception('$callback parameter must be a valid callback.'); |
|
810
|
|
|
} |
|
811
|
|
|
|
|
812
|
|
|
$this->_documentDistributorCallBack = $callback; |
|
813
|
|
|
} |
|
814
|
|
|
|
|
815
|
|
|
/** |
|
816
|
|
|
* Get callback for choosing target index. |
|
817
|
|
|
* |
|
818
|
|
|
* @return callback |
|
819
|
|
|
*/ |
|
820
|
|
|
public function getDocumentDistributorCallback() |
|
821
|
|
|
{ |
|
822
|
|
|
return $this->_documentDistributorCallBack; |
|
823
|
|
|
} |
|
824
|
|
|
|
|
825
|
|
|
/** |
|
826
|
|
|
* Adds a document to this index. |
|
827
|
|
|
* |
|
828
|
|
|
* @param Zend_Search_Lucene_Document $document |
|
829
|
|
|
* @throws Zend_Search_Lucene_Exception |
|
830
|
|
|
*/ |
|
831
|
|
|
public function addDocument(Zend_Search_Lucene_Document $document) |
|
832
|
|
|
{ |
|
833
|
|
|
if ($this->_documentDistributorCallBack !== null) { |
|
834
|
|
|
$index = call_user_func($this->_documentDistributorCallBack, $document, $this->_indices); |
|
835
|
|
|
} else { |
|
836
|
|
|
$index = $this->_indices[array_rand($this->_indices)]; |
|
837
|
|
|
} |
|
838
|
|
|
|
|
839
|
|
|
$index->addDocument($document); |
|
840
|
|
|
} |
|
841
|
|
|
|
|
842
|
|
|
/** |
|
843
|
|
|
* Commit changes resulting from delete() or undeleteAll() operations. |
|
844
|
|
|
*/ |
|
845
|
|
|
public function commit() |
|
846
|
|
|
{ |
|
847
|
|
|
foreach ($this->_indices as $index) { |
|
848
|
|
|
$index->commit(); |
|
849
|
|
|
} |
|
850
|
|
|
} |
|
851
|
|
|
|
|
852
|
|
|
/** |
|
853
|
|
|
* Optimize index. |
|
854
|
|
|
* |
|
855
|
|
|
* Merges all segments into one |
|
856
|
|
|
*/ |
|
857
|
|
|
public function optimize() |
|
858
|
|
|
{ |
|
859
|
|
|
foreach ($this->_indices as $index) { |
|
860
|
|
|
$index->optimise(); |
|
861
|
|
|
} |
|
862
|
|
|
} |
|
863
|
|
|
|
|
864
|
|
|
/** |
|
865
|
|
|
* Returns an array of all terms in this index. |
|
866
|
|
|
* |
|
867
|
|
|
* @return array |
|
868
|
|
|
*/ |
|
869
|
|
|
public function terms() |
|
870
|
|
|
{ |
|
871
|
|
|
$termsList = array(); |
|
872
|
|
|
|
|
873
|
|
|
foreach ($this->_indices as $index) { |
|
874
|
|
|
$termsList[] = $index->terms(); |
|
875
|
|
|
} |
|
876
|
|
|
|
|
877
|
|
|
return array_unique(call_user_func_array('array_merge', $termsList)); |
|
878
|
|
|
} |
|
879
|
|
|
|
|
880
|
|
|
|
|
881
|
|
|
/** |
|
882
|
|
|
* Terms stream priority queue object |
|
883
|
|
|
* |
|
884
|
|
|
* @var Zend_Search_Lucene_TermStreamsPriorityQueue |
|
885
|
|
|
*/ |
|
886
|
|
|
private $_termsStream = null; |
|
887
|
|
|
|
|
888
|
|
|
/** |
|
889
|
|
|
* Reset terms stream. |
|
890
|
|
|
*/ |
|
891
|
|
|
public function resetTermsStream() |
|
892
|
|
|
{ |
|
893
|
|
|
if ($this->_termsStream === null) { |
|
894
|
|
|
/** Zend_Search_Lucene_TermStreamsPriorityQueue */ |
|
895
|
|
|
require_once 'Zend/Search/Lucene/TermStreamsPriorityQueue.php'; |
|
896
|
|
|
|
|
897
|
|
|
$this->_termsStream = new Zend_Search_Lucene_TermStreamsPriorityQueue($this->_indices); |
|
898
|
|
|
} else { |
|
899
|
|
|
$this->_termsStream->resetTermsStream(); |
|
900
|
|
|
} |
|
901
|
|
|
} |
|
902
|
|
|
|
|
903
|
|
|
/** |
|
904
|
|
|
* Skip terms stream up to specified term preffix. |
|
905
|
|
|
* |
|
906
|
|
|
* Prefix contains fully specified field info and portion of searched term |
|
907
|
|
|
* |
|
908
|
|
|
* @param Zend_Search_Lucene_Index_Term $prefix |
|
909
|
|
|
*/ |
|
910
|
|
|
public function skipTo(Zend_Search_Lucene_Index_Term $prefix) |
|
911
|
|
|
{ |
|
912
|
|
|
$this->_termsStream->skipTo($prefix); |
|
913
|
|
|
} |
|
914
|
|
|
|
|
915
|
|
|
/** |
|
916
|
|
|
* Scans terms dictionary and returns next term |
|
917
|
|
|
* |
|
918
|
|
|
* @return Zend_Search_Lucene_Index_Term|null |
|
919
|
|
|
*/ |
|
920
|
|
|
public function nextTerm() |
|
921
|
|
|
{ |
|
922
|
|
|
return $this->_termsStream->nextTerm(); |
|
923
|
|
|
} |
|
924
|
|
|
|
|
925
|
|
|
/** |
|
926
|
|
|
* Returns term in current position |
|
927
|
|
|
* |
|
928
|
|
|
* @return Zend_Search_Lucene_Index_Term|null |
|
929
|
|
|
*/ |
|
930
|
|
|
public function currentTerm() |
|
931
|
|
|
{ |
|
932
|
|
|
return $this->_termsStream->currentTerm(); |
|
933
|
|
|
} |
|
934
|
|
|
|
|
935
|
|
|
/** |
|
936
|
|
|
* Close terms stream |
|
937
|
|
|
* |
|
938
|
|
|
* Should be used for resources clean up if stream is not read up to the end |
|
939
|
|
|
*/ |
|
940
|
|
|
public function closeTermsStream() |
|
941
|
|
|
{ |
|
942
|
|
|
$this->_termsStream->closeTermsStream(); |
|
943
|
|
|
$this->_termsStream = null; |
|
944
|
|
|
} |
|
945
|
|
|
|
|
946
|
|
|
|
|
947
|
|
|
/** |
|
948
|
|
|
* Undeletes all documents currently marked as deleted in this index. |
|
949
|
|
|
*/ |
|
950
|
|
|
public function undeleteAll() |
|
951
|
|
|
{ |
|
952
|
|
|
foreach ($this->_indices as $index) { |
|
953
|
|
|
$index->undeleteAll(); |
|
954
|
|
|
} |
|
955
|
|
|
} |
|
956
|
|
|
|
|
957
|
|
|
|
|
958
|
|
|
/** |
|
959
|
|
|
* Add reference to the index object |
|
960
|
|
|
* |
|
961
|
|
|
* @internal |
|
962
|
|
|
*/ |
|
963
|
|
|
public function addReference() |
|
964
|
|
|
{ |
|
965
|
|
|
// Do nothing, since it's never referenced by indices |
|
966
|
|
|
} |
|
967
|
|
|
|
|
968
|
|
|
/** |
|
969
|
|
|
* Remove reference from the index object |
|
970
|
|
|
* |
|
971
|
|
|
* When reference count becomes zero, index is closed and resources are cleaned up |
|
972
|
|
|
* |
|
973
|
|
|
* @internal |
|
974
|
|
|
*/ |
|
975
|
|
|
public function removeReference() |
|
976
|
|
|
{ |
|
977
|
|
|
// Do nothing, since it's never referenced by indices |
|
978
|
|
|
} |
|
979
|
|
|
} |
|
980
|
|
|
|
|
981
|
|
|
/** |
|
982
|
|
|
* This class is provided for backwards-compatibility (See ZF-12067) |
|
983
|
|
|
* |
|
984
|
|
|
* @category Zend |
|
985
|
|
|
* @package Zend_Search_Lucene |
|
986
|
|
|
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
|
987
|
|
|
* @license http://framework.zend.com/license/new-bsd New BSD License |
|
988
|
|
|
*/ |
|
989
|
|
|
class Zend_Search_Lucene_Interface_MultiSearcher |
|
|
|
|
|
|
990
|
|
|
extends Zend_Search_Lucene_MultiSearcher |
|
|
|
|
|
|
991
|
|
|
{ |
|
992
|
|
|
} |
|
993
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.