Hello,
I'm working with the Pecl package, with Solr 4.3.1. I have a doc defined in my schema where id is the uniqueKey,

<field name="id" type="int" indexed="true" stored="true" required="true" multiValued="false" />
<uniqueKey>id</uniqueKey>

I tried to add a doc to my index with the following code (simplified for the question):

$client = new SolrClient($options);
$doc = new SolrInputDocument();
$doc->addField('id', 12345);
$doc->addField('description', 'This is the content of the doc');
$updateResponse = $client->addDocument($doc);

When I do this, the doc is not added to the index, and I get the following error in the logs in admin

     Unknown attribute id in add:allowDups

However, I noticed that if I change the field to type string:

<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
...
$doc->addField('id', '12345');

the doc is added to the index, but I still get the error in the log.

So first, I was wondering, is there some other way I should be setting this up so that id can be an int instead of a string?

And then I was also wondering what this error is referring to. Is there some further way I need to define id? Or maybe define the uniqueKey differently?

Any help would be much appreciated.
Thanks,
Brian

Reply via email to