7 * This source file is subject to the new BSD license that is bundled
\r
8 * with this package in the file LICENSE.txt.
\r
9 * It is also available through the world-wide-web at this URL:
\r
10 * http://framework.zend.com/license/new-bsd
\r
11 * If you did not receive a copy of the license and are unable to
\r
12 * obtain it through the world-wide-web, please send an email
\r
13 * to license@zend.com so we can send you a copy immediately.
\r
16 * @package Zend_Search_Lucene
\r
17 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
\r
18 * @license http://framework.zend.com/license/new-bsd New BSD License
\r
19 * @version $Id: MultiSearcher.php 16971 2009-07-22 18:05:45Z mikaelkael $
\r
22 /** Zend_Search_Lucene_TermStreamsPriorityQueue */
\r
23 require_once 'Zend/Search/Lucene/TermStreamsPriorityQueue.php';
\r
25 /** Zend_Search_Lucene_Interface */
\r
26 require_once 'Zend/Search/Lucene/Interface.php';
\r
29 * Multisearcher allows to search through several independent indexes.
\r
32 * @package Zend_Search_Lucene
\r
33 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
\r
34 * @license http://framework.zend.com/license/new-bsd New BSD License
\r
36 class Zend_Search_Lucene_Interface_MultiSearcher implements Zend_Search_Lucene_Interface
\r
39 * List of indices for searching.
\r
40 * Array of Zend_Search_Lucene_Interface objects
\r
44 protected $_indices;
\r
47 * Object constructor.
\r
49 * @param array $indices Arrays of indices for search
\r
50 * @throws Zend_Search_Lucene_Exception
\r
52 public function __construct($indices = array())
\r
54 $this->_indices = $indices;
\r
56 foreach ($this->_indices as $index) {
\r
57 if (!$index instanceof Zend_Search_Lucene_Interface) {
\r
58 require_once 'Zend/Search/Lucene/Exception.php';
\r
59 throw new Zend_Search_Lucene_Exception('sub-index objects have to implement Zend_Search_Lucene_Interface.');
\r
65 * Add index for searching.
\r
67 * @param Zend_Search_Lucene_Interface $index
\r
69 public function addIndex(Zend_Search_Lucene_Interface $index)
\r
71 $this->_indices[] = $index;
\r
76 * Get current generation number
\r
78 * Returns generation number
\r
79 * 0 means pre-2.1 index format
\r
80 * -1 means there are no segments files.
\r
82 * @param Zend_Search_Lucene_Storage_Directory $directory
\r
84 * @throws Zend_Search_Lucene_Exception
\r
86 public static function getActualGeneration(Zend_Search_Lucene_Storage_Directory $directory)
\r
88 require_once 'Zend/Search/Lucene/Exception.php';
\r
89 throw new Zend_Search_Lucene_Exception("Generation number can't be retrieved for multi-searcher");
\r
93 * Get segments file name
\r
95 * @param integer $generation
\r
98 public static function getSegmentFileName($generation)
\r
100 return Zend_Search_Lucene::getSegmentFileName($generation);
\r
104 * Get index format version
\r
107 * @throws Zend_Search_Lucene_Exception
\r
109 public function getFormatVersion()
\r
111 require_once 'Zend/Search/Lucene/Exception.php';
\r
112 throw new Zend_Search_Lucene_Exception("Format version can't be retrieved for multi-searcher");
\r
116 * Set index format version.
\r
117 * Index is converted to this format at the nearest upfdate time
\r
119 * @param int $formatVersion
\r
121 public function setFormatVersion($formatVersion)
\r
123 foreach ($this->_indices as $index) {
\r
124 $index->setFormatVersion($formatVersion);
\r
129 * Returns the Zend_Search_Lucene_Storage_Directory instance for this index.
\r
131 * @return Zend_Search_Lucene_Storage_Directory
\r
133 public function getDirectory()
\r
135 require_once 'Zend/Search/Lucene/Exception.php';
\r
136 throw new Zend_Search_Lucene_Exception("Index directory can't be retrieved for multi-searcher");
\r
140 * Returns the total number of documents in this index (including deleted documents).
\r
144 public function count()
\r
148 foreach ($this->_indices as $index) {
\r
149 $count += $this->_indices->count();
\r
156 * Returns one greater than the largest possible document number.
\r
157 * This may be used to, e.g., determine how big to allocate a structure which will have
\r
158 * an element for every document number in an index.
\r
162 public function maxDoc()
\r
164 return $this->count();
\r
168 * Returns the total number of non-deleted documents in this index.
\r
172 public function numDocs()
\r
176 foreach ($this->_indices as $index) {
\r
177 $docs += $this->_indices->numDocs();
\r
184 * Checks, that document is deleted
\r
186 * @param integer $id
\r
188 * @throws Zend_Search_Lucene_Exception Exception is thrown if $id is out of the range
\r
190 public function isDeleted($id)
\r
192 foreach ($this->_indices as $index) {
\r
193 $indexCount = $index->count();
\r
195 if ($indexCount > $id) {
\r
196 return $index->isDeleted($id);
\r
199 $id -= $indexCount;
\r
202 require_once 'Zend/Search/Lucene/Exception.php';
\r
203 throw new Zend_Search_Lucene_Exception('Document id is out of the range.');
\r
207 * Set default search field.
\r
209 * Null means, that search is performed through all fields by default
\r
211 * Default value is null
\r
213 * @param string $fieldName
\r
215 public static function setDefaultSearchField($fieldName)
\r
217 foreach ($this->_indices as $index) {
\r
218 $index->setDefaultSearchField($fieldName);
\r
224 * Get default search field.
\r
226 * Null means, that search is performed through all fields by default
\r
229 * @throws Zend_Search_Lucene_Exception
\r
231 public static function getDefaultSearchField()
\r
233 if (count($this->_indices) == 0) {
\r
234 require_once 'Zend/Search/Lucene/Exception.php';
\r
235 throw new Zend_Search_Lucene_Exception('Indices list is empty');
\r
238 $defaultSearchField = reset($this->_indices)->getDefaultSearchField();
\r
240 foreach ($this->_indices as $index) {
\r
241 if ($index->getDefaultSearchField() !== $defaultSearchField) {
\r
242 require_once 'Zend/Search/Lucene/Exception.php';
\r
243 throw new Zend_Search_Lucene_Exception('Indices have different default search field.');
\r
247 return $defaultSearchField;
\r
251 * Set result set limit.
\r
253 * 0 (default) means no limit
\r
255 * @param integer $limit
\r
257 public static function setResultSetLimit($limit)
\r
259 foreach ($this->_indices as $index) {
\r
260 $index->setResultSetLimit($limit);
\r
265 * Set result set limit.
\r
270 * @throws Zend_Search_Lucene_Exception
\r
272 public static function getResultSetLimit()
\r
274 if (count($this->_indices) == 0) {
\r
275 require_once 'Zend/Search/Lucene/Exception.php';
\r
276 throw new Zend_Search_Lucene_Exception('Indices list is empty');
\r
279 $defaultResultSetLimit = reset($this->_indices)->getResultSetLimit();
\r
281 foreach ($this->_indices as $index) {
\r
282 if ($index->getResultSetLimit() !== $defaultResultSetLimit) {
\r
283 require_once 'Zend/Search/Lucene/Exception.php';
\r
284 throw new Zend_Search_Lucene_Exception('Indices have different default search field.');
\r
288 return $defaultResultSetLimit;
\r
292 * Retrieve index maxBufferedDocs option
\r
294 * maxBufferedDocs is a minimal number of documents required before
\r
295 * the buffered in-memory documents are written into a new Segment
\r
297 * Default value is 10
\r
300 * @throws Zend_Search_Lucene_Exception
\r
302 public function getMaxBufferedDocs()
\r
304 if (count($this->_indices) == 0) {
\r
305 require_once 'Zend/Search/Lucene/Exception.php';
\r
306 throw new Zend_Search_Lucene_Exception('Indices list is empty');
\r
309 $maxBufferedDocs = reset($this->_indices)->getMaxBufferedDocs();
\r
311 foreach ($this->_indices as $index) {
\r
312 if ($index->getMaxBufferedDocs() !== $maxBufferedDocs) {
\r
313 require_once 'Zend/Search/Lucene/Exception.php';
\r
314 throw new Zend_Search_Lucene_Exception('Indices have different default search field.');
\r
318 return $maxBufferedDocs;
\r
322 * Set index maxBufferedDocs option
\r
324 * maxBufferedDocs is a minimal number of documents required before
\r
325 * the buffered in-memory documents are written into a new Segment
\r
327 * Default value is 10
\r
329 * @param integer $maxBufferedDocs
\r
331 public function setMaxBufferedDocs($maxBufferedDocs)
\r
333 foreach ($this->_indices as $index) {
\r
334 $index->setMaxBufferedDocs($maxBufferedDocs);
\r
339 * Retrieve index maxMergeDocs option
\r
341 * maxMergeDocs is a largest number of documents ever merged by addDocument().
\r
342 * Small values (e.g., less than 10,000) are best for interactive indexing,
\r
343 * as this limits the length of pauses while indexing to a few seconds.
\r
344 * Larger values are best for batched indexing and speedier searches.
\r
346 * Default value is PHP_INT_MAX
\r
349 * @throws Zend_Search_Lucene_Exception
\r
351 public function getMaxMergeDocs()
\r
353 if (count($this->_indices) == 0) {
\r
354 require_once 'Zend/Search/Lucene/Exception.php';
\r
355 throw new Zend_Search_Lucene_Exception('Indices list is empty');
\r
358 $maxMergeDocs = reset($this->_indices)->getMaxMergeDocs();
\r
360 foreach ($this->_indices as $index) {
\r
361 if ($index->getMaxMergeDocs() !== $maxMergeDocs) {
\r
362 require_once 'Zend/Search/Lucene/Exception.php';
\r
363 throw new Zend_Search_Lucene_Exception('Indices have different default search field.');
\r
367 return $maxMergeDocs;
\r
371 * Set index maxMergeDocs option
\r
373 * maxMergeDocs is a largest number of documents ever merged by addDocument().
\r
374 * Small values (e.g., less than 10,000) are best for interactive indexing,
\r
375 * as this limits the length of pauses while indexing to a few seconds.
\r
376 * Larger values are best for batched indexing and speedier searches.
\r
378 * Default value is PHP_INT_MAX
\r
380 * @param integer $maxMergeDocs
\r
382 public function setMaxMergeDocs($maxMergeDocs)
\r
384 foreach ($this->_indices as $index) {
\r
385 $index->setMaxMergeDocs($maxMergeDocs);
\r
390 * Retrieve index mergeFactor option
\r
392 * mergeFactor determines how often segment indices are merged by addDocument().
\r
393 * With smaller values, less RAM is used while indexing,
\r
394 * and searches on unoptimized indices are faster,
\r
395 * but indexing speed is slower.
\r
396 * With larger values, more RAM is used during indexing,
\r
397 * and while searches on unoptimized indices are slower,
\r
398 * indexing is faster.
\r
399 * Thus larger values (> 10) are best for batch index creation,
\r
400 * and smaller values (< 10) for indices that are interactively maintained.
\r
402 * Default value is 10
\r
405 * @throws Zend_Search_Lucene_Exception
\r
407 public function getMergeFactor()
\r
409 if (count($this->_indices) == 0) {
\r
410 require_once 'Zend/Search/Lucene/Exception.php';
\r
411 throw new Zend_Search_Lucene_Exception('Indices list is empty');
\r
414 $mergeFactor = reset($this->_indices)->getMergeFactor();
\r
416 foreach ($this->_indices as $index) {
\r
417 if ($index->getMergeFactor() !== $mergeFactor) {
\r
418 require_once 'Zend/Search/Lucene/Exception.php';
\r
419 throw new Zend_Search_Lucene_Exception('Indices have different default search field.');
\r
423 return $mergeFactor;
\r
427 * Set index mergeFactor option
\r
429 * mergeFactor determines how often segment indices are merged by addDocument().
\r
430 * With smaller values, less RAM is used while indexing,
\r
431 * and searches on unoptimized indices are faster,
\r
432 * but indexing speed is slower.
\r
433 * With larger values, more RAM is used during indexing,
\r
434 * and while searches on unoptimized indices are slower,
\r
435 * indexing is faster.
\r
436 * Thus larger values (> 10) are best for batch index creation,
\r
437 * and smaller values (< 10) for indices that are interactively maintained.
\r
439 * Default value is 10
\r
441 * @param integer $maxMergeDocs
\r
443 public function setMergeFactor($mergeFactor)
\r
445 foreach ($this->_indices as $index) {
\r
446 $index->setMaxMergeDocs($maxMergeDocs);
\r
451 * Performs a query against the index and returns an array
\r
452 * of Zend_Search_Lucene_Search_QueryHit objects.
\r
453 * Input is a string or Zend_Search_Lucene_Search_Query.
\r
455 * @param mixed $query
\r
456 * @return array Zend_Search_Lucene_Search_QueryHit
\r
457 * @throws Zend_Search_Lucene_Exception
\r
459 public function find($query)
\r
461 $hitsList = array();
\r
464 foreach ($this->_indices as $index) {
\r
465 $hits = $index->find($query);
\r
467 if ($indexShift != 0) {
\r
468 foreach ($hits as $hit) {
\r
469 $hit->id += $indexShift;
\r
473 $indexShift += $index->count();
\r
474 $hitsList[] = $hits;
\r
477 /** @todo Implement advanced sorting */
\r
479 return call_user_func_array('array_merge', $hitsList);
\r
483 * Returns a list of all unique field names that exist in this index.
\r
485 * @param boolean $indexed
\r
488 public function getFieldNames($indexed = false)
\r
490 $fieldNamesList = array();
\r
492 foreach ($this->_indices as $index) {
\r
493 $fieldNamesList[] = $index->getFieldNames($indexed);
\r
496 return array_unique(call_user_func_array('array_merge', $fieldNamesList));
\r
500 * Returns a Zend_Search_Lucene_Document object for the document
\r
501 * number $id in this index.
\r
503 * @param integer|Zend_Search_Lucene_Search_QueryHit $id
\r
504 * @return Zend_Search_Lucene_Document
\r
505 * @throws Zend_Search_Lucene_Exception Exception is thrown if $id is out of the range
\r
507 public function getDocument($id)
\r
509 if ($id instanceof Zend_Search_Lucene_Search_QueryHit) {
\r
510 /* @var $id Zend_Search_Lucene_Search_QueryHit */
\r
514 foreach ($this->_indices as $index) {
\r
515 $indexCount = $index->count();
\r
517 if ($indexCount > $id) {
\r
518 return $index->getDocument($id);
\r
521 $id -= $indexCount;
\r
524 require_once 'Zend/Search/Lucene/Exception.php';
\r
525 throw new Zend_Search_Lucene_Exception('Document id is out of the range.');
\r
529 * Returns true if index contain documents with specified term.
\r
531 * Is used for query optimization.
\r
533 * @param Zend_Search_Lucene_Index_Term $term
\r
536 public function hasTerm(Zend_Search_Lucene_Index_Term $term)
\r
538 foreach ($this->_indices as $index) {
\r
539 if ($index->hasTerm($term)) {
\r
548 * Returns IDs of all the documents containing term.
\r
550 * @param Zend_Search_Lucene_Index_Term $term
\r
551 * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter
\r
553 * @throws Zend_Search_Lucene_Exception
\r
555 public function termDocs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null)
\r
557 if ($docsFilter != null) {
\r
558 require_once 'Zend/Search/Lucene/Exception.php';
\r
559 throw new Zend_Search_Lucene_Exception('Document filters could not used with multi-searcher');
\r
562 $docsList = array();
\r
565 foreach ($this->_indices as $index) {
\r
566 $docs = $index->termDocs($term);
\r
568 if ($indexShift != 0) {
\r
569 foreach ($docs as $id => $docId) {
\r
570 $docs[$id] += $indexShift;
\r
574 $indexShift += $index->count();
\r
575 $docsList[] = $docs;
\r
578 return call_user_func_array('array_merge', $docsList);
\r
582 * Returns documents filter for all documents containing term.
\r
584 * It performs the same operation as termDocs, but return result as
\r
585 * Zend_Search_Lucene_Index_DocsFilter object
\r
587 * @param Zend_Search_Lucene_Index_Term $term
\r
588 * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter
\r
589 * @return Zend_Search_Lucene_Index_DocsFilter
\r
590 * @throws Zend_Search_Lucene_Exception
\r
592 public function termDocsFilter(Zend_Search_Lucene_Index_Term $term, $docsFilter = null)
\r
594 require_once 'Zend/Search/Lucene/Exception.php';
\r
595 throw new Zend_Search_Lucene_Exception('Document filters could not used with multi-searcher');
\r
599 * Returns an array of all term freqs.
\r
600 * Return array structure: array( docId => freq, ...)
\r
602 * @param Zend_Search_Lucene_Index_Term $term
\r
603 * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter
\r
605 * @throws Zend_Search_Lucene_Exception
\r
607 public function termFreqs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null)
\r
609 if ($docsFilter != null) {
\r
610 require_once 'Zend/Search/Lucene/Exception.php';
\r
611 throw new Zend_Search_Lucene_Exception('Document filters could not used with multi-searcher');
\r
614 $freqsList = array();
\r
617 foreach ($this->_indices as $index) {
\r
618 $freqs = $index->termFreqs($term);
\r
620 if ($indexShift != 0) {
\r
621 $freqsShifted = array();
\r
623 foreach ($freqs as $docId => $freq) {
\r
624 $freqsShifted[$docId + $indexShift] = $freq;
\r
626 $freqs = $freqsShifted;
\r
629 $indexShift += $index->count();
\r
630 $freqsList[] = $freqs;
\r
633 return call_user_func_array('array_merge', $freqsList);
\r
637 * Returns an array of all term positions in the documents.
\r
638 * Return array structure: array( docId => array( pos1, pos2, ...), ...)
\r
640 * @param Zend_Search_Lucene_Index_Term $term
\r
641 * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter
\r
643 * @throws Zend_Search_Lucene_Exception
\r
645 public function termPositions(Zend_Search_Lucene_Index_Term $term, $docsFilter = null)
\r
647 if ($docsFilter != null) {
\r
648 require_once 'Zend/Search/Lucene/Exception.php';
\r
649 throw new Zend_Search_Lucene_Exception('Document filters could not used with multi-searcher');
\r
652 $termPositionsList = array();
\r
655 foreach ($this->_indices as $index) {
\r
656 $termPositions = $index->termPositions($term);
\r
658 if ($indexShift != 0) {
\r
659 $termPositionsShifted = array();
\r
661 foreach ($termPositions as $docId => $positions) {
\r
662 $termPositions[$docId + $indexShift] = $positions;
\r
664 $termPositions = $termPositionsShifted;
\r
667 $indexShift += $index->count();
\r
668 $termPositionsList[] = $termPositions;
\r
671 return call_user_func_array('array_merge', $termPositions);
\r
675 * Returns the number of documents in this index containing the $term.
\r
677 * @param Zend_Search_Lucene_Index_Term $term
\r
680 public function docFreq(Zend_Search_Lucene_Index_Term $term)
\r
684 foreach ($this->_indices as $index) {
\r
685 $docFreq += $index->docFreq($term);
\r
692 * Retrive similarity used by index reader
\r
694 * @return Zend_Search_Lucene_Search_Similarity
\r
695 * @throws Zend_Search_Lucene_Exception
\r
697 public function getSimilarity()
\r
699 if (count($this->_indices) == 0) {
\r
700 require_once 'Zend/Search/Lucene/Exception.php';
\r
701 throw new Zend_Search_Lucene_Exception('Indices list is empty');
\r
704 $similarity = reset($this->_indices)->getSimilarity();
\r
706 foreach ($this->_indices as $index) {
\r
707 if ($index->getSimilarity() !== $similarity) {
\r
708 require_once 'Zend/Search/Lucene/Exception.php';
\r
709 throw new Zend_Search_Lucene_Exception('Indices have different similarity.');
\r
713 return $similarity;
\r
717 * Returns a normalization factor for "field, document" pair.
\r
719 * @param integer $id
\r
720 * @param string $fieldName
\r
723 public function norm($id, $fieldName)
\r
725 foreach ($this->_indices as $index) {
\r
726 $indexCount = $index->count();
\r
728 if ($indexCount > $id) {
\r
729 return $index->norm($id, $fieldName);
\r
732 $id -= $indexCount;
\r
739 * Returns true if any documents have been deleted from this index.
\r
743 public function hasDeletions()
\r
745 foreach ($this->_indices as $index) {
\r
746 if ($index->hasDeletions()) {
\r
755 * Deletes a document from the index.
\r
756 * $id is an internal document id
\r
758 * @param integer|Zend_Search_Lucene_Search_QueryHit $id
\r
759 * @throws Zend_Search_Lucene_Exception
\r
761 public function delete($id)
\r
763 foreach ($this->_indices as $index) {
\r
764 $indexCount = $index->count();
\r
766 if ($indexCount > $id) {
\r
767 $index->delete($id);
\r
771 $id -= $indexCount;
\r
774 require_once 'Zend/Search/Lucene/Exception.php';
\r
775 throw new Zend_Search_Lucene_Exception('Document id is out of the range.');
\r
780 * Callback used to choose target index for new documents
\r
782 * Function/method signature:
\r
783 * Zend_Search_Lucene_Interface callbackFunction(Zend_Search_Lucene_Document $document, array $indices);
\r
785 * null means "default documents distributing algorithm"
\r
789 protected $_documentDistributorCallBack = null;
\r
792 * Set callback for choosing target index.
\r
794 * @param callback $callback
\r
796 public function setDocumentDistributorCallback($callback)
\r
798 if ($callback !== null && !is_callable($callback))
\r
799 $this->_documentDistributorCallBack = $callback;
\r
803 * Get callback for choosing target index.
\r
807 public function getDocumentDistributorCallback()
\r
809 return $this->_documentDistributorCallBack;
\r
813 * Adds a document to this index.
\r
815 * @param Zend_Search_Lucene_Document $document
\r
816 * @throws Zend_Search_Lucene_Exception
\r
818 public function addDocument(Zend_Search_Lucene_Document $document)
\r
820 if ($this->_documentDistributorCallBack !== null) {
\r
821 $index = call_user_func($this->_documentDistributorCallBack, $document, $this->_indices);
\r
823 $index = $this->_indices[ array_rand($this->_indices) ];
\r
826 $index->addDocument($document);
\r
830 * Commit changes resulting from delete() or undeleteAll() operations.
\r
832 public function commit()
\r
834 foreach ($this->_indices as $index) {
\r
842 * Merges all segments into one
\r
844 public function optimize()
\r
846 foreach ($this->_indices as $index) {
\r
847 $index->_optimise();
\r
852 * Returns an array of all terms in this index.
\r
856 public function terms()
\r
858 $termsList = array();
\r
860 foreach ($this->_indices as $index) {
\r
861 $termsList[] = $index->terms();
\r
864 return array_unique(call_user_func_array('array_merge', $termsList));
\r
869 * Terms stream priority queue object
\r
871 * @var Zend_Search_Lucene_TermStreamsPriorityQueue
\r
873 private $_termsStream = null;
\r
876 * Reset terms stream.
\r
878 public function resetTermsStream()
\r
880 if ($this->_termsStream === null) {
\r
881 $this->_termsStream = new Zend_Search_Lucene_TermStreamsPriorityQueue($this->_indices);
\r
883 $this->_termsStream->resetTermsStream();
\r
888 * Skip terms stream up to specified term preffix.
\r
890 * Prefix contains fully specified field info and portion of searched term
\r
892 * @param Zend_Search_Lucene_Index_Term $prefix
\r
894 public function skipTo(Zend_Search_Lucene_Index_Term $prefix)
\r
896 $this->_termsStream->skipTo($prefix);
\r
900 * Scans terms dictionary and returns next term
\r
902 * @return Zend_Search_Lucene_Index_Term|null
\r
904 public function nextTerm()
\r
906 return $this->_termsStream->nextTerm();
\r
910 * Returns term in current position
\r
912 * @return Zend_Search_Lucene_Index_Term|null
\r
914 public function currentTerm()
\r
916 return $this->_termsStream->currentTerm();
\r
920 * Close terms stream
\r
922 * Should be used for resources clean up if stream is not read up to the end
\r
924 public function closeTermsStream()
\r
926 $this->_termsStream->closeTermsStream();
\r
927 $this->_termsStream = null;
\r
932 * Undeletes all documents currently marked as deleted in this index.
\r
934 public function undeleteAll()
\r
936 foreach ($this->_indices as $index) {
\r
937 $index->undeleteAll();
\r
943 * Add reference to the index object
\r
947 public function addReference()
\r
949 // Do nothing, since it's never referenced by indices
\r
953 * Remove reference from the index object
\r
955 * When reference count becomes zero, index is closed and resources are cleaned up
\r
959 public function removeReference()
\r
961 // Do nothing, since it's never referenced by indices
\r