首页 > 解决方案 > 如何运行狮身人面像?

问题描述

昨天我开始掌握狮身人面像。

一切进展顺利。

但是今天我不明白我的问题是什么。

当我创建索引时:

C:/sphinx/bin/indexer --all --config C:/sphinx/config/sphinx.conf

我连接狮身人面像:

C:/sphinx/bin/searchd --install --config C:/sphinx/config/sphinx.conf --servicename SphinxSearch

我在服务中打开它。

CMD 命令:

C:/Users/WINDOWS/Desktop/xampp/mysql/bin/mysql.exe -h 127.0.0.1 -P 9306

MySQL 命令:

show tables;

结论:

Empty set (0.000 sec)

配置:

source src1
{
type = mysql

sql_host = localhost
sql_user = root
sql_pass =
sql_db = test
sql_port = 3306

sql_query = \
SELECT id, group_id, UNIX_TIMESTAMP (date_added) AS date_added, title, content \
FROM documents

sql_attr_uint = group_id
sql_attr_timestamp = date_added
}


index test1
{
source = src1
path = C:/sphinx/data/test1
}


index testrt
{
type = rt
rt_mem_limit = 128M

path = C:/sphinx/data/testrt

rt_field = title
rt_field = content
rt_attr_uint = gid
}


indexer
{
mem_limit = 128M
}


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

没有帮助:

C:/sphinx/bin/indexer --all --config C:/sphinx/config/sphinx.conf --rotate

PS。

文件在 C:/sphinx/data 目录中创建。

我多次删除该服务:

C:/sphinx/bin/searchd --servicename SphinxSearch --delete

并给出了不同的名字:

C:/sphinx/bin/searchd --install --config C:/sphinx/config/sphinx.conf --servicename RandomName

我所有的文件夹和文件都已就位。

桌子:

CREATE TABLE test.documents
(
id INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT,
group_id INTEGER NOT NULL,
group_id2 INTEGER NOT NULL,
date_added DATETIME NOT NULL,
title VARCHAR (255) NOT NULL,
content TEXT NOT NULL
);

REPLACE INTO test.documents (id, group_id, group_id2, date_added, title, content) VALUES
(1, 1, 5, NOW (), 'test one', 'this is my test document number one. Also checking search within phrases.'),
(2, 1, 6, NOW (), 'test two', 'this is my test document number two'),
(3, 2, 7, NOW (), 'another doc', 'this is another group'),
(4, 2, 8, NOW (), 'doc number four', 'this is to test groups');

CREATE TABLE test.tags
(
docid INTEGER NOT NULL,
tagid INTEGER NOT NULL,
UNIQUE (docid, tagid)
);

INSERT INTO test.tags VALUES
(1,1), (1,3), (1,5), (1,7),
(2.6), (2.4), (2.2),
(3.15),
(4.7), (4.40);

SHOW DATABASES;

Empty set (0.002 sec)

标签: mysqlsphinx

解决方案


推荐阅读