使用 PHP XML-RPC 执行 DokuWiki 搜索


Performing DokuWiki search with PHP XML-RPC

我有一个简单的服务,它包装了通过 PHP XML-RPC 库进行的 DokuWiki 调用(https://www.dokuwiki.org/devel:xmlrpc#accessing_the_xml-rpc_interface)。我正在尝试执行 DokuWiki 搜索,但似乎无法让它工作。以下是我的服务中的相关功能:

public function search($query)
{
    echo $query . "'n";
    // initialize the new message for the search method call
    $message = new xmlrpcmsg('dokuwiki.search');
    $message->addParam(new xmlrpcval($query, "string"));
    // return message results based on XMLRPC server response
    return $this->getResults( $this->_client->send($message) );
}
private function getResults($response)
{
    if( !$response->faultCode() ) {
       return $response->value();
    }
    throw new Exception( $response->faultString() );
}

我的客户端代码正在根据查询语法进行搜索(此处 https://www.dokuwiki.org/search 概述):

function searchWiki($dokuwiki, $search, $ns)
{
   $query = "[ $search @$ns ]";
   return $dokuwiki->search($query);
}

但是,无论搜索查询是什么,它似乎都不会产生任何搜索结果。 例如,

Query:
[ user @detailed-manuals ]
Result:
object(xmlrpcval)#5 (3) {
  ["me"]=>
  array(1) {
    ["array"]=>
    array(0) {
    }
  }
  ["mytype"]=>
  int(2)
  ["_php_class"]=>
  NULL
}

即使在全局命名空间中搜索也不会产生任何结果,尽管它应该作为术语"user"出现任意次数。如果有人能提供见解,那将是最有帮助的。

问题是我需要执行indexer.php脚本,以根据下面的链接索引 DokuWiki 安装中的所有页面。运行脚本后,我得到了很多结果。

https://www.dokuwiki.org/indexer