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 Jonathan Vanasco <jv...@2xlp.com> on 2009/06/20 02:49:26 UTC

trouble with 'unique' key - documents add, not replace

as far as i understand from the docs, with a schema.xml like this...

	 <fields>
	    <field name="uid" type="text" indexed="true" stored="true"  
required="true" />
	</fields>
	<uniqueKey>uid</uniqueKey>

any items with the same uid in it should replace existing ones on the  
commit .

is this correct ?  because it seems that i do not replace, but only  
add new records

i've obviously gotten something wrong.  any help would be appreciated.

Re: trouble with 'unique' key - documents add, not replace

Posted by Jonathan Vanasco <jv...@2xlp.com>.
Thank you Erik and Otis!

I tried the switch to string and it worked perfectly!

Int wasn't appropriate, because our UIDs are based on object-type +  
object-id, and i'd rather not work on some method of creating  
universal serials for everything.

On Jun 19, 2009, at 11:58 PM, Erik Hatcher wrote:

> "text" is likely analyzing to multiple terms which is incorrect for  
> a uid type of field.  set it to type="string" instead.  and reindex  
> from scratch.
>
> 	Erik
>
> On Jun 19, 2009, at 8:49 PM, Jonathan Vanasco wrote:
>
>> as far as i understand from the docs, with a schema.xml like this...
>>
>> 	 <fields>
>> 	    <field name="uid" type="text" indexed="true" stored="true"  
>> required="true" />
>> 	</fields>
>> 	<uniqueKey>uid</uniqueKey>
>>
>> any items with the same uid in it should replace existing ones on  
>> the commit .
>>
>> is this correct ?  because it seems that i do not replace, but only  
>> add new records
>>
>> i've obviously gotten something wrong.  any help would be  
>> appreciated.
>

Re: trouble with 'unique' key - documents add, not replace

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
"text" is likely analyzing to multiple terms which is incorrect for a  
uid type of field.  set it to type="string" instead.  and reindex from  
scratch.

	Erik

On Jun 19, 2009, at 8:49 PM, Jonathan Vanasco wrote:

> as far as i understand from the docs, with a schema.xml like this...
>
> 	 <fields>
> 	    <field name="uid" type="text" indexed="true" stored="true"  
> required="true" />
> 	</fields>
> 	<uniqueKey>uid</uniqueKey>
>
> any items with the same uid in it should replace existing ones on  
> the commit .
>
> is this correct ?  because it seems that i do not replace, but only  
> add new records
>
> i've obviously gotten something wrong.  any help would be appreciated.


Re: trouble with 'unique' key - documents add, not replace

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Jonathan,

I'd have to test to double-check how things work when the unique key field is of type "text", if your "text" type is the same or similar to the one from the example schema.xml.  You probably don't want that field to be of type text.  Maybe int, or maybe string

 Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch



----- Original Message ----
> From: Jonathan Vanasco <jv...@2xlp.com>
> To: solr-user@lucene.apache.org
> Sent: Friday, June 19, 2009 8:49:26 PM
> Subject: trouble with 'unique' key - documents add, not replace
> 
> as far as i understand from the docs, with a schema.xml like this...
> 
>     
>         
> required="true" />
>     
>     uid
> 
> any items with the same uid in it should replace existing ones on the commit .
> 
> is this correct ?  because it seems that i do not replace, but only add new 
> records
> 
> i've obviously gotten something wrong.  any help would be appreciated.