示例#1
0
#!/usr/bin/env php
<?php 
/**
 * Xunsearch PHP-SDK 搜索骨架代码生成工具
 *
 * @author hightman
 * @link http://www.xunsearch.com/
 * @copyright Copyright &copy; 2011 HangZhou YunSheng Network Technology Co., Ltd.
 * @license http://www.xunsearch.com/license/
 * @version $Id$
 */
require_once dirname(__FILE__) . '/../lib/XS.php';
require_once dirname(__FILE__) . '/XSUtil.class.php';
// check arguments
XSUtil::parseOpt(array('p', 'o', 'project', 'output'));
$project = XSUtil::getOpt('p', 'project', true);
if (XSUtil::getOpt('h', 'help') !== null || !is_string($project)) {
    $version = PACKAGE_NAME . '/' . PACKAGE_VERSION;
    echo <<<EOF
SearchSkel - 搜索骨架代码生成工具 ({$version})

用法
    {$_SERVER['argv'][0]} [options] [-p|--project] <project> [[-o|--output] <dir>]
\t
选项说明
    --project=<name|ini>
    -p <project> 用于指定要搜索的项目名称或项目配置文件的路径,
                 如果指定的是名称,则使用 ../app/<name>.ini 作为配置文件
    --output=<dir>\t
    -o <dir>     指定生成的骨架代码存储位置,默认为当前目录
    -h|--help    显示帮助信息
示例#2
0
文件: Indexer.php 项目: lughong/test
 * @author hightman
 * @link http://www.xunsearch.com/
 * @copyright Copyright &copy; 2011 HangZhou YunSheng Network Technology Co., Ltd.
 * @license http://www.xunsearch.com/license/
 * @version $Id$
 */
$lib_file = dirname(__FILE__) . '/../lib/XS.php';
if (!file_exists($lib_file)) {
    $lib_file = dirname(__FILE__) . '/../lib/XS.class.php';
}
require_once $lib_file;
require_once dirname(__FILE__) . '/XSUtil.class.php';
require_once dirname(__FILE__) . '/XSDataSource.class.php';
// check arguments
//ini_set('memory_limit', '1024M');
XSUtil::parseOpt(array('p', 'c', 'd', 'project', 'charset', 'db', 'source', 'file', 'sql', 'csv-delimiter', 'add-synonym', 'del-synonym'));
$project = XSUtil::getOpt('p', 'project', true);
// magick output charset
$charset = XSUtil::getOpt('c', 'charset');
XSUtil::setCharset($charset);
// long options
$params = array('source', 'file', 'sql', 'rebuild', 'clean', 'flush', 'flush-log', 'info', 'csv-delimiter', 'filter');
$params[] = 'add-synonym';
$params[] = 'del-synonym';
$params[] = 'stop-rebuild';
$params[] = 'custom-dict';
foreach ($params as $_) {
    $k = strtr($_, '-', '_');
    ${$k} = XSUtil::getOpt(null, $_);
}
// file & database
示例#3
0
#!/usr/bin/env php
<?php 
/**
 * Xunsearch PHP-SDK 运行条件检测
 *
 * @author hightman
 * @link http://www.xunsearch.com/
 * @copyright Copyright &copy; 2011 HangZhou YunSheng Network Technology Co., Ltd.
 * @license http://www.xunsearch.com/license/
 * @version $Id$
 */
require_once dirname(__FILE__) . '/../lib/XS.php';
require dirname(__FILE__) . '/XSUtil.class.php';
// magick output charset
XSUtil::parseOpt(array('c', 'charset'));
$charset = XSUtil::getOpt('c', 'charset');
XSUtil::setCharset($charset);
// result number record
$result = array('PHP 版本' => array('type' => (version_compare(PHP_VERSION, '5.2.0', '>=') ? '' : 'ERROR:') . PHP_VERSION, 'used' => 'XS(core)', 'note' => 'PHP 5.2.0 或更高版本是必须的。'), 'SPL 扩展' => array('type' => extension_loaded('spl') ? 'OK' : 'ERROR', 'used' => 'XS(core)', 'note' => 'SPL 扩展用于自动加载和对象戏法'), 'PCRE 扩展' => array('type' => extension_loaded('pcre') ? 'OK' : 'ERROR', 'used' => 'XSDocument, XSSearch', 'note' => '用于字符串切割、判断'), '编码转换' => array('type' => check_conv(), 'used' => 'XSDocument, XSSearch', 'note' => '用于支持非 UTF-8 字符集'), '缓存模块' => array('type' => check_cache(), 'used' => 'XS', 'note' => '用于缓存项目配置文件的解析结果'), 'JSON 扩展' => array('type' => extension_loaded('json') ? 'OK' : 'WARNING', 'used' => 'util.Quest, util.Indexer', 'note' => '用于读取或输出 JSON 格式的数据'), 'XML 扩展' => array('type' => extension_loaded('xml') ? 'OK' : 'WARNING', 'used' => 'util.Indexer', 'note' => '用于读取导入 XML 格式的数据'), 'MySQL 扩展' => array('type' => check_mysql(), 'used' => 'util.Indexer', 'note' => '用于读取导入 MySQL 的数据库'), 'SQLite 扩展' => array('type' => check_sqlite(), 'used' => 'util.Indexer', 'note' => '用于读取导入 SQLite 的数据库'));
// output
?>
Xunsearch PHP-SDK 运行需求检查
==============================

检查内容
--------

本程序用于确认您的服务器配置是否能满足运行 Xunsearch PHP-SDK 的要求。
它将检查服务器所运行的 PHP 版本,查看是否安装了合适的PHP扩展模块,以及
确认 php.ini 文件是否正确设置。
示例#4
0
 * Xunsearch PHP-SDK 搜索日志管理工具
 * 
 * @author hpxl
 * @link http://www.xunsearch.com/
 * @copyright Copyright &copy; 2011 HangZhou YunSheng Network Technology Co., Ltd.
 * @license http://www.xunsearch.com/license/
 * @version $Id$ 
 */
$lib_file = dirname(__FILE__) . '/../lib/XS.php';
if (!file_exists($lib_file)) {
    $lib_file = dirname(__FILE__) . '/../lib/XS.class.php';
}
require_once $lib_file;
require_once dirname(__FILE__) . '/XSUtil.class.php';
// check arguments
XSUtil::parseOpt(array('p', 'c', 'project', 'charset', 'hot', 'del', 'put', 'query', 'import', 'limit'));
$project = XSUtil::getOpt('p', 'project', true);
$query = XSUtil::getOpt(null, 'query', true);
// magick output charset
$charset = XSUtil::getOpt('c', 'charset');
XSUtil::setCharset($charset);
// long options
$params = array('import', 'del', 'put', 'flush', 'hot', 'clean', 'limit');
foreach ($params as $_) {
    $k = strtr($_, '-', '_');
    ${$k} = XSUtil::getOpt(null, $_);
}
if ($query === null && $put === null && $del === null && $flush === null && $import === null && $hot === null && $clean === null) {
    $hot = 'total';
}
// help message
示例#5
0
文件: Quest.php 项目: Kuner/xunsearch
 * Xunsearch PHP-SDK 搜索测试工具
 *
 * @author hightman
 * @link http://www.xunsearch.com/
 * @copyright Copyright &copy; 2011 HangZhou YunSheng Network Technology Co., Ltd.
 * @license http://www.xunsearch.com/license/
 * @version $Id$
 */
$lib_file = dirname(__FILE__) . '/../lib/XS.php';
if (!file_exists($lib_file)) {
    $lib_file = dirname(__FILE__) . '/../lib/XS.class.php';
}
require_once $lib_file;
require_once dirname(__FILE__) . '/XSUtil.class.php';
// check arguments
XSUtil::parseOpt(array('p', 'q', 'c', 'd', 's', 'project', 'query', 'db', 'limit', 'charset', 'sort', 'add-weight', 'scws-multi', 'cut-off'));
$project = XSUtil::getOpt('p', 'project', true);
$query = XSUtil::getOpt('q', 'query', true);
$hot = XSUtil::getOpt(null, 'hot');
$synonyms = XSUtil::getOpt(null, 'list-synonyms', false);
$terms = XSUtil::getOpt(null, 'terms');
$weights = XSUtil::getOpt(null, 'add-weight');
$info = XSUtil::getOpt(null, 'info');
$scws_multi = XSUtil::getOpt(null, 'scws-multi');
$cut_off = XSUtil::getOpt(null, 'cut-off');
// magick output charset
$charset = XSUtil::getOpt('c', 'charset');
XSUtil::setCharset($charset);
$query = XSUtil::convertIn($query);
// sort scheme
$sort = XSUtil::getOpt('s', 'sort');
示例#6
0
#!/usr/bin/env php
<?php 
/**
 * Xunsearch PHP-SDK 搜索测试工具
 *
 * @author hightman
 * @link http://www.xunsearch.com/
 * @copyright Copyright &copy; 2011 HangZhou YunSheng Network Technology Co., Ltd.
 * @license http://www.xunsearch.com/license/
 * @version $Id$
 */
require_once dirname(__FILE__) . '/../lib/XS.php';
require_once dirname(__FILE__) . '/XSUtil.class.php';
// check arguments
XSUtil::parseOpt(array('p', 'q', 'c', 'd', 'project', 'query', 'db', 'limit', 'charset'));
$project = XSUtil::getOpt('p', 'project', true);
$query = XSUtil::getOpt('q', 'query', true);
$hot = XSUtil::getOpt(null, 'hot');
$synonyms = XSUtil::getOpt(null, 'list-synonyms');
// magick output charset
$charset = XSUtil::getOpt('c', 'charset');
XSUtil::setCharset($charset);
$query = XSUtil::convertIn($query);
if (XSUtil::getOpt('h', 'help') !== null || !is_string($project) || !$hot && !$synonyms && !is_string($query)) {
    $version = PACKAGE_NAME . '/' . PACKAGE_VERSION;
    echo <<<EOF
Quest - 搜索查询和测试工具 ({$version})

用法
    {$_SERVER['argv'][0]} [options] [-p|--project] <project> [[-q|--query] <query>]
\t
示例#7
0
#!/usr/bin/env php
<?php 
// Xunsearch server burst test file (standalone)
// Usage: burst.php
// $Id$
require_once dirname(__FILE__) . '/../util/XSUtil.class.php';
// check arguments
XSUtil::parseOpt(array('i', 'c', 't'));
$test_con = XSUtil::getOpt('c', null, true);
$test_type = XSUtil::getOpt('t');
$test_index = XSUtil::getOpt('i');
if ($test_type !== 'search') {
    $test_type = 'index';
}
if ($test_index === null && $test_con === null) {
    $test_con = 100;
}
// show help
if (XSUtil::getOpt('h', 'help') !== null || $test_con == null && $test_index == null) {
    echo <<<EOF
Burst - XS 服务端并发测试工具

用法
    {$_SERVER['argv'][0]} [options] [-c|-i] <num>
\t
选项说明
    -c <num>     设置测试的并发总量,用于启动进程,默认 100
    -i <num>     设置测试的序列,用于实际运行进程
    -t <type>    设置测试的类型,其值为 index 或 search,默认为 index
    -h|--help    显示帮助说明