0

我开始使用 cassandra,我想用 sphinx 索引我的数据库。我编写了用作 xmlpipe 的 ruby​​ 脚本,并配置 sphinx 以使用它。

source xmlsrc
{
    type                                    = xmlpipe2
    xmlpipe_command                         = /usr/local/bin/ruby /home/httpd/html/app/script/sphinxpipe.rb
}

当我从控制台输出运行脚本时看起来不错,但是当我运行 indexer sphinx 时返回错误

$ indexer test_index
Sphinx 0.9.9-release (r2117)
Copyright (c) 2001-2009, Andrew Aksyonoff

using config file '/usr/local/etc/sphinx.conf'...
indexing index 'test_index'...
ERROR: index 'test_index': source 'xmlsrc': attribute 'id' required in <sphinx:document> (line=10, pos=0, docid=0).
total 0 docs, 0 bytes
total 0.000 sec, 0 bytes/sec, 0.00 docs/sec
total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg

我的脚本很简单

$stdout.sync = true
puts %{<?xml version="1.0" encoding="utf-8"?>}
puts %{<sphinx:docset>}
puts %{<sphinx:schema>}
puts %{<sphinx:field name="body"/>}
puts %{</sphinx:schema>}
puts %{<sphinx:document id="ba32c02e-79e2-11df-9815-af1b5f766459">}
puts %{<body><![CDATA[aaa]]></body>}
puts %{</sphinx:document>}
puts %{</sphinx:docset>}

我使用 ruby​​ 1.9.2-head、ubuntu 10.04、sphinx 0.9.9

我怎样才能让它工作?

4

1 回答 1

2

我有自己的问题的答案:)

sphinx 在源代码中定义了文档最大 id

for 64 bit mashines
#define DOCID_MAX       U64C(0xffffffffffffffff) 

文档 ID 必须小于 18446744073709551615

for 32 bit mashines
#define DOCID_MAX       0xffffffffUL

文档 ID 必须小于 4294967295

我使用 SimpleUUID 为什么它不起作用

于 2010-06-17T12:31:57.477 回答