...sts($data) && ($data = file_get_contents($data)) === false) { throw new XSException('Failed to read exdata from file'); } // try to check allowed (BUG: check the first cmd only): // XS_CMD_IMPORT_HEADER, XS_CMD_INDEX_REQUEST, XS_CMD_INDEX_REMOVE, XS_CMD_INDEX_EXDATA $first = ord(s...
.../ create command object if (!$cmd instanceof XSCommand) { $cmd = new XSCommand($cmd); } // just cache the cmd for those need not answer if ($cmd->cmd & 0x80) { $this->_sendBuffer .= $cmd; return true; } // send cmd to server $buf = $this->_sendBuffer . $cmd;...
... > 0 ? $this->_limit : self::PAGE_SIZE); // get result header $cmd = new XSCommand(XS_CMD_SEARCH_GET_RESULT, 0, $this->_defaultOp, $query, $page); $res = $this->execCommand($cmd, XS_CMD_OK_RESULT_BEGIN); $tmp = unpack('Icount', $res->buf); $this->_lastCount = $tmp['count']; // load...
...52): Unexpected respond in search {CMD:129, ARG:514} 代码如下 $xs = new XS('discuz'); $tokenizer = new XSTokenizerScws; $subject = $tokenizer->getTops($forumattr['subject'], 20, 'n,ns'); $stack = array(); foreach($subject as $word) { array_push($stack, $word['word']); } $subject = implode(' ...
...关数据 require_once '/usr/local/xunsearch/sdk/php/lib/XS.php'; $xs = new XS('goods'); $data = array( 'goods_id' => 112, 'goods_name' => 'hello my goodsname', 'goods_sn' => 'RX8899-114' ); $doc = new XSDocument; $doc->setFields($data); $xs->index->add($doc); 3....
...sts($data) && ($data = file_get_contents($data)) === false) { throw new XSException('Failed to read exdata from file'); } // try to check allowed (BUG: check the first cmd only): // XS_CMD_IMPORT_HEADER, XS_CMD_INDEX_REQUEST, XS_CMD_INDEX_REMOVE, XS_CMD_INDEX_EXDATA $first = ord(s...
... protected function check(){ if ($this->_sock === null) { throw new XSException('No server connection'); } if ($this->_flag & self::BROKEN) { throw new XSException('Broken server connection'); }} 检测服务端的连接情况 close() 方法 public void close...
...值,也支持数组下标方式访问文档字段。 ~~~ [php] $doc = new XSDocument; $doc->name = 'value'; // 用对象属性方式进行赋值、取值 $doc['name'] = 'value'; // 用数组下标方式进行赋值、取值 $value = $doc->f('name'); // 用函数方式进行取值 $doc->setField('...
...eld, $asc, $relevance_first); } if ($field === null) { $cmd = new XSCommand(XS_CMD_SEARCH_SET_SORT, XS_CMD_SORT_TYPE_RELEVANCE); } else { $type = XS_CMD_SORT_TYPE_VALUE; if ($relevance_first) { $type |= XS_CMD_SORT_FLAG_RELEVANCE; } if ($asc) { ...
....search']) ? $this->_config['server.search'] : 8384; $this->_scws = new XSServer($conn, $this); } return $this->_scws;} 创建 scws 分词连接