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 Brian Robinson <br...@socialsurgemedia.com> on 2013/09/07 00:51:19 UTC

Unknown attribute id in add:allowDups

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

Re: Unknown attribute id in add:allowDups

Posted by Furkan KAMACI <fu...@gmail.com>.
I did not use the Pecl package and the problem maybe about that. I want to
ask that when you define your schema you indicate that:

*required="true"*

However error says:

*allowDups*

for id field. So it seems that id is not a unique field for that package.
You may need to config anything else at that package or there maybe a bug
unrelated to Solr.



2013/9/7 Brian Robinson <br...@socialsurgemedia.com>

> 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
>

Re: Unknown attribute id in add:allowDups

Posted by Chris Hostetter <ho...@fucit.org>.
: I'm working with the Pecl package, with Solr 4.3.1. I have a doc defined in my
	...
: $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

"id" is a red herring here -- it's not refering to your "id" field it's 
refering to the fact that an XML attribute node exists with an "XML id" 
that it doesn't recognize.

or to put it another way: Pecl is generating an <add> xml element that 
contains an attribute like this:  allowDups="false|true" ...and solr 
doesn't know what to do with that.

"allowDups" was an option that existed prior to 4.0, but is no longer 
supported (the "overwrite" attribute now takes it's place)

So my best guess is that the Pecl code you are using was designed for 3.x, 
and doesn't entirely work correctly with 4.x.

the warning you are getting isn't fatal or anything -- it's just letting 
you know that unknown attribute is being ignored -- but you may want to 
look into wether there is an updated Pecl library (for example: if you 
really wanted to use allowDups="true" you should now be using 
overwrite="false" and maybe the newer version of your client library will 
let you)

I've updated some places in the ref guide and wiki were it wasn't obvious 
that allowDups is gone, gone, gone ... i'll also update that error message 
so it will be more clear starting in 4.6...

https://issues.apache.org/jira/browse/SOLR-5257

-Hoss