0

WIN XPにsphinxをインストールしましたが、インストールが成功したかどうかわかりません。sphinx の設定ファイルの内容は以下で、位置は f:/sphinx/sphinx.conf です。

私の環境は次
のとおりです 。1) sphinx のディレクトリ: f:/sphinx/,config ファイルのパス: f:/sphinx/shpinx.conf
2) データベース: tbdb.ratedat。sphinx バージョン:sphinx-for-chinese-2.1.0-dev-r3361-win32.zip
3) Apache/2.4.4(win32) PHP/5.4.16、MYSQL バージョン: 5.6.12

source srcDB
{
    type            = mysql

    sql_host        = localhost
    sql_user        = root
    sql_pass        = zbphp.com~$
    sql_db          = tbdb
    sql_port        = 3306

    sql_query_pre   = SET NAMES utf8
    #sql_query_pre   = SET SESSION query_cache_type=OFF

    sql_query       = \
        SELECT trade_id,trade_time,goods_title,goods_price,uid_buy,uid_sell \
        FROM ratedat

    sql_attr_bigint     = trade_id
    sql_attr_bigint     = uid_buy
    sql_attr_bigint     = uid_sell
    sql_attr_timestamp  = trade_time
    sql_attr_string     = goods_title
    sql_attr_string     = rate_txt

    sql_query_info      = SELECT * FROM ratedat WHERE trade_id=$id
}


index goods_title
{
    source  =   srcDB
    path    =   F:/sphinx/data/ratedat.goods_title
    charset_type    =   utf-8
    html_strip      = 1
}


indexer
{
    mem_limit       = 128M
}


searchd
{
    listen          = 9312
    listen          = 9306:mysql41
    log         = F:/sphinx/log/searchd.log
    query_log       = F:/sphinx/log/query.log
    read_timeout        = 5
    max_children        = 30
    pid_file        = F:/sphinx/log/searchd.pid
    max_matches     = 1000
    seamless_rotate     = 1
    preopen_indexes     = 1
    unlink_old      = 1
    workers         = threads # for RT to work
    binlog_path     = F:/sphinx/data
}

私のインストールバットファイル
パス: f:/sphinx/install.bat
コード: 以下

net stop SphinxSearch
sc delete SphinxSearch
del /s/q %cd%\log\*.*
del /s/q %cd%\data\*.*

%cd%\bin\searchd --install --config %cd%\sphinx.conf --servicename SphinxSearch
%cd%\bin\indexer -c %cd%\sphinx.conf --all

net start SphinxSearch
pause


install.bat 実行時の出力メッセージ

F:\sphinx>net stop SphinxSearch
SphinxSearch 服务正在停止..
SphinxSearch 服务已成功停止。


F:\sphinx>sc delete SphinxSearch
[SC] DeleteService SUCCESS

F:\sphinx>del /s/q F:\sphinx\log\*.*
delfile - F:\sphinx\log\query.log
delfile - F:\sphinx\log\searchd.log

F:\sphinx>del /s/q F:\sphinx\data\*.*
delfile - F:\sphinx\data\binlog.001
delfile - F:\sphinx\data\binlog.meta
delfile - F:\sphinx\data\ratedat.goods_title.spa
delfile - F:\sphinx\data\ratedat.goods_title.spd
delfile - F:\sphinx\data\ratedat.goods_title.spe
delfile - F:\sphinx\data\ratedat.goods_title.sph
delfile - F:\sphinx\data\ratedat.goods_title.spi
delfile - F:\sphinx\data\ratedat.goods_title.spk
delfile - F:\sphinx\data\ratedat.goods_title.spm
delfile - F:\sphinx\data\ratedat.goods_title.spp
delfile - F:\sphinx\data\ratedat.goods_title.sps

F:\sphinx>F:\sphinx\bin\searchd --install --config F:\sphinx\sphinx.conf --servi
cename SphinxSearch
sphinx-for-chinese 2.1.0-dev (r3361)
Copyright (c) 2008-2012, sphinx-search.com

Installing service...
Service 'SphinxSearch' installed succesfully.

F:\sphinx>F:\sphinx\bin\indexer -c F:\sphinx\sphinx.conf --all
sphinx-for-chinese 2.1.0-dev (r3361)
Copyright (c) 2008-2012, sphinx-search.com

using config file 'F:\sphinx\sphinx.conf'...
indexing index 'goods_title'...
WARNING: attribute 'trade_id' not found - IGNORING
WARNING: source srcDB: skipped 10378355 document(s) with DOCID_MAX ids
collected 176464 docs, 12.1 MB
sorted 0.7 Mhits, 100.0% done
total 176464 docs, 12144715 bytes
total 37.745 sec, 321754 bytes/sec, 4675.12 docs/sec
total 2 reads, 0.007 sec, 4604.6 kb/call avg, 3.9 msec/call avg
total 19 writes, 0.360 sec, 950.7 kb/call avg, 18.9 msec/call avg

F:\sphinx>net start SphinxSearch
SphinxSearch starting... 
SphinxSearch start successed


F:\sphinx>pause
please press any key to continue. . .

私のphpスクリプトの内容は以下の通りですが、結果は空です。

<?php

require ( "sphinxapi.php" );

$s = new SphinxClient();
$s->SetServer('localhost');
$rst = $s->Query('电脑');
print_r($s);
print_r($rst);

/*
SphinxClient Object
(
    [_host] => localhost
    [_port] => 9312
    [_offset] => 0
    [_limit] => 20
    [_mode] => 0
    [_weights] => Array
        (
        )

    [_sort] => 0
    [_sortby] => 
    [_min_id] => 0
    [_max_id] => 0
    [_filters] => Array
        (
        )

    [_groupby] => 
    [_groupfunc] => 0
    [_groupsort] => @group desc
    [_groupdistinct] => 
    [_maxmatches] => 1000
    [_cutoff] => 0
    [_retrycount] => 0
    [_retrydelay] => 0
    [_anchor] => Array
        (
        )

    [_indexweights] => Array
        (
        )

    [_ranker] => 0
    [_rankexpr] => 
    [_maxquerytime] => 0
    [_fieldweights] => Array
        (
        )

    [_overrides] => Array
        (
        )

    [_select] => *
    [_error] => 
    [_warning] => 
    [_connerror] => 
    [_reqs] => Array
        (
        )

    [_mbenc] => 
    [_arrayresult] => 
    [_timeout] => 0
    [_path] => 
    [_socket] => 
)
Array
(
    [error] => 
    [warning] => 
    [status] => 0
    [fields] => Array
        (
            [0] => goods_title
            [1] => goods_price
        )

    [attrs] => Array
        (
            [trade_time] => 2
            [uid_buy] => 6
            [uid_sell] => 6
        )

    [total] => 0
    [total_found] => 0
    [time] => 0.000
)

*/
4

1 に答える 1

0

http://sphinxsearch.com/forum/view.html?id=11468を参照して ください。

これはcharset_table問題だと思います。現在の設定のように、実際には中国語の文字は含まれていません。

于 2013-09-09T11:29:54.100 に答える