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 以使其实际索引。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...