Я формирую XML:
$xmlwriter = new xmlWriter();
$xmlwriter->openMemory();
$xmlwriter->setIndent(true);
$xmlwriter->startDocument('1.0','UTF-8');
$xmlwriter->startElement('sphinx:docset');
$xmlwriter->startElement('sphinx:schema');
$xmlwriter->startElement('spinx:attribute');
$xmlwriter->writeAttribute("name", "path");
$xmlwriter->writeAttribute("type", "string");
$xmlwriter->endElement(); // attr
$xmlwriter->startElement('sphinx:field');
$xmlwriter->writeAttribute("name", "content");
$xmlwriter->endElement(); // field
$xmlwriter->endElement(); // schema
$xmlwriter->startElement('sphinx:document');
$xmlwriter->writeAttribute("id", 1);
$xmlwriter->writeAttribute("path", "TEST_ATTRIBUTE");
$xmlwriter->startElement("content");
$xmlwriter->text("TEST_CONTENT");
$xmlwriter->endElement(); // field
$xmlwriter->endElement(); // doc
$xmlwriter->endElement(); // docset
print $xmlwriter->outputMemory(true);
В результате формируется:
<?xml version="1.0" encoding="UTF-8"?>
<sphinx:docset>
<sphinx:schema>
<spinx:attribute name="path" type="string"/>
<sphinx:field name="content"/>
</sphinx:schema>
<sphinx:document id="1" path="TEST_ATTRIBUTE">
<content>TEST_CONTENT</content>
</sphinx:document>
</sphinx:docset>
Импортирую в индекс:
# indexer --rotate --all
Sphinx 2.2.11-id64-release (95ae9a6)
indexing index 'test1'...
WARNING: Attribute count is 0: switching to none docinfo
collected 3 docs, 0.0 MB
Поиск работает, но атрибут в индекс не попадает.
Как правильно добавить атрибут?