微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Sphinx搜索引擎3 不读取 CSV 文件

如何解决Sphinx搜索引擎3 不读取 CSV 文件

我正在尝试让 Sphinx 为 CSV 文件编制索引。在这一点上,我试图让最简单的例子工作,但没有运气。

我正在使用:Sphinx 3.3.1(提交 b72d67b)

这是我的配置文件

source csvsrc
{
    type = csvpipe
    csvpipe_command = cat /home/ec2-user/sphinx/etc/example.csv
    csvpipe_header = 1
    csvpipe_attr_uint = gid
    csvpipe_attr_string = title
    csvpipe_attr_string = content
}

index csvtest
{
    type            = rt
    source          = csvsrc
    path            = /var/data/test5
    morphology      = stem_en

    rt_field = gid
    rt_field = title
    rt_field = content

}

indexer
{
    mem_limit       = 128M
}

searchd
{
    listen          = 9312
    listen          = 9306:MysqL41
    log             = /var/log/searchd.log
    query_log       = /var/log/query.log
    pid_file        = /var/log/searchd.pid
    binlog_path     = /var/data
}

这是我要读取的 csv 文件

gid,title,content
11,hello world,document number one
124,hello again,document number two
125,hello Now,This is some stuff
126,hello cow,more test stuff and things
127,hello suess,Box and sox and goats and moats
128,hello raven,nevermore said the thing

我正在运行命令 ../bin/searchd --config /home/ec2-user/sphinx/etc/sphinx.conf 其响应为:

using config file '/home/ec2-user/sphinx/etc/sphinx.conf'...
listening on all interfaces,port=9312
listening on all interfaces,port=9306
precaching index 'csvtest'
precached 1 indexes using 1 threads in 0.0 sec

要启动引擎,如果我使用以下命令运行索引器:

../bin/indexer --config /home/ec2-user/sphinx/etc/sphinx.conf

响应如下

Sphinx 3.3.1 (commit b72d67b)
copyright (c) 2001-2020,Andrew Aksyonoff
copyright (c) 2008-2016,Sphinx Technologies Inc (http://sphinxsearch.com)

ERROR: nothing to do.

所有这些都符合预期,但是当我与 MysqL 客户端连接时,我发现索引格式正确,但为空

$ MysqL -h127.0.0.1 -P9306
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MysqL connection id is 1
Server version: 3.3.1 (commit b72d67b) 

copyright (c) 2000,2018,Oracle,MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MysqL [(none)]> describe csvtest
    -> ;
+---------+--------+------------+------+
| Field   | Type   | Properties | Key  |
+---------+--------+------------+------+
| id      | bigint |            |      |
| gid     | field  | indexed    |      |
| title   | field  | indexed    |      |
| content | field  | indexed    |      |
+---------+--------+------------+------+
4 rows in set (0.00 sec)



MysqL [(none)]> select * from csvtest;
Empty set (0.00 sec)

我需要更改什么才能真正将 csv 数据加载到索引中?

解决方法

@barryhunter 在评论中解决了这个问题。

我需要索引器上的 --all 以使其实际索引。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。