我不能在我的獅身人面像查詢中使用@字段名,但我可以用@ *獅身人面像 - 無法使用字段屬性查詢
我可以查詢test.documents例如,當使用@場-name屬性,但不適用於我編制索引的另一個表格。
這是我的PHP:
require_once('sphinxapi.php');
$this->sphinx = new SphinxClient;
$this->sphinx->setServer("localhost", 9312);
$this->sphinx->setMatchMode(SPH_MATCH_EXTENDED2);
//This works:
$result = $this->sphinx->query("@* bob");
var_dump($result);
//This doesn't work:
$result = $this->sphinx->query("@artist bob");
var_dump($result);
的輸出:在/ usr /地方/獅身人面像/斌/索引--all --rotate自卸行sphinxrows.txt
# === source src1 ts 1318588067
# Fri Oct 14 10:27:47 2011
#
# field 0: name
# field 1: filename
# field 2: artist
# sql_attr_uint = id_attr # attr 0
# sql_attr_timestamp = date_added # attr 1
#
DROP TABLE IF EXISTS rows_src1;
CREATE TABLE rows_src1 (
id VARCHAR(32) NOT NULL,
id_attr VARCHAR(4096) NOT NULL,
date_added VARCHAR(4096) NOT NULL,
name VARCHAR(4096) NOT NULL,
filename VARCHAR(4096) NOT NULL,
artist VARCHAR(4096) NOT NULL,
KEY(id));
INSERT INTO rows_src1 VALUES ('6', '6', '0', 'track 1 title', 'track-1.wav', 'bob');
INSERT INTO rows_src1 VALUES ('70', '70', '0', 'track 2 title', 'track-2.wav', 'eric');
sphinx.conf中:
source src1
{
type = mysql
sql_query = \
SELECT id, id AS id_attr, UNIX_TIMESTAMP(date_added) AS date_added, name, filename, artist \
FROM files
sql_attr_uint = id_attr
sql_attr_timestamp = date_added
sql_query_info = SELECT * FROM files WHERE id=$id
}
rows_src1是Sphinx索引器表,文件是我要求它索引的表。我找到了這個問題,你需要在sphinx.conf中爲你希望在查詢中使用的字段添加一個「rt_field」。 – StuR