解决coreseek生成索引时报错WARNING: attribute 'id' not found - IGNORING

17-07-18 21:22 字数 679 阅读 3830

今天在配置完sphinx新索引后,生成索引时报错

indexing index 'eaxing'...
WARNING: attribute 'id' not found - IGNORING
collected 22 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 22 docs, 27644 bytes
total 0.011 sec, 2414112 bytes/sec, 1921.22 docs/sec

原因是sphinx不能使用主键来做属性字段,而我的源配置里是这么写的

sql_query = SELECT id, discussion_id,content FROM sq_posts
sql_attr_uint   = id
sql_attr_uint   = discussion_id

id是我posts表的主键,所以需要给个别名,like this

sql_query = SELECT id,id as aid, discussion_id,content FROM sq_posts
sql_attr_uint   = aid
sql_attr_uint   = discussion_id

然后再试试生成索引

./indexer -c /usr/local/coreseek/etc/csft.conf --all --rotate
indexing index 'eaxing'...
collected 22 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 22 docs, 27644 bytes
total 0.010 sec, 2573210 bytes/sec, 2047.84 docs/sec

ok了,这下就没错了。

0人点赞>
关注 收藏 改进 举报
3 条评论
排序方式 时间 投票
草芥

666

Up骚年
@草芥 777
zousaisai

555555

请登录后发表评论
站长 @ 十七度
文章
380
粉丝
23
喜欢
190
收藏
31
排名 : 1
访问 : 127.84万
私信