1

我已经设法配置、索引和运行 sphinx,现在我正在使用 SphinxQL 检索一些数据。

问题是,当我尝试查询时,结果只给了我“id”。这让我很困惑。我在 mySQL 上的数据由以下列组成

GENDB_ID //auto increment
GENDB_PDO //product origin, string
GENDB_FPN //family part number, string
GENDB_PN //part number, string

问题:

  1. 为什么 Sphinx 在我的“GENDB_ID”上设置别名“id”?

  2. 当我尝试指定要在查询中获取哪些列时,出现“列不存在”错误。如何查询某些列?

  3. 什么是rt?我的 rt 索引总是被跳过。

这是我的狮身人面像配置:

#
# Minimal Sphinx configuration sample (clean, simple, functional)
#

source src1
{
    type            = mysql

    sql_host        = localhost
    sql_user        = root
    sql_pass        = 1234
    sql_db          = sample
    sql_port        = 3306  # optional, default is 3306

    sql_query       = \
        SELECT * \
        FROM general
}


index test1
{
    source          = src1
    path            = C:/Sphinx/data/test1
    min_infix_len   = 3
}


index testrt //This one doesnt work I don't know why.
{
    type            = rt
    rt_mem_limit        = 128M

    path            = C:/Sphinx/data/testrt
    rt_field    = GENDB_PDO
}


indexer
{
    mem_limit       = 500M
}


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         = 2
    binlog_path     = C:/Sphinx/data
    max_matches     = 10000000

}
4

1 回答 1

1
  1. Sphinx 总是将文档 ID 称为“id”。它不是真正的属性,document-id 很关键,因此与索引上的任何字段或属性分开处理。

  2. 您只能“检索”属性。只有属性存储在索引中并且可以按原样使用。FIELD 被标记和索引,因此匹配全文查询。但未存储原始文本。(从您的 sql_query 检索到的列自动成为 FIELDS,除非您专门将它们配置为 ATTRIBUTES - 除了第一列,如前所述,它是特殊的)

    http://sphinxsearch.com/docs/current.html#fields

    http://sphinxsearch.com/docs/current.html#attributes

    您可以选择将它们添加为 ATTRIBUTES(可能使用 sql_field_string,因此属性和字段)。或者接受您无法从 sphinx 获取它们,并将原始数据返回到您的 mysql 数据库。

    (对于第二部分,查询某些字段,请参阅“@”语法:http ://sphinxsearch.com/docs/current.html#extended-syntax )

  3. http://sphinxsearch.com/docs/current.html#rt-indexes实时索引。一种非常不同类型的索引。

于 2015-12-02T13:20:03.767 回答