sphinx、xmlpipe2 和 cassandra

发布于 2024-09-06 11:52:49 字数 1375 浏览 12 评论 0原文

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

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

当我从控制台输出运行脚本时看起来不错,但是当我运行索引器 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

我怎样才能让它工作?

I start to using cassandra and I want to index my db with sphinx.
I wrote ruby script which is used as xmlpipe, and I configure sphinx to use it.

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

When I run script from console output looks fine, but when I run indexer sphinx return error

$ 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

my script is very simple

$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>}

I use ruby 1.9.2-head, ubuntu 10.04, sphinx 0.9.9

How can I get this to work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

那支青花 2024-09-13 11:52:49

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

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

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

文档 id 必须小于 18446744073709551615

for 32 bit mashines
#define DOCID_MAX       0xffffffffUL

文档 id 必须小于 4294967295

我使用 SimpleUUID 这就是为什么它不起作用

I have answer to my own quiestion :)

sphinx has defined document max id in source code

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

document id must be less than 18446744073709551615

for 32 bit mashines
#define DOCID_MAX       0xffffffffUL

document id must be less than 4294967295

I used SimpleUUID that why it don't work

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文