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 ahammad <ah...@gmail.com> on 2009/04/28 15:49:07 UTC

Unique Identifiers

Hello all,

Is it possible for Solr to assign a unique number to every document?

For example, let's say that I am indexing from several databases with
different data structures. The first one has a unique field called artID,
and the second database has a unique field called SRNum. If I want to have
an interface that allows me to search both of those data sources, it makes
it easier to have a single field per document that is common to both
datasources...maybe something like uniqueDocID or something like that.

That field does not exist in the DB. Is it possible for Solr to create that
field and assign a number while it's indexing?

Cheers
-- 
View this message in context: http://www.nabble.com/Unique-Identifiers-tp23277538p23277538.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Unique Identifiers

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Thu, Apr 30, 2009 at 8:42 PM, ahammad <ah...@gmail.com> wrote:

>
> Hello,
>
> How would I go about creating an aggregate entry? Does it go in the
> data-config.xml file?
>
>
You can use the TemplateTransformer to fix the table name followed by the pk
of the table.

e.g.
<field column="uniqueKey" template="table1-${table1.pk}" />

-- 
Regards,
Shalin Shekhar Mangar.

Re: Unique Identifiers

Posted by ahammad <ah...@gmail.com>.
Hello,

How would I go about creating an aggregate entry? Does it go in the
data-config.xml file?

Also, out of curiosity, how can I access the UUIDField variable? It mat be
required for something else.

Cheers


Erik Hatcher wrote:
> 
> 
> On Apr 28, 2009, at 9:49 AM, ahammad wrote:
>> Is it possible for Solr to assign a unique number to every document?
> 
> Solr has a UUIDField that can be used for this.  But...
> 
>> For example, let's say that I am indexing from several databases with
>> different data structures. The first one has a unique field called  
>> artID,
>> and the second database has a unique field called SRNum. If I want  
>> to have
>> an interface that allows me to search both of those data sources, it  
>> makes
>> it easier to have a single field per document that is common to both
>> datasources...maybe something like uniqueDocID or something like that.
>>
>> That field does not exist in the DB. Is it possible for Solr to  
>> create that
>> field and assign a number while it's indexing?
> 
> I recommend an aggregate unique key field, using maybe this scheme:
> 
>     <table-name>-<primary key value>'
> 
> 	Erik
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Unique-Identifiers-tp23277538p23318361.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Unique Identifiers

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Apr 28, 2009, at 9:49 AM, ahammad wrote:
> Is it possible for Solr to assign a unique number to every document?

Solr has a UUIDField that can be used for this.  But...

> For example, let's say that I am indexing from several databases with
> different data structures. The first one has a unique field called  
> artID,
> and the second database has a unique field called SRNum. If I want  
> to have
> an interface that allows me to search both of those data sources, it  
> makes
> it easier to have a single field per document that is common to both
> datasources...maybe something like uniqueDocID or something like that.
>
> That field does not exist in the DB. Is it possible for Solr to  
> create that
> field and assign a number while it's indexing?

I recommend an aggregate unique key field, using maybe this scheme:

    <table-name>-<primary key value>'

	Erik