Пример #1
0
 public function testOpenFile()
 {
     $file = '/tmp/xs_test.dat';
     file_exists($file) && unlink($file);
     clearstatcache();
     $this->assertFalse(file_exists($file));
     $this->object->open('file:///tmp/xs_test.dat');
     $this->assertTrue(file_exists($file));
     clearstatcache();
     $this->assertEquals(0, filesize($file));
     $this->object->sendCommand(CMD_NONE);
     clearstatcache();
     $this->assertEquals(8, filesize($file));
     clearstatcache();
     $this->assertTrue($this->object->execCommand(CMD_DOC_INDEX));
     $this->assertEquals(8, filesize($file));
     clearstatcache();
     $this->assertTrue($this->object->execCommand(CMD_DEBUG));
     $this->assertEquals(24, filesize($file));
     clearstatcache();
     $this->assertTrue($this->object->execCommand(CMD_DOC_TERM));
     $this->assertEquals(24, filesize($file));
     clearstatcache();
     $this->object->close();
     $this->assertEquals(32, filesize($file));
     $this->object->reopen();
     clearstatcache();
     $this->assertEquals(0, filesize($file));
     $this->object->close();
     unlink($file);
 }
Пример #2
0
 /**
  * 连接搜索服务端并初始化
  * 每次重新连接后所有的搜索语句相关设置均被还原
  * @param string $conn
  * @see XSServer::open
  */
 public function open($conn)
 {
     parent::open($conn);
     $this->_prefix = array();
     $this->_fieldSet = false;
     $this->_lastCount = false;
 }