|
|
@@ -69,8 +69,8 @@ class Zend_Search_Lucene_LuceneTest extends PHPUnit_Framework_TestCase
|
|
|
public function testCreate()
|
|
|
{
|
|
|
$index = Zend_Search_Lucene::create(dirname(__FILE__) . '/_index/_files');
|
|
|
-
|
|
|
$this->assertTrue($index instanceof Zend_Search_Lucene_Interface);
|
|
|
+ unset($index);
|
|
|
|
|
|
$this->_clearDirectory(dirname(__FILE__) . '/_index/_files');
|
|
|
}
|
|
|
@@ -323,6 +323,7 @@ class Zend_Search_Lucene_LuceneTest extends PHPUnit_Framework_TestCase
|
|
|
|
|
|
$index1 = Zend_Search_Lucene::open(dirname(__FILE__) . '/_index/_files');
|
|
|
$this->assertTrue($index1 instanceof Zend_Search_Lucene_Interface);
|
|
|
+ unset($index1);
|
|
|
|
|
|
$this->_clearDirectory(dirname(__FILE__) . '/_index/_files');
|
|
|
}
|
|
|
@@ -381,6 +382,7 @@ class Zend_Search_Lucene_LuceneTest extends PHPUnit_Framework_TestCase
|
|
|
|
|
|
$hits = $index2->find('submitting');
|
|
|
$this->assertEquals(count($hits), 3);
|
|
|
+ unset($index2);
|
|
|
|
|
|
$this->_clearDirectory(dirname(__FILE__) . '/_index/_files');
|
|
|
}
|
|
|
@@ -466,6 +468,7 @@ class Zend_Search_Lucene_LuceneTest extends PHPUnit_Framework_TestCase
|
|
|
$this->assertTrue($index->currentTerm() === null);
|
|
|
|
|
|
$index->closeTermsStream();
|
|
|
+ unset($index);
|
|
|
|
|
|
$this->_clearDirectory(dirname(__FILE__) . '/_index/_files');
|
|
|
}
|
|
|
@@ -490,6 +493,7 @@ class Zend_Search_Lucene_LuceneTest extends PHPUnit_Framework_TestCase
|
|
|
$this->assertTrue($index->currentTerm() === null);
|
|
|
|
|
|
$index->closeTermsStream();
|
|
|
+ unset($index);
|
|
|
|
|
|
$this->_clearDirectory(dirname(__FILE__) . '/_index/_files');
|
|
|
}
|
|
|
@@ -514,6 +518,39 @@ class Zend_Search_Lucene_LuceneTest extends PHPUnit_Framework_TestCase
|
|
|
$this->assertTrue($index->currentTerm() == new Zend_Search_Lucene_Index_Term('word', 'contents'));
|
|
|
|
|
|
$index->closeTermsStream();
|
|
|
+ unset($index);
|
|
|
+
|
|
|
+ $this->_clearDirectory(dirname(__FILE__) . '/_index/_files');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @group ZF-7518
|
|
|
+ */
|
|
|
+ public function testTermsStreamInterfaceSkipToMatchedTerm()
|
|
|
+ {
|
|
|
+ $index = Zend_Search_Lucene::create(dirname(__FILE__) . '/_index/_files');
|
|
|
+
|
|
|
+ $doc = new Zend_Search_Lucene_Document();
|
|
|
+ $doc->addField(Zend_Search_Lucene_Field::Keyword('test', 'f'));
|
|
|
+ $index->addDocument($doc);
|
|
|
+
|
|
|
+ unset($index);
|
|
|
+
|
|
|
+
|
|
|
+ $index = Zend_Search_Lucene::open(dirname(__FILE__) . '/_index/_files');
|
|
|
+
|
|
|
+ $hits = $index->find('test:[a TO t]');
|
|
|
+ $this->assertEquals(1, count($hits));
|
|
|
+ $this->assertEquals(0, reset($hits)->id);
|
|
|
+
|
|
|
+ $hits = $index->find('test:f');
|
|
|
+ $this->assertEquals(1, count($hits));
|
|
|
+ $this->assertEquals(0, reset($hits)->id);
|
|
|
+
|
|
|
+ $hits = $index->find('test:g');
|
|
|
+ $this->assertEquals(0, count($hits));
|
|
|
+
|
|
|
+ unset($index);
|
|
|
|
|
|
$this->_clearDirectory(dirname(__FILE__) . '/_index/_files');
|
|
|
}
|
|
|
@@ -533,6 +570,7 @@ class Zend_Search_Lucene_LuceneTest extends PHPUnit_Framework_TestCase
|
|
|
$index->addDocument($document);
|
|
|
|
|
|
$this->assertFalse($index->isDeleted(0));
|
|
|
+ unset($index);
|
|
|
|
|
|
$this->_clearDirectory(dirname(__FILE__) . '/_index/_files');
|
|
|
}
|