sphinx xmlpipe2 cassandra and ruby 1.9

Posted by user369083 on Stack Overflow See other posts from Stack Overflow or by user369083
Published on 2010-06-17T10:19:25Z Indexed on 2010/06/17 10:23 UTC
Read the original article Hit count: 629

Filed under:
|
|

Hi, 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?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about sphinx