开发者

sphinx, xmlpipe2, and cassandra

开发者 https://www.devze.com 2023-01-04 06:44 出处:网络
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.

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, 开发者_如何学JAVA0.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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消