You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Bruno Mateus <br...@gmail.com> on 2009/02/04 19:53:48 UTC

Multiple uniqueKey problems

Hello,

I'm facing some problems in generating a compound unique key. I'm
indexing some database tables not related with each other. In my
data-config.xml I have the following

<dataConfig>
    <document name="objectTypes">
        <entity name="node" pk="NODEID" query="select * from node">
            <field column="alias" name="alias" template="node" />
            <field column="id" name="id" template="node${node.nodeid}" />
            <field column="NODEID" name="node_nodeid" />
            <field column="NAME" name="node_name" />
        </entity>
    </document>
</dataConfig>

Column "alias" and "id" don't exist on the database. In my schema.xml
I have the following:

  <field name="id" type="string" indexed="true" stored="true" required="true" />
  <field name="alias" type="string" indexed="true" stored="false" />

   <field name="node_nodeid" type="long" indexed="true" stored="false" />
   <field name="node_name" type="string" indexed="true" stored="true" />

   <uniqueKey>id</uniqueKey>

When I do a full import I get the following error:

18:47:40,530 ERROR [STDERR] 4/Fev/2009 18:47:40
org.apache.solr.handler.dataimport.SolrWriter upload
WARNING: Error creating document :
SolrInputDocumnt[{node_nodeid=node_nodeid(1.0)={6706},
node_name=node_name(1.0)={CPE_106122644}}]
org.apache.solr.common.SolrException: Document [null] missing required field: id
	at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:289)
	at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:58)
	at org.apache.solr.handler.dataimport.SolrWriter.upload(SolrWriter.java:69)
	at org.apache.solr.handler.dataimport.DataImportHandler$1.upload(DataImportHandler.java:288)
	at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:319)
	at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:178)
	at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:136)
	at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:334)
	at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:386)
	at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:377)


I suppose I'm missing some configuration. Is the way I'm generating
the id correct?

Thks

Re: Multiple uniqueKey problems

Posted by Bruno Mateus <br...@gmail.com>.
Simple :) thks.

On Thu, Feb 5, 2009 at 12:13 PM, Shalin Shekhar Mangar
<sh...@gmail.com> wrote:
> On Thu, Feb 5, 2009 at 12:23 AM, Bruno Mateus <br...@gmail.com>wrote:
>
>> Hello,
>>
>> I'm facing some problems in generating a compound unique key. I'm
>> indexing some database tables not related with each other. In my
>> data-config.xml I have the following
>>
>> <dataConfig>
>>    <document name="objectTypes">
>>        <entity name="node" pk="NODEID" query="select * from node">
>>            <field column="alias" name="alias" template="node" />
>>            <field column="id" name="id" template="node${node.nodeid}" />
>>            <field column="NODEID" name="node_nodeid" />
>>            <field column="NAME" name="node_name" />
>>        </entity>
>>    </document>
>> </dataConfig>
>
>
> 1. To use the "template" attribute, you need to specify
> transformer="TemplateTransformer" in the entity.
> 2. The case also matters in case of variables. So nodeid and NODEID is not
> the same thing.
>
> --
> Regards,
> Shalin Shekhar Mangar.
>

Re: Multiple uniqueKey problems

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Thu, Feb 5, 2009 at 12:23 AM, Bruno Mateus <br...@gmail.com>wrote:

> Hello,
>
> I'm facing some problems in generating a compound unique key. I'm
> indexing some database tables not related with each other. In my
> data-config.xml I have the following
>
> <dataConfig>
>    <document name="objectTypes">
>        <entity name="node" pk="NODEID" query="select * from node">
>            <field column="alias" name="alias" template="node" />
>            <field column="id" name="id" template="node${node.nodeid}" />
>            <field column="NODEID" name="node_nodeid" />
>            <field column="NAME" name="node_name" />
>        </entity>
>    </document>
> </dataConfig>


1. To use the "template" attribute, you need to specify
transformer="TemplateTransformer" in the entity.
2. The case also matters in case of variables. So nodeid and NODEID is not
the same thing.

-- 
Regards,
Shalin Shekhar Mangar.