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 "Aleksander M. Stensby" <al...@integrasco.no> on 2008/11/19 11:18:40 UTC

Re: Unique id

Yes it is. You need a unique id because the add method works as and "add  
or update" method. When adding a document whose ID is already found in the  
index, the old document will be deleted and the new will be added. Are you  
indexing two tables into the same index? Or does one entry in the index  
consist of data from both tables? How are these linked together without an  
ID?

- Aleksander

On Wed, 19 Nov 2008 10:42:00 +0100, Raghunandan Rao  
<Ra...@newscale.com> wrote:

> Hi,
>
> Is the uniqueKey in schema.xml really required?
>
>
> Reason is, I am indexing two tables and I have id as unique key in
> schema.xml but id field is not there in one of the tables and indexing
> fails. Do I really require this unique field for Solr to index it better
> or can I do away with this?
>
>
> Thanks,
>
> Rahgu
>



-- 
Aleksander M. Stensby
Senior software developer
Integrasco A/S
www.integrasco.no

Re: Unique id

Posted by "Aleksander M. Stensby" <al...@integrasco.no>.
I still don't understand why you want two different indexes if you want to  
return the linked information each time anyways...
I would say the easiest way is just to index all data (all columns from  
your views) into the index like this:

taskid - taskname - start - end - personid - deptid - ismanager

then you can just search like I already explained earlier. This way, you  
have already joined by queue-id when you insert it into the index and thus  
you get both results from one single search. (if you also want to have the  
ability to search on the queueID, just add a column for that.

In general, your questions doesn't really have anything to do with solr,  
but architecture, db-design and what you want to search on.

  - A.

>>>>
>>>> 1.
>>>> Task(id* (int), name (string), start (timestamp), end (timestamp))
>>>>
>>>> 2.
>>>> Team(person_id (int), deptId (int), isManager (int))
>>>>
>>>> * is primary key
>>>>
>>>> In schema.xml I have
>>>>
>>>> <field name="id" type="integer" indexed="true" stored="true"
>>>> required="true"/>
>>>> <field name="name" type="text" indexed="true" stored="true"/>
>>>> <field name="personId" type="integer" indexed="true" stored="true"/>
>>>> <field name=" deptId" type="integer" indexed="true" stored="true"/>


On Fri, 21 Nov 2008 11:59:56 +0100, Raghunandan Rao  
<Ra...@newscale.com> wrote:

> Can you also let me know how I join two search indices in one query?
>
> That means, in this case I have two diff search indices and I need to
> join by queueId and get all the tasks in one SolrQuery. I am creating
> queries in Solrj.
>
>
> -----Original Message-----
> From: Raghunandan Rao [mailto:Raghunandan.Rao@newScale.com]
> Sent: Friday, November 21, 2008 3:45 PM
> To: solr-user@lucene.apache.org
> Subject: RE: Unique id
>
> Ok. I got your point. So I need not require ID field in the second view.
> I will hence remove required="true" in schema.xml. What I thought was
> unique ID makes indexing easier or used to maintain doc.
>
> Thanks a lot.
>
> -----Original Message-----
> From: Aleksander M. Stensby [mailto:aleksander.stensby@integrasco.no]
> Sent: Friday, November 21, 2008 3:36 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Unique id
>
> Well, In that case, what do you want to search for? If I were you, I
> would
> make my index consist of tasks (and I assume that is what you are trying
>
> to do).
>
> So why don't you just use your schema.xml as you have right now, and do
>
> the following:
>
> Pick a person (let's say he has person_id=42 and deptId=3), get his
> queue
> of tasks, then for each task in queue do:
> insert into index:
> (id from the task), (name of the task), (id of the person), (id of the
> departement)
> an example:
> 3, "this is a very important task", 42, 3
> 4, "this one is also important", 42, 3
> 5, "this one is low priority", 42, 3
>
> And then for the next person you do the same, (person_id=58 and
> deptId=5)
> insert:
> 6, "this is about solr", 58, 5
> 7, "this is about lucene", 58, 5
>
> etc.
>
> Now you can search for all tasks in departement 5 by doing "deptId:5".
> If you want to search for all the tasks assigned to a specific person
> you
> just enter the query "personId:42".
> And you could also search for all tasks containing certain keywords by
> doing the query "name:solr" OR "name:lucene".
>
> Do you understand now, or is it still unclear?
>
> - Aleks
>
>
>
> On Fri, 21 Nov 2008 10:56:38 +0100, Raghunandan Rao
> <Ra...@newscale.com> wrote:
>
>> Ok. There is common column in two views called queueId. I query second
>> view first and get all the queueids for a person. And having queueIds
> I
>> get all the ids from first view.
>>
>> Sorry for missing that column earlier. I think it should make sense
> now.
>>
>>
>> -----Original Message-----
>> From: Aleksander M. Stensby [mailto:aleksander.stensby@integrasco.no]
>> Sent: Friday, November 21, 2008 3:18 PM
>> To: solr-user@lucene.apache.org
>> Subject: Re: Unique id
>>
>> And in case that wasn't clear, the reason for it failing then would
>> obviously be because you define the id field with required="true", and
>> you
>> try inserting a document where this field is missing...
>>
>> - Aleks
>>
>> On Fri, 21 Nov 2008 10:46:10 +0100, Aleksander M. Stensby
>> <al...@integrasco.no> wrote:
>>
>>> Ok, this brings me to the question; how are the two view's connected
>> to
>>> each other (since you are indexing partly view 1 and partly view 2
>> into
>>> a single index structure?
>>>
>>> If they are not at all connected I believe you have made a
> fundamental
>>
>>> mistake / misunderstand the use of your index...
>>> I assume that a Task can be assigned to a person, and your Team view
>>> displays that person, right?
>>>
>>> Maybe you are doing something like this:
>>> View 1
>>> 1, somename, sometimestamp, someothertimestamp
>>> 2, someothername, somethirdtimestamp, timetamp4
>>> ...
>>>
>>> View 2
>>> 1, 58, 0
>>> 2, 58, 1
>>> 3, 52, 0
>>> ...
>>>
>>> I'm really confused about your database structure...
>>> To me, It would be logical to add a team_id field to the team table,
>> and
>>> add a third table to link tasks to a team (or to individual persons).
>>> Once you have that information (because I do assume there MUST be
> some
>>
>>> link there) you would do:
>>> insert into your index:
>>>   (id from the task), (name of the task), (id of the person assigned
>> to
>>> this task), (id of the departement that this person works in).
>>>
>>> I guess that you _might_ be thinking a bit wrong and trying to do
>>> something like this:
>>> Treat each view as independent views, and inserting values from each
>>> table as separate documents in the index
>>> so you would do:
>>> insert into your index:
>>>   (id from the task), (name of the task), (no value), (no value) ----
>>
>>> which will be ok to do
>>>   (no value), (no value), (id of the person), (id of the departement)
>>
>>> --- which makes no sense to me...
>>>
>>> So, can you clearify the relationship between the two views, and how
>> you
>>> are thinking of inserting entries into your index?
>>>
>>> - Aleks
>>>
>>>
>>>
>>> On Fri, 21 Nov 2008 10:33:28 +0100, Raghunandan Rao
>>> <Ra...@newscale.com> wrote:
>>>
>>>> View structure is:
>>>>
>>>> 1.
>>>> Task(id* (int), name (string), start (timestamp), end (timestamp))
>>>>
>>>> 2.
>>>> Team(person_id (int), deptId (int), isManager (int))
>>>>
>>>> * is primary key
>>>>
>>>> In schema.xml I have
>>>>
>>>> <field name="id" type="integer" indexed="true" stored="true"
>>>> required="true"/>
>>>> <field name="name" type="text" indexed="true" stored="true"/>
>>>> <field name="personId" type="integer" indexed="true" stored="true"/>
>>>> <field name=" deptId" type="integer" indexed="true" stored="true"/>
>>>>
>>>> <uniq

-- 
Aleksander M. Stensby
Head of marketing, Norway
Senior software developer
Integrasco A/S
+47 41 22 82 72
aleksander.stensby@integrasco.no
www.integrasco.noueKey>id</uniqueKey>
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Aleksander M. Stensby
> [mailto:aleksander.stensby@integrasco.no]
>>>> Sent: Friday, November 21, 2008 2:56 PM
>>>> To: solr-user@lucene.apache.org
>>>> Subject: Re: Unique id
>>>>
>>>> Hello again. I'm getting a bit confused by your questions, and I
>> believe
>>>>
>>>> it would be easier for us to help you if you could post the field
>>>> definitions from your schema.xml and the structure of your two
>> database
>>>>
>>>> views.
>>>> ie.
>>>> table 1: (id (int), subject (string) -.--)
>>>> table 2: (category (string), other fields ..)
>>>>
>>>>
>>>> So please post this and we can try to help you.
>>>>
>>>> - Aleks
>>>>
>>>>
>>>> On Fri, 21 Nov 2008 07:49:31 +0100, Raghunandan Rao
>>>> <Ra...@newscale.com> wrote:
>>>>
>>>>> Thanks Erik.
>>>>> If I convert that to a string then id field defined in schema.xml
>>>> would
>>>>> fail as I have that as integer. If I change that to string then
>> first
>>>>> view would fail as it is Integer there. What to do in such
>> scenarios?
>>>> Do
>>>>> I need to define multiple schema.xml or multiple unique key
>>>> definitions
>>>>> in same schema. How does this work? Pls explain.
>>>>>
>>>>> -----Original Message-----
>>>>> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
>>>>> Sent: Thursday, November 20, 2008 6:40 PM
>>>>> To: solr-user@lucene.apache.org
>>>>> Subject: Re: Unique id
>>>>>
>>>>> I'd suggest aggregating those three columns into a string that can
>>>>> serve as the Solr uniqueKey field value.
>>>>>
>>>>> 	Erik
>>>>>
>>>>>
>>>>> On Nov 20, 2008, at 1:10 AM, Raghunandan Rao wrote:
>>>>>
>>>>>> Basically, I am working on two views. First one has an ID column.
>> The
>>>>>> second view has no unique ID column. What to do in such
> situations?
>>>>>> There are 3 other columns where I can make a composite key out of
>>>>>> those.
>>>>>> I have to index these two views now.
>>>>>>
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
>>>>>> Sent: Wednesday, November 19, 2008 5:24 PM
>>>>>> To: solr-user@lucene.apache.org
>>>>>> Subject: Re: Unique id
>>>>>>
>>>>>> Technically, no, a uniqueKey field is NOT required.  I've yet to
>> run
>>>>>> into a situation where it made sense not to use one though.
>>>>>>
>>>>>> As for indexing database tables - if one of your tables doesn't
>> have
>>>> a
>>>>>> primary key, does it have an aggregate unique "key" of some sort?
>> Do
>>>>>> you plan on updating the rows in that table and reindexing them?
>>>>>> Seems like some kind of unique key would make sense for updating
>>>>>> documents.
>>>>>>
>>>>>> But yeah, a more detailed description of your table structure and
>>>>>> searching needs would be helpful.
>>>>>>
>>>>>> 	Erik
>>>>>>
>>>>>>
>>>>>> On Nov 19, 2008, at 5:18 AM, Aleksander M. Stensby wrote:
>>>>>>
>>>>>>> Yes it is. You need a unique id because the add method works as
>> and
>>>>>>> "add or update" method. When adding a document whose ID is
> already
>>>>>>> found in the index, the old document will be deleted and the new
>>>>>>> will be added. Are you indexing two tables into the same index?
> Or
>>>>>>> does one entry in the index consist of data from both tables? How
>>>>>>> are these linked together without an ID?
>>>>>>>
>>>>>>> - Aleksander
>>>>>>>
>>>>>>> On Wed, 19 Nov 2008 10:42:00 +0100, Raghunandan Rao
>>>>>> <Raghunandan.Rao@newscale.com
>>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> Is the uniqueKey in schema.xml really required?
>>>>>>>>
>>>>>>>>
>>>>>>>> Reason is, I am indexing two tables and I have id as unique key
>> in
>>>>>>>> schema.xml but id field is not there in one of the tables and
>>>>>>>> indexing
>>>>>>>> fails. Do I really require this unique field for Solr to index
> it
>>>>>>>> better
>>>>>>>> or can I do away with this?
>>>>>>>>
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> Rahgu
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Aleksander M. Stensby
>>>>>>> Senior software developer
>>>>>>> Integrasco A/S
>>>>>>> www.integrasco.no
>>>>>
>>>>
>>>
>>
>

RE: Unique id

Posted by Raghunandan Rao <Ra...@newScale.com>.
Can you also let me know how I join two search indices in one query?

That means, in this case I have two diff search indices and I need to
join by queueId and get all the tasks in one SolrQuery. I am creating
queries in Solrj. 


-----Original Message-----
From: Raghunandan Rao [mailto:Raghunandan.Rao@newScale.com] 
Sent: Friday, November 21, 2008 3:45 PM
To: solr-user@lucene.apache.org
Subject: RE: Unique id

Ok. I got your point. So I need not require ID field in the second view.
I will hence remove required="true" in schema.xml. What I thought was
unique ID makes indexing easier or used to maintain doc. 

Thanks a lot. 

-----Original Message-----
From: Aleksander M. Stensby [mailto:aleksander.stensby@integrasco.no] 
Sent: Friday, November 21, 2008 3:36 PM
To: solr-user@lucene.apache.org
Subject: Re: Unique id

Well, In that case, what do you want to search for? If I were you, I
would  
make my index consist of tasks (and I assume that is what you are trying

to do).

So why don't you just use your schema.xml as you have right now, and do

the following:

Pick a person (let's say he has person_id=42 and deptId=3), get his
queue  
of tasks, then for each task in queue do:
insert into index:
(id from the task), (name of the task), (id of the person), (id of the  
departement)
an example:
3, "this is a very important task", 42, 3
4, "this one is also important", 42, 3
5, "this one is low priority", 42, 3

And then for the next person you do the same, (person_id=58 and
deptId=5)
insert:
6, "this is about solr", 58, 5
7, "this is about lucene", 58, 5

etc.

Now you can search for all tasks in departement 5 by doing "deptId:5".
If you want to search for all the tasks assigned to a specific person
you  
just enter the query "personId:42".
And you could also search for all tasks containing certain keywords by  
doing the query "name:solr" OR "name:lucene".

Do you understand now, or is it still unclear?

- Aleks



On Fri, 21 Nov 2008 10:56:38 +0100, Raghunandan Rao  
<Ra...@newscale.com> wrote:

> Ok. There is common column in two views called queueId. I query second
> view first and get all the queueids for a person. And having queueIds
I
> get all the ids from first view.
>
> Sorry for missing that column earlier. I think it should make sense
now.
>
>
> -----Original Message-----
> From: Aleksander M. Stensby [mailto:aleksander.stensby@integrasco.no]
> Sent: Friday, November 21, 2008 3:18 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Unique id
>
> And in case that wasn't clear, the reason for it failing then would
> obviously be because you define the id field with required="true", and
> you
> try inserting a document where this field is missing...
>
> - Aleks
>
> On Fri, 21 Nov 2008 10:46:10 +0100, Aleksander M. Stensby
> <al...@integrasco.no> wrote:
>
>> Ok, this brings me to the question; how are the two view's connected
> to
>> each other (since you are indexing partly view 1 and partly view 2
> into
>> a single index structure?
>>
>> If they are not at all connected I believe you have made a
fundamental
>
>> mistake / misunderstand the use of your index...
>> I assume that a Task can be assigned to a person, and your Team view
>> displays that person, right?
>>
>> Maybe you are doing something like this:
>> View 1
>> 1, somename, sometimestamp, someothertimestamp
>> 2, someothername, somethirdtimestamp, timetamp4
>> ...
>>
>> View 2
>> 1, 58, 0
>> 2, 58, 1
>> 3, 52, 0
>> ...
>>
>> I'm really confused about your database structure...
>> To me, It would be logical to add a team_id field to the team table,
> and
>> add a third table to link tasks to a team (or to individual persons).
>> Once you have that information (because I do assume there MUST be
some
>
>> link there) you would do:
>> insert into your index:
>>   (id from the task), (name of the task), (id of the person assigned
> to
>> this task), (id of the departement that this person works in).
>>
>> I guess that you _might_ be thinking a bit wrong and trying to do
>> something like this:
>> Treat each view as independent views, and inserting values from each
>> table as separate documents in the index
>> so you would do:
>> insert into your index:
>>   (id from the task), (name of the task), (no value), (no value) ----
>
>> which will be ok to do
>>   (no value), (no value), (id of the person), (id of the departement)
>
>> --- which makes no sense to me...
>>
>> So, can you clearify the relationship between the two views, and how
> you
>> are thinking of inserting entries into your index?
>>
>> - Aleks
>>
>>
>>
>> On Fri, 21 Nov 2008 10:33:28 +0100, Raghunandan Rao
>> <Ra...@newscale.com> wrote:
>>
>>> View structure is:
>>>
>>> 1.
>>> Task(id* (int), name (string), start (timestamp), end (timestamp))
>>>
>>> 2.
>>> Team(person_id (int), deptId (int), isManager (int))
>>>
>>> * is primary key
>>>
>>> In schema.xml I have
>>>
>>> <field name="id" type="integer" indexed="true" stored="true"
>>> required="true"/>
>>> <field name="name" type="text" indexed="true" stored="true"/>
>>> <field name="personId" type="integer" indexed="true" stored="true"/>
>>> <field name=" deptId" type="integer" indexed="true" stored="true"/>
>>>
>>> <uniqueKey>id</uniqueKey>
>>>
>>>
>>> -----Original Message-----
>>> From: Aleksander M. Stensby
[mailto:aleksander.stensby@integrasco.no]
>>> Sent: Friday, November 21, 2008 2:56 PM
>>> To: solr-user@lucene.apache.org
>>> Subject: Re: Unique id
>>>
>>> Hello again. I'm getting a bit confused by your questions, and I
> believe
>>>
>>> it would be easier for us to help you if you could post the field
>>> definitions from your schema.xml and the structure of your two
> database
>>>
>>> views.
>>> ie.
>>> table 1: (id (int), subject (string) -.--)
>>> table 2: (category (string), other fields ..)
>>>
>>>
>>> So please post this and we can try to help you.
>>>
>>> - Aleks
>>>
>>>
>>> On Fri, 21 Nov 2008 07:49:31 +0100, Raghunandan Rao
>>> <Ra...@newscale.com> wrote:
>>>
>>>> Thanks Erik.
>>>> If I convert that to a string then id field defined in schema.xml
>>> would
>>>> fail as I have that as integer. If I change that to string then
> first
>>>> view would fail as it is Integer there. What to do in such
> scenarios?
>>> Do
>>>> I need to define multiple schema.xml or multiple unique key
>>> definitions
>>>> in same schema. How does this work? Pls explain.
>>>>
>>>> -----Original Message-----
>>>> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
>>>> Sent: Thursday, November 20, 2008 6:40 PM
>>>> To: solr-user@lucene.apache.org
>>>> Subject: Re: Unique id
>>>>
>>>> I'd suggest aggregating those three columns into a string that can
>>>> serve as the Solr uniqueKey field value.
>>>>
>>>> 	Erik
>>>>
>>>>
>>>> On Nov 20, 2008, at 1:10 AM, Raghunandan Rao wrote:
>>>>
>>>>> Basically, I am working on two views. First one has an ID column.
> The
>>>>> second view has no unique ID column. What to do in such
situations?
>>>>> There are 3 other columns where I can make a composite key out of
>>>>> those.
>>>>> I have to index these two views now.
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
>>>>> Sent: Wednesday, November 19, 2008 5:24 PM
>>>>> To: solr-user@lucene.apache.org
>>>>> Subject: Re: Unique id
>>>>>
>>>>> Technically, no, a uniqueKey field is NOT required.  I've yet to
> run
>>>>> into a situation where it made sense not to use one though.
>>>>>
>>>>> As for indexing database tables - if one of your tables doesn't
> have
>>> a
>>>>> primary key, does it have an aggregate unique "key" of some sort?
> Do
>>>>> you plan on updating the rows in that table and reindexing them?
>>>>> Seems like some kind of unique key would make sense for updating
>>>>> documents.
>>>>>
>>>>> But yeah, a more detailed description of your table structure and
>>>>> searching needs would be helpful.
>>>>>
>>>>> 	Erik
>>>>>
>>>>>
>>>>> On Nov 19, 2008, at 5:18 AM, Aleksander M. Stensby wrote:
>>>>>
>>>>>> Yes it is. You need a unique id because the add method works as
> and
>>>>>> "add or update" method. When adding a document whose ID is
already
>>>>>> found in the index, the old document will be deleted and the new
>>>>>> will be added. Are you indexing two tables into the same index?
Or
>>>>>> does one entry in the index consist of data from both tables? How
>>>>>> are these linked together without an ID?
>>>>>>
>>>>>> - Aleksander
>>>>>>
>>>>>> On Wed, 19 Nov 2008 10:42:00 +0100, Raghunandan Rao
>>>>> <Raghunandan.Rao@newscale.com
>>>>>>> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Is the uniqueKey in schema.xml really required?
>>>>>>>
>>>>>>>
>>>>>>> Reason is, I am indexing two tables and I have id as unique key
> in
>>>>>>> schema.xml but id field is not there in one of the tables and
>>>>>>> indexing
>>>>>>> fails. Do I really require this unique field for Solr to index
it
>>>>>>> better
>>>>>>> or can I do away with this?
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Rahgu
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Aleksander M. Stensby
>>>>>> Senior software developer
>>>>>> Integrasco A/S
>>>>>> www.integrasco.no
>>>>
>>>
>>
>

RE: Unique id

Posted by Raghunandan Rao <Ra...@newScale.com>.
Ok. I got your point. So I need not require ID field in the second view.
I will hence remove required="true" in schema.xml. What I thought was
unique ID makes indexing easier or used to maintain doc. 

Thanks a lot. 

-----Original Message-----
From: Aleksander M. Stensby [mailto:aleksander.stensby@integrasco.no] 
Sent: Friday, November 21, 2008 3:36 PM
To: solr-user@lucene.apache.org
Subject: Re: Unique id

Well, In that case, what do you want to search for? If I were you, I
would  
make my index consist of tasks (and I assume that is what you are trying

to do).

So why don't you just use your schema.xml as you have right now, and do

the following:

Pick a person (let's say he has person_id=42 and deptId=3), get his
queue  
of tasks, then for each task in queue do:
insert into index:
(id from the task), (name of the task), (id of the person), (id of the  
departement)
an example:
3, "this is a very important task", 42, 3
4, "this one is also important", 42, 3
5, "this one is low priority", 42, 3

And then for the next person you do the same, (person_id=58 and
deptId=5)
insert:
6, "this is about solr", 58, 5
7, "this is about lucene", 58, 5

etc.

Now you can search for all tasks in departement 5 by doing "deptId:5".
If you want to search for all the tasks assigned to a specific person
you  
just enter the query "personId:42".
And you could also search for all tasks containing certain keywords by  
doing the query "name:solr" OR "name:lucene".

Do you understand now, or is it still unclear?

- Aleks



On Fri, 21 Nov 2008 10:56:38 +0100, Raghunandan Rao  
<Ra...@newscale.com> wrote:

> Ok. There is common column in two views called queueId. I query second
> view first and get all the queueids for a person. And having queueIds
I
> get all the ids from first view.
>
> Sorry for missing that column earlier. I think it should make sense
now.
>
>
> -----Original Message-----
> From: Aleksander M. Stensby [mailto:aleksander.stensby@integrasco.no]
> Sent: Friday, November 21, 2008 3:18 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Unique id
>
> And in case that wasn't clear, the reason for it failing then would
> obviously be because you define the id field with required="true", and
> you
> try inserting a document where this field is missing...
>
> - Aleks
>
> On Fri, 21 Nov 2008 10:46:10 +0100, Aleksander M. Stensby
> <al...@integrasco.no> wrote:
>
>> Ok, this brings me to the question; how are the two view's connected
> to
>> each other (since you are indexing partly view 1 and partly view 2
> into
>> a single index structure?
>>
>> If they are not at all connected I believe you have made a
fundamental
>
>> mistake / misunderstand the use of your index...
>> I assume that a Task can be assigned to a person, and your Team view
>> displays that person, right?
>>
>> Maybe you are doing something like this:
>> View 1
>> 1, somename, sometimestamp, someothertimestamp
>> 2, someothername, somethirdtimestamp, timetamp4
>> ...
>>
>> View 2
>> 1, 58, 0
>> 2, 58, 1
>> 3, 52, 0
>> ...
>>
>> I'm really confused about your database structure...
>> To me, It would be logical to add a team_id field to the team table,
> and
>> add a third table to link tasks to a team (or to individual persons).
>> Once you have that information (because I do assume there MUST be
some
>
>> link there) you would do:
>> insert into your index:
>>   (id from the task), (name of the task), (id of the person assigned
> to
>> this task), (id of the departement that this person works in).
>>
>> I guess that you _might_ be thinking a bit wrong and trying to do
>> something like this:
>> Treat each view as independent views, and inserting values from each
>> table as separate documents in the index
>> so you would do:
>> insert into your index:
>>   (id from the task), (name of the task), (no value), (no value) ----
>
>> which will be ok to do
>>   (no value), (no value), (id of the person), (id of the departement)
>
>> --- which makes no sense to me...
>>
>> So, can you clearify the relationship between the two views, and how
> you
>> are thinking of inserting entries into your index?
>>
>> - Aleks
>>
>>
>>
>> On Fri, 21 Nov 2008 10:33:28 +0100, Raghunandan Rao
>> <Ra...@newscale.com> wrote:
>>
>>> View structure is:
>>>
>>> 1.
>>> Task(id* (int), name (string), start (timestamp), end (timestamp))
>>>
>>> 2.
>>> Team(person_id (int), deptId (int), isManager (int))
>>>
>>> * is primary key
>>>
>>> In schema.xml I have
>>>
>>> <field name="id" type="integer" indexed="true" stored="true"
>>> required="true"/>
>>> <field name="name" type="text" indexed="true" stored="true"/>
>>> <field name="personId" type="integer" indexed="true" stored="true"/>
>>> <field name=" deptId" type="integer" indexed="true" stored="true"/>
>>>
>>> <uniqueKey>id</uniqueKey>
>>>
>>>
>>> -----Original Message-----
>>> From: Aleksander M. Stensby
[mailto:aleksander.stensby@integrasco.no]
>>> Sent: Friday, November 21, 2008 2:56 PM
>>> To: solr-user@lucene.apache.org
>>> Subject: Re: Unique id
>>>
>>> Hello again. I'm getting a bit confused by your questions, and I
> believe
>>>
>>> it would be easier for us to help you if you could post the field
>>> definitions from your schema.xml and the structure of your two
> database
>>>
>>> views.
>>> ie.
>>> table 1: (id (int), subject (string) -.--)
>>> table 2: (category (string), other fields ..)
>>>
>>>
>>> So please post this and we can try to help you.
>>>
>>> - Aleks
>>>
>>>
>>> On Fri, 21 Nov 2008 07:49:31 +0100, Raghunandan Rao
>>> <Ra...@newscale.com> wrote:
>>>
>>>> Thanks Erik.
>>>> If I convert that to a string then id field defined in schema.xml
>>> would
>>>> fail as I have that as integer. If I change that to string then
> first
>>>> view would fail as it is Integer there. What to do in such
> scenarios?
>>> Do
>>>> I need to define multiple schema.xml or multiple unique key
>>> definitions
>>>> in same schema. How does this work? Pls explain.
>>>>
>>>> -----Original Message-----
>>>> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
>>>> Sent: Thursday, November 20, 2008 6:40 PM
>>>> To: solr-user@lucene.apache.org
>>>> Subject: Re: Unique id
>>>>
>>>> I'd suggest aggregating those three columns into a string that can
>>>> serve as the Solr uniqueKey field value.
>>>>
>>>> 	Erik
>>>>
>>>>
>>>> On Nov 20, 2008, at 1:10 AM, Raghunandan Rao wrote:
>>>>
>>>>> Basically, I am working on two views. First one has an ID column.
> The
>>>>> second view has no unique ID column. What to do in such
situations?
>>>>> There are 3 other columns where I can make a composite key out of
>>>>> those.
>>>>> I have to index these two views now.
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
>>>>> Sent: Wednesday, November 19, 2008 5:24 PM
>>>>> To: solr-user@lucene.apache.org
>>>>> Subject: Re: Unique id
>>>>>
>>>>> Technically, no, a uniqueKey field is NOT required.  I've yet to
> run
>>>>> into a situation where it made sense not to use one though.
>>>>>
>>>>> As for indexing database tables - if one of your tables doesn't
> have
>>> a
>>>>> primary key, does it have an aggregate unique "key" of some sort?
> Do
>>>>> you plan on updating the rows in that table and reindexing them?
>>>>> Seems like some kind of unique key would make sense for updating
>>>>> documents.
>>>>>
>>>>> But yeah, a more detailed description of your table structure and
>>>>> searching needs would be helpful.
>>>>>
>>>>> 	Erik
>>>>>
>>>>>
>>>>> On Nov 19, 2008, at 5:18 AM, Aleksander M. Stensby wrote:
>>>>>
>>>>>> Yes it is. You need a unique id because the add method works as
> and
>>>>>> "add or update" method. When adding a document whose ID is
already
>>>>>> found in the index, the old document will be deleted and the new
>>>>>> will be added. Are you indexing two tables into the same index?
Or
>>>>>> does one entry in the index consist of data from both tables? How
>>>>>> are these linked together without an ID?
>>>>>>
>>>>>> - Aleksander
>>>>>>
>>>>>> On Wed, 19 Nov 2008 10:42:00 +0100, Raghunandan Rao
>>>>> <Raghunandan.Rao@newscale.com
>>>>>>> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Is the uniqueKey in schema.xml really required?
>>>>>>>
>>>>>>>
>>>>>>> Reason is, I am indexing two tables and I have id as unique key
> in
>>>>>>> schema.xml but id field is not there in one of the tables and
>>>>>>> indexing
>>>>>>> fails. Do I really require this unique field for Solr to index
it
>>>>>>> better
>>>>>>> or can I do away with this?
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Rahgu
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Aleksander M. Stensby
>>>>>> Senior software developer
>>>>>> Integrasco A/S
>>>>>> www.integrasco.no
>>>>
>>>
>>
>

Re: Unique id

Posted by "Aleksander M. Stensby" <al...@integrasco.no>.
Well, In that case, what do you want to search for? If I were you, I would  
make my index consist of tasks (and I assume that is what you are trying  
to do).

So why don't you just use your schema.xml as you have right now, and do  
the following:

Pick a person (let's say he has person_id=42 and deptId=3), get his queue  
of tasks, then for each task in queue do:
insert into index:
(id from the task), (name of the task), (id of the person), (id of the  
departement)
an example:
3, "this is a very important task", 42, 3
4, "this one is also important", 42, 3
5, "this one is low priority", 42, 3

And then for the next person you do the same, (person_id=58 and deptId=5)
insert:
6, "this is about solr", 58, 5
7, "this is about lucene", 58, 5

etc.

Now you can search for all tasks in departement 5 by doing "deptId:5".
If you want to search for all the tasks assigned to a specific person you  
just enter the query "personId:42".
And you could also search for all tasks containing certain keywords by  
doing the query "name:solr" OR "name:lucene".

Do you understand now, or is it still unclear?

- Aleks



On Fri, 21 Nov 2008 10:56:38 +0100, Raghunandan Rao  
<Ra...@newscale.com> wrote:

> Ok. There is common column in two views called queueId. I query second
> view first and get all the queueids for a person. And having queueIds I
> get all the ids from first view.
>
> Sorry for missing that column earlier. I think it should make sense now.
>
>
> -----Original Message-----
> From: Aleksander M. Stensby [mailto:aleksander.stensby@integrasco.no]
> Sent: Friday, November 21, 2008 3:18 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Unique id
>
> And in case that wasn't clear, the reason for it failing then would
> obviously be because you define the id field with required="true", and
> you
> try inserting a document where this field is missing...
>
> - Aleks
>
> On Fri, 21 Nov 2008 10:46:10 +0100, Aleksander M. Stensby
> <al...@integrasco.no> wrote:
>
>> Ok, this brings me to the question; how are the two view's connected
> to
>> each other (since you are indexing partly view 1 and partly view 2
> into
>> a single index structure?
>>
>> If they are not at all connected I believe you have made a fundamental
>
>> mistake / misunderstand the use of your index...
>> I assume that a Task can be assigned to a person, and your Team view
>> displays that person, right?
>>
>> Maybe you are doing something like this:
>> View 1
>> 1, somename, sometimestamp, someothertimestamp
>> 2, someothername, somethirdtimestamp, timetamp4
>> ...
>>
>> View 2
>> 1, 58, 0
>> 2, 58, 1
>> 3, 52, 0
>> ...
>>
>> I'm really confused about your database structure...
>> To me, It would be logical to add a team_id field to the team table,
> and
>> add a third table to link tasks to a team (or to individual persons).
>> Once you have that information (because I do assume there MUST be some
>
>> link there) you would do:
>> insert into your index:
>>   (id from the task), (name of the task), (id of the person assigned
> to
>> this task), (id of the departement that this person works in).
>>
>> I guess that you _might_ be thinking a bit wrong and trying to do
>> something like this:
>> Treat each view as independent views, and inserting values from each
>> table as separate documents in the index
>> so you would do:
>> insert into your index:
>>   (id from the task), (name of the task), (no value), (no value) ----
>
>> which will be ok to do
>>   (no value), (no value), (id of the person), (id of the departement)
>
>> --- which makes no sense to me...
>>
>> So, can you clearify the relationship between the two views, and how
> you
>> are thinking of inserting entries into your index?
>>
>> - Aleks
>>
>>
>>
>> On Fri, 21 Nov 2008 10:33:28 +0100, Raghunandan Rao
>> <Ra...@newscale.com> wrote:
>>
>>> View structure is:
>>>
>>> 1.
>>> Task(id* (int), name (string), start (timestamp), end (timestamp))
>>>
>>> 2.
>>> Team(person_id (int), deptId (int), isManager (int))
>>>
>>> * is primary key
>>>
>>> In schema.xml I have
>>>
>>> <field name="id" type="integer" indexed="true" stored="true"
>>> required="true"/>
>>> <field name="name" type="text" indexed="true" stored="true"/>
>>> <field name="personId" type="integer" indexed="true" stored="true"/>
>>> <field name=" deptId" type="integer" indexed="true" stored="true"/>
>>>
>>> <uniqueKey>id</uniqueKey>
>>>
>>>
>>> -----Original Message-----
>>> From: Aleksander M. Stensby [mailto:aleksander.stensby@integrasco.no]
>>> Sent: Friday, November 21, 2008 2:56 PM
>>> To: solr-user@lucene.apache.org
>>> Subject: Re: Unique id
>>>
>>> Hello again. I'm getting a bit confused by your questions, and I
> believe
>>>
>>> it would be easier for us to help you if you could post the field
>>> definitions from your schema.xml and the structure of your two
> database
>>>
>>> views.
>>> ie.
>>> table 1: (id (int), subject (string) -.--)
>>> table 2: (category (string), other fields ..)
>>>
>>>
>>> So please post this and we can try to help you.
>>>
>>> - Aleks
>>>
>>>
>>> On Fri, 21 Nov 2008 07:49:31 +0100, Raghunandan Rao
>>> <Ra...@newscale.com> wrote:
>>>
>>>> Thanks Erik.
>>>> If I convert that to a string then id field defined in schema.xml
>>> would
>>>> fail as I have that as integer. If I change that to string then
> first
>>>> view would fail as it is Integer there. What to do in such
> scenarios?
>>> Do
>>>> I need to define multiple schema.xml or multiple unique key
>>> definitions
>>>> in same schema. How does this work? Pls explain.
>>>>
>>>> -----Original Message-----
>>>> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
>>>> Sent: Thursday, November 20, 2008 6:40 PM
>>>> To: solr-user@lucene.apache.org
>>>> Subject: Re: Unique id
>>>>
>>>> I'd suggest aggregating those three columns into a string that can
>>>> serve as the Solr uniqueKey field value.
>>>>
>>>> 	Erik
>>>>
>>>>
>>>> On Nov 20, 2008, at 1:10 AM, Raghunandan Rao wrote:
>>>>
>>>>> Basically, I am working on two views. First one has an ID column.
> The
>>>>> second view has no unique ID column. What to do in such situations?
>>>>> There are 3 other columns where I can make a composite key out of
>>>>> those.
>>>>> I have to index these two views now.
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
>>>>> Sent: Wednesday, November 19, 2008 5:24 PM
>>>>> To: solr-user@lucene.apache.org
>>>>> Subject: Re: Unique id
>>>>>
>>>>> Technically, no, a uniqueKey field is NOT required.  I've yet to
> run
>>>>> into a situation where it made sense not to use one though.
>>>>>
>>>>> As for indexing database tables - if one of your tables doesn't
> have
>>> a
>>>>> primary key, does it have an aggregate unique "key" of some sort?
> Do
>>>>> you plan on updating the rows in that table and reindexing them?
>>>>> Seems like some kind of unique key would make sense for updating
>>>>> documents.
>>>>>
>>>>> But yeah, a more detailed description of your table structure and
>>>>> searching needs would be helpful.
>>>>>
>>>>> 	Erik
>>>>>
>>>>>
>>>>> On Nov 19, 2008, at 5:18 AM, Aleksander M. Stensby wrote:
>>>>>
>>>>>> Yes it is. You need a unique id because the add method works as
> and
>>>>>> "add or update" method. When adding a document whose ID is already
>>>>>> found in the index, the old document will be deleted and the new
>>>>>> will be added. Are you indexing two tables into the same index? Or
>>>>>> does one entry in the index consist of data from both tables? How
>>>>>> are these linked together without an ID?
>>>>>>
>>>>>> - Aleksander
>>>>>>
>>>>>> On Wed, 19 Nov 2008 10:42:00 +0100, Raghunandan Rao
>>>>> <Raghunandan.Rao@newscale.com
>>>>>>> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Is the uniqueKey in schema.xml really required?
>>>>>>>
>>>>>>>
>>>>>>> Reason is, I am indexing two tables and I have id as unique key
> in
>>>>>>> schema.xml but id field is not there in one of the tables and
>>>>>>> indexing
>>>>>>> fails. Do I really require this unique field for Solr to index it
>>>>>>> better
>>>>>>> or can I do away with this?
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Rahgu
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Aleksander M. Stensby
>>>>>> Senior software developer
>>>>>> Integrasco A/S
>>>>>> www.integrasco.no
>>>>
>>>
>>
>

RE: Unique id

Posted by Raghunandan Rao <Ra...@newScale.com>.
Ok. There is common column in two views called queueId. I query second
view first and get all the queueids for a person. And having queueIds I
get all the ids from first view. 

Sorry for missing that column earlier. I think it should make sense now.


-----Original Message-----
From: Aleksander M. Stensby [mailto:aleksander.stensby@integrasco.no] 
Sent: Friday, November 21, 2008 3:18 PM
To: solr-user@lucene.apache.org
Subject: Re: Unique id

And in case that wasn't clear, the reason for it failing then would  
obviously be because you define the id field with required="true", and
you  
try inserting a document where this field is missing...

- Aleks

On Fri, 21 Nov 2008 10:46:10 +0100, Aleksander M. Stensby  
<al...@integrasco.no> wrote:

> Ok, this brings me to the question; how are the two view's connected
to  
> each other (since you are indexing partly view 1 and partly view 2
into  
> a single index structure?
>
> If they are not at all connected I believe you have made a fundamental

> mistake / misunderstand the use of your index...
> I assume that a Task can be assigned to a person, and your Team view  
> displays that person, right?
>
> Maybe you are doing something like this:
> View 1
> 1, somename, sometimestamp, someothertimestamp
> 2, someothername, somethirdtimestamp, timetamp4
> ...
>
> View 2
> 1, 58, 0
> 2, 58, 1
> 3, 52, 0
> ...
>
> I'm really confused about your database structure...
> To me, It would be logical to add a team_id field to the team table,
and  
> add a third table to link tasks to a team (or to individual persons).
> Once you have that information (because I do assume there MUST be some

> link there) you would do:
> insert into your index:
>   (id from the task), (name of the task), (id of the person assigned
to  
> this task), (id of the departement that this person works in).
>
> I guess that you _might_ be thinking a bit wrong and trying to do  
> something like this:
> Treat each view as independent views, and inserting values from each  
> table as separate documents in the index
> so you would do:
> insert into your index:
>   (id from the task), (name of the task), (no value), (no value) ----

> which will be ok to do
>   (no value), (no value), (id of the person), (id of the departement)

> --- which makes no sense to me...
>
> So, can you clearify the relationship between the two views, and how
you  
> are thinking of inserting entries into your index?
>
> - Aleks
>
>
>
> On Fri, 21 Nov 2008 10:33:28 +0100, Raghunandan Rao  
> <Ra...@newscale.com> wrote:
>
>> View structure is:
>>
>> 1.
>> Task(id* (int), name (string), start (timestamp), end (timestamp))
>>
>> 2.
>> Team(person_id (int), deptId (int), isManager (int))
>>
>> * is primary key
>>
>> In schema.xml I have
>>
>> <field name="id" type="integer" indexed="true" stored="true"
>> required="true"/>
>> <field name="name" type="text" indexed="true" stored="true"/>
>> <field name="personId" type="integer" indexed="true" stored="true"/>
>> <field name=" deptId" type="integer" indexed="true" stored="true"/>
>>
>> <uniqueKey>id</uniqueKey>
>>
>>
>> -----Original Message-----
>> From: Aleksander M. Stensby [mailto:aleksander.stensby@integrasco.no]
>> Sent: Friday, November 21, 2008 2:56 PM
>> To: solr-user@lucene.apache.org
>> Subject: Re: Unique id
>>
>> Hello again. I'm getting a bit confused by your questions, and I
believe
>>
>> it would be easier for us to help you if you could post the field
>> definitions from your schema.xml and the structure of your two
database
>>
>> views.
>> ie.
>> table 1: (id (int), subject (string) -.--)
>> table 2: (category (string), other fields ..)
>>
>>
>> So please post this and we can try to help you.
>>
>> - Aleks
>>
>>
>> On Fri, 21 Nov 2008 07:49:31 +0100, Raghunandan Rao
>> <Ra...@newscale.com> wrote:
>>
>>> Thanks Erik.
>>> If I convert that to a string then id field defined in schema.xml
>> would
>>> fail as I have that as integer. If I change that to string then
first
>>> view would fail as it is Integer there. What to do in such
scenarios?
>> Do
>>> I need to define multiple schema.xml or multiple unique key
>> definitions
>>> in same schema. How does this work? Pls explain.
>>>
>>> -----Original Message-----
>>> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
>>> Sent: Thursday, November 20, 2008 6:40 PM
>>> To: solr-user@lucene.apache.org
>>> Subject: Re: Unique id
>>>
>>> I'd suggest aggregating those three columns into a string that can
>>> serve as the Solr uniqueKey field value.
>>>
>>> 	Erik
>>>
>>>
>>> On Nov 20, 2008, at 1:10 AM, Raghunandan Rao wrote:
>>>
>>>> Basically, I am working on two views. First one has an ID column.
The
>>>> second view has no unique ID column. What to do in such situations?
>>>> There are 3 other columns where I can make a composite key out of
>>>> those.
>>>> I have to index these two views now.
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
>>>> Sent: Wednesday, November 19, 2008 5:24 PM
>>>> To: solr-user@lucene.apache.org
>>>> Subject: Re: Unique id
>>>>
>>>> Technically, no, a uniqueKey field is NOT required.  I've yet to
run
>>>> into a situation where it made sense not to use one though.
>>>>
>>>> As for indexing database tables - if one of your tables doesn't
have
>> a
>>>> primary key, does it have an aggregate unique "key" of some sort?
Do
>>>> you plan on updating the rows in that table and reindexing them?
>>>> Seems like some kind of unique key would make sense for updating
>>>> documents.
>>>>
>>>> But yeah, a more detailed description of your table structure and
>>>> searching needs would be helpful.
>>>>
>>>> 	Erik
>>>>
>>>>
>>>> On Nov 19, 2008, at 5:18 AM, Aleksander M. Stensby wrote:
>>>>
>>>>> Yes it is. You need a unique id because the add method works as
and
>>>>> "add or update" method. When adding a document whose ID is already
>>>>> found in the index, the old document will be deleted and the new
>>>>> will be added. Are you indexing two tables into the same index? Or
>>>>> does one entry in the index consist of data from both tables? How
>>>>> are these linked together without an ID?
>>>>>
>>>>> - Aleksander
>>>>>
>>>>> On Wed, 19 Nov 2008 10:42:00 +0100, Raghunandan Rao
>>>> <Raghunandan.Rao@newscale.com
>>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Is the uniqueKey in schema.xml really required?
>>>>>>
>>>>>>
>>>>>> Reason is, I am indexing two tables and I have id as unique key
in
>>>>>> schema.xml but id field is not there in one of the tables and
>>>>>> indexing
>>>>>> fails. Do I really require this unique field for Solr to index it
>>>>>> better
>>>>>> or can I do away with this?
>>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Rahgu
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Aleksander M. Stensby
>>>>> Senior software developer
>>>>> Integrasco A/S
>>>>> www.integrasco.no
>>>
>>
>

Re: Unique id

Posted by "Aleksander M. Stensby" <al...@integrasco.no>.
And in case that wasn't clear, the reason for it failing then would  
obviously be because you define the id field with required="true", and you  
try inserting a document where this field is missing...

- Aleks

On Fri, 21 Nov 2008 10:46:10 +0100, Aleksander M. Stensby  
<al...@integrasco.no> wrote:

> Ok, this brings me to the question; how are the two view's connected to  
> each other (since you are indexing partly view 1 and partly view 2 into  
> a single index structure?
>
> If they are not at all connected I believe you have made a fundamental  
> mistake / misunderstand the use of your index...
> I assume that a Task can be assigned to a person, and your Team view  
> displays that person, right?
>
> Maybe you are doing something like this:
> View 1
> 1, somename, sometimestamp, someothertimestamp
> 2, someothername, somethirdtimestamp, timetamp4
> ...
>
> View 2
> 1, 58, 0
> 2, 58, 1
> 3, 52, 0
> ...
>
> I'm really confused about your database structure...
> To me, It would be logical to add a team_id field to the team table, and  
> add a third table to link tasks to a team (or to individual persons).
> Once you have that information (because I do assume there MUST be some  
> link there) you would do:
> insert into your index:
>   (id from the task), (name of the task), (id of the person assigned to  
> this task), (id of the departement that this person works in).
>
> I guess that you _might_ be thinking a bit wrong and trying to do  
> something like this:
> Treat each view as independent views, and inserting values from each  
> table as separate documents in the index
> so you would do:
> insert into your index:
>   (id from the task), (name of the task), (no value), (no value) ----  
> which will be ok to do
>   (no value), (no value), (id of the person), (id of the departement)  
> --- which makes no sense to me...
>
> So, can you clearify the relationship between the two views, and how you  
> are thinking of inserting entries into your index?
>
> - Aleks
>
>
>
> On Fri, 21 Nov 2008 10:33:28 +0100, Raghunandan Rao  
> <Ra...@newscale.com> wrote:
>
>> View structure is:
>>
>> 1.
>> Task(id* (int), name (string), start (timestamp), end (timestamp))
>>
>> 2.
>> Team(person_id (int), deptId (int), isManager (int))
>>
>> * is primary key
>>
>> In schema.xml I have
>>
>> <field name="id" type="integer" indexed="true" stored="true"
>> required="true"/>
>> <field name="name" type="text" indexed="true" stored="true"/>
>> <field name="personId" type="integer" indexed="true" stored="true"/>
>> <field name=" deptId" type="integer" indexed="true" stored="true"/>
>>
>> <uniqueKey>id</uniqueKey>
>>
>>
>> -----Original Message-----
>> From: Aleksander M. Stensby [mailto:aleksander.stensby@integrasco.no]
>> Sent: Friday, November 21, 2008 2:56 PM
>> To: solr-user@lucene.apache.org
>> Subject: Re: Unique id
>>
>> Hello again. I'm getting a bit confused by your questions, and I believe
>>
>> it would be easier for us to help you if you could post the field
>> definitions from your schema.xml and the structure of your two database
>>
>> views.
>> ie.
>> table 1: (id (int), subject (string) -.--)
>> table 2: (category (string), other fields ..)
>>
>>
>> So please post this and we can try to help you.
>>
>> - Aleks
>>
>>
>> On Fri, 21 Nov 2008 07:49:31 +0100, Raghunandan Rao
>> <Ra...@newscale.com> wrote:
>>
>>> Thanks Erik.
>>> If I convert that to a string then id field defined in schema.xml
>> would
>>> fail as I have that as integer. If I change that to string then first
>>> view would fail as it is Integer there. What to do in such scenarios?
>> Do
>>> I need to define multiple schema.xml or multiple unique key
>> definitions
>>> in same schema. How does this work? Pls explain.
>>>
>>> -----Original Message-----
>>> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
>>> Sent: Thursday, November 20, 2008 6:40 PM
>>> To: solr-user@lucene.apache.org
>>> Subject: Re: Unique id
>>>
>>> I'd suggest aggregating those three columns into a string that can
>>> serve as the Solr uniqueKey field value.
>>>
>>> 	Erik
>>>
>>>
>>> On Nov 20, 2008, at 1:10 AM, Raghunandan Rao wrote:
>>>
>>>> Basically, I am working on two views. First one has an ID column. The
>>>> second view has no unique ID column. What to do in such situations?
>>>> There are 3 other columns where I can make a composite key out of
>>>> those.
>>>> I have to index these two views now.
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
>>>> Sent: Wednesday, November 19, 2008 5:24 PM
>>>> To: solr-user@lucene.apache.org
>>>> Subject: Re: Unique id
>>>>
>>>> Technically, no, a uniqueKey field is NOT required.  I've yet to run
>>>> into a situation where it made sense not to use one though.
>>>>
>>>> As for indexing database tables - if one of your tables doesn't have
>> a
>>>> primary key, does it have an aggregate unique "key" of some sort?  Do
>>>> you plan on updating the rows in that table and reindexing them?
>>>> Seems like some kind of unique key would make sense for updating
>>>> documents.
>>>>
>>>> But yeah, a more detailed description of your table structure and
>>>> searching needs would be helpful.
>>>>
>>>> 	Erik
>>>>
>>>>
>>>> On Nov 19, 2008, at 5:18 AM, Aleksander M. Stensby wrote:
>>>>
>>>>> Yes it is. You need a unique id because the add method works as and
>>>>> "add or update" method. When adding a document whose ID is already
>>>>> found in the index, the old document will be deleted and the new
>>>>> will be added. Are you indexing two tables into the same index? Or
>>>>> does one entry in the index consist of data from both tables? How
>>>>> are these linked together without an ID?
>>>>>
>>>>> - Aleksander
>>>>>
>>>>> On Wed, 19 Nov 2008 10:42:00 +0100, Raghunandan Rao
>>>> <Raghunandan.Rao@newscale.com
>>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Is the uniqueKey in schema.xml really required?
>>>>>>
>>>>>>
>>>>>> Reason is, I am indexing two tables and I have id as unique key in
>>>>>> schema.xml but id field is not there in one of the tables and
>>>>>> indexing
>>>>>> fails. Do I really require this unique field for Solr to index it
>>>>>> better
>>>>>> or can I do away with this?
>>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Rahgu
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Aleksander M. Stensby
>>>>> Senior software developer
>>>>> Integrasco A/S
>>>>> www.integrasco.no
>>>
>>
>

Re: Unique id

Posted by "Aleksander M. Stensby" <al...@integrasco.no>.
Ok, this brings me to the question; how are the two view's connected to  
each other (since you are indexing partly view 1 and partly view 2 into a  
single index structure?

If they are not at all connected I believe you have made a fundamental  
mistake / misunderstand the use of your index...
I assume that a Task can be assigned to a person, and your Team view  
displays that person, right?

Maybe you are doing something like this:
View 1
1, somename, sometimestamp, someothertimestamp
2, someothername, somethirdtimestamp, timetamp4
...

View 2
1, 58, 0
2, 58, 1
3, 52, 0
...

I'm really confused about your database structure...
To me, It would be logical to add a team_id field to the team table, and  
add a third table to link tasks to a team (or to individual persons).
Once you have that information (because I do assume there MUST be some  
link there) you would do:
insert into your index:
  (id from the task), (name of the task), (id of the person assigned to  
this task), (id of the departement that this person works in).

I guess that you _might_ be thinking a bit wrong and trying to do  
something like this:
Treat each view as independent views, and inserting values from each table  
as separate documents in the index
so you would do:
insert into your index:
  (id from the task), (name of the task), (no value), (no value) ---- which  
will be ok to do
  (no value), (no value), (id of the person), (id of the departement) ---  
which makes no sense to me...

So, can you clearify the relationship between the two views, and how you  
are thinking of inserting entries into your index?

- Aleks



On Fri, 21 Nov 2008 10:33:28 +0100, Raghunandan Rao  
<Ra...@newscale.com> wrote:

> View structure is:
>
> 1.
> Task(id* (int), name (string), start (timestamp), end (timestamp))
>
> 2.
> Team(person_id (int), deptId (int), isManager (int))
>
> * is primary key
>
> In schema.xml I have
>
> <field name="id" type="integer" indexed="true" stored="true"
> required="true"/>
> <field name="name" type="text" indexed="true" stored="true"/>
> <field name="personId" type="integer" indexed="true" stored="true"/>
> <field name=" deptId" type="integer" indexed="true" stored="true"/>
>
> <uniqueKey>id</uniqueKey>
>
>
> -----Original Message-----
> From: Aleksander M. Stensby [mailto:aleksander.stensby@integrasco.no]
> Sent: Friday, November 21, 2008 2:56 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Unique id
>
> Hello again. I'm getting a bit confused by your questions, and I believe
>
> it would be easier for us to help you if you could post the field
> definitions from your schema.xml and the structure of your two database
>
> views.
> ie.
> table 1: (id (int), subject (string) -.--)
> table 2: (category (string), other fields ..)
>
>
> So please post this and we can try to help you.
>
> - Aleks
>
>
> On Fri, 21 Nov 2008 07:49:31 +0100, Raghunandan Rao
> <Ra...@newscale.com> wrote:
>
>> Thanks Erik.
>> If I convert that to a string then id field defined in schema.xml
> would
>> fail as I have that as integer. If I change that to string then first
>> view would fail as it is Integer there. What to do in such scenarios?
> Do
>> I need to define multiple schema.xml or multiple unique key
> definitions
>> in same schema. How does this work? Pls explain.
>>
>> -----Original Message-----
>> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
>> Sent: Thursday, November 20, 2008 6:40 PM
>> To: solr-user@lucene.apache.org
>> Subject: Re: Unique id
>>
>> I'd suggest aggregating those three columns into a string that can
>> serve as the Solr uniqueKey field value.
>>
>> 	Erik
>>
>>
>> On Nov 20, 2008, at 1:10 AM, Raghunandan Rao wrote:
>>
>>> Basically, I am working on two views. First one has an ID column. The
>>> second view has no unique ID column. What to do in such situations?
>>> There are 3 other columns where I can make a composite key out of
>>> those.
>>> I have to index these two views now.
>>>
>>>
>>> -----Original Message-----
>>> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
>>> Sent: Wednesday, November 19, 2008 5:24 PM
>>> To: solr-user@lucene.apache.org
>>> Subject: Re: Unique id
>>>
>>> Technically, no, a uniqueKey field is NOT required.  I've yet to run
>>> into a situation where it made sense not to use one though.
>>>
>>> As for indexing database tables - if one of your tables doesn't have
> a
>>> primary key, does it have an aggregate unique "key" of some sort?  Do
>>> you plan on updating the rows in that table and reindexing them?
>>> Seems like some kind of unique key would make sense for updating
>>> documents.
>>>
>>> But yeah, a more detailed description of your table structure and
>>> searching needs would be helpful.
>>>
>>> 	Erik
>>>
>>>
>>> On Nov 19, 2008, at 5:18 AM, Aleksander M. Stensby wrote:
>>>
>>>> Yes it is. You need a unique id because the add method works as and
>>>> "add or update" method. When adding a document whose ID is already
>>>> found in the index, the old document will be deleted and the new
>>>> will be added. Are you indexing two tables into the same index? Or
>>>> does one entry in the index consist of data from both tables? How
>>>> are these linked together without an ID?
>>>>
>>>> - Aleksander
>>>>
>>>> On Wed, 19 Nov 2008 10:42:00 +0100, Raghunandan Rao
>>> <Raghunandan.Rao@newscale.com
>>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Is the uniqueKey in schema.xml really required?
>>>>>
>>>>>
>>>>> Reason is, I am indexing two tables and I have id as unique key in
>>>>> schema.xml but id field is not there in one of the tables and
>>>>> indexing
>>>>> fails. Do I really require this unique field for Solr to index it
>>>>> better
>>>>> or can I do away with this?
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Rahgu
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Aleksander M. Stensby
>>>> Senior software developer
>>>> Integrasco A/S
>>>> www.integrasco.no
>>
>

RE: Unique id

Posted by Raghunandan Rao <Ra...@newScale.com>.
View structure is:

1. 
Task(id* (int), name (string), start (timestamp), end (timestamp))

2.
Team(person_id (int), deptId (int), isManager (int)) 

* is primary key

In schema.xml I have

<field name="id" type="integer" indexed="true" stored="true"
required="true"/>
<field name="name" type="text" indexed="true" stored="true"/>
<field name="personId" type="integer" indexed="true" stored="true"/>
<field name=" deptId" type="integer" indexed="true" stored="true"/>

<uniqueKey>id</uniqueKey>


-----Original Message-----
From: Aleksander M. Stensby [mailto:aleksander.stensby@integrasco.no] 
Sent: Friday, November 21, 2008 2:56 PM
To: solr-user@lucene.apache.org
Subject: Re: Unique id

Hello again. I'm getting a bit confused by your questions, and I believe

it would be easier for us to help you if you could post the field  
definitions from your schema.xml and the structure of your two database

views.
ie.
table 1: (id (int), subject (string) -.--)
table 2: (category (string), other fields ..)


So please post this and we can try to help you.

- Aleks


On Fri, 21 Nov 2008 07:49:31 +0100, Raghunandan Rao  
<Ra...@newscale.com> wrote:

> Thanks Erik.
> If I convert that to a string then id field defined in schema.xml
would
> fail as I have that as integer. If I change that to string then first
> view would fail as it is Integer there. What to do in such scenarios?
Do
> I need to define multiple schema.xml or multiple unique key
definitions
> in same schema. How does this work? Pls explain.
>
> -----Original Message-----
> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
> Sent: Thursday, November 20, 2008 6:40 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Unique id
>
> I'd suggest aggregating those three columns into a string that can
> serve as the Solr uniqueKey field value.
>
> 	Erik
>
>
> On Nov 20, 2008, at 1:10 AM, Raghunandan Rao wrote:
>
>> Basically, I am working on two views. First one has an ID column. The
>> second view has no unique ID column. What to do in such situations?
>> There are 3 other columns where I can make a composite key out of
>> those.
>> I have to index these two views now.
>>
>>
>> -----Original Message-----
>> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
>> Sent: Wednesday, November 19, 2008 5:24 PM
>> To: solr-user@lucene.apache.org
>> Subject: Re: Unique id
>>
>> Technically, no, a uniqueKey field is NOT required.  I've yet to run
>> into a situation where it made sense not to use one though.
>>
>> As for indexing database tables - if one of your tables doesn't have
a
>> primary key, does it have an aggregate unique "key" of some sort?  Do
>> you plan on updating the rows in that table and reindexing them?
>> Seems like some kind of unique key would make sense for updating
>> documents.
>>
>> But yeah, a more detailed description of your table structure and
>> searching needs would be helpful.
>>
>> 	Erik
>>
>>
>> On Nov 19, 2008, at 5:18 AM, Aleksander M. Stensby wrote:
>>
>>> Yes it is. You need a unique id because the add method works as and
>>> "add or update" method. When adding a document whose ID is already
>>> found in the index, the old document will be deleted and the new
>>> will be added. Are you indexing two tables into the same index? Or
>>> does one entry in the index consist of data from both tables? How
>>> are these linked together without an ID?
>>>
>>> - Aleksander
>>>
>>> On Wed, 19 Nov 2008 10:42:00 +0100, Raghunandan Rao
>> <Raghunandan.Rao@newscale.com
>>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> Is the uniqueKey in schema.xml really required?
>>>>
>>>>
>>>> Reason is, I am indexing two tables and I have id as unique key in
>>>> schema.xml but id field is not there in one of the tables and
>>>> indexing
>>>> fails. Do I really require this unique field for Solr to index it
>>>> better
>>>> or can I do away with this?
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Rahgu
>>>>
>>>
>>>
>>>
>>> --
>>> Aleksander M. Stensby
>>> Senior software developer
>>> Integrasco A/S
>>> www.integrasco.no
>

Re: Unique id

Posted by "Aleksander M. Stensby" <al...@integrasco.no>.
Hello again. I'm getting a bit confused by your questions, and I believe  
it would be easier for us to help you if you could post the field  
definitions from your schema.xml and the structure of your two database  
views.
ie.
table 1: (id (int), subject (string) -.--)
table 2: (category (string), other fields ..)


So please post this and we can try to help you.

- Aleks


On Fri, 21 Nov 2008 07:49:31 +0100, Raghunandan Rao  
<Ra...@newscale.com> wrote:

> Thanks Erik.
> If I convert that to a string then id field defined in schema.xml would
> fail as I have that as integer. If I change that to string then first
> view would fail as it is Integer there. What to do in such scenarios? Do
> I need to define multiple schema.xml or multiple unique key definitions
> in same schema. How does this work? Pls explain.
>
> -----Original Message-----
> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
> Sent: Thursday, November 20, 2008 6:40 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Unique id
>
> I'd suggest aggregating those three columns into a string that can
> serve as the Solr uniqueKey field value.
>
> 	Erik
>
>
> On Nov 20, 2008, at 1:10 AM, Raghunandan Rao wrote:
>
>> Basically, I am working on two views. First one has an ID column. The
>> second view has no unique ID column. What to do in such situations?
>> There are 3 other columns where I can make a composite key out of
>> those.
>> I have to index these two views now.
>>
>>
>> -----Original Message-----
>> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
>> Sent: Wednesday, November 19, 2008 5:24 PM
>> To: solr-user@lucene.apache.org
>> Subject: Re: Unique id
>>
>> Technically, no, a uniqueKey field is NOT required.  I've yet to run
>> into a situation where it made sense not to use one though.
>>
>> As for indexing database tables - if one of your tables doesn't have a
>> primary key, does it have an aggregate unique "key" of some sort?  Do
>> you plan on updating the rows in that table and reindexing them?
>> Seems like some kind of unique key would make sense for updating
>> documents.
>>
>> But yeah, a more detailed description of your table structure and
>> searching needs would be helpful.
>>
>> 	Erik
>>
>>
>> On Nov 19, 2008, at 5:18 AM, Aleksander M. Stensby wrote:
>>
>>> Yes it is. You need a unique id because the add method works as and
>>> "add or update" method. When adding a document whose ID is already
>>> found in the index, the old document will be deleted and the new
>>> will be added. Are you indexing two tables into the same index? Or
>>> does one entry in the index consist of data from both tables? How
>>> are these linked together without an ID?
>>>
>>> - Aleksander
>>>
>>> On Wed, 19 Nov 2008 10:42:00 +0100, Raghunandan Rao
>> <Raghunandan.Rao@newscale.com
>>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> Is the uniqueKey in schema.xml really required?
>>>>
>>>>
>>>> Reason is, I am indexing two tables and I have id as unique key in
>>>> schema.xml but id field is not there in one of the tables and
>>>> indexing
>>>> fails. Do I really require this unique field for Solr to index it
>>>> better
>>>> or can I do away with this?
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Rahgu
>>>>
>>>
>>>
>>>
>>> --
>>> Aleksander M. Stensby
>>> Senior software developer
>>> Integrasco A/S
>>> www.integrasco.no
>

RE: Unique id

Posted by Raghunandan Rao <Ra...@newScale.com>.
Thanks Erik. 
If I convert that to a string then id field defined in schema.xml would
fail as I have that as integer. If I change that to string then first
view would fail as it is Integer there. What to do in such scenarios? Do
I need to define multiple schema.xml or multiple unique key definitions
in same schema. How does this work? Pls explain. 

-----Original Message-----
From: Erik Hatcher [mailto:erik@ehatchersolutions.com] 
Sent: Thursday, November 20, 2008 6:40 PM
To: solr-user@lucene.apache.org
Subject: Re: Unique id

I'd suggest aggregating those three columns into a string that can  
serve as the Solr uniqueKey field value.

	Erik


On Nov 20, 2008, at 1:10 AM, Raghunandan Rao wrote:

> Basically, I am working on two views. First one has an ID column. The
> second view has no unique ID column. What to do in such situations?
> There are 3 other columns where I can make a composite key out of  
> those.
> I have to index these two views now.
>
>
> -----Original Message-----
> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
> Sent: Wednesday, November 19, 2008 5:24 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Unique id
>
> Technically, no, a uniqueKey field is NOT required.  I've yet to run
> into a situation where it made sense not to use one though.
>
> As for indexing database tables - if one of your tables doesn't have a
> primary key, does it have an aggregate unique "key" of some sort?  Do
> you plan on updating the rows in that table and reindexing them?
> Seems like some kind of unique key would make sense for updating
> documents.
>
> But yeah, a more detailed description of your table structure and
> searching needs would be helpful.
>
> 	Erik
>
>
> On Nov 19, 2008, at 5:18 AM, Aleksander M. Stensby wrote:
>
>> Yes it is. You need a unique id because the add method works as and
>> "add or update" method. When adding a document whose ID is already
>> found in the index, the old document will be deleted and the new
>> will be added. Are you indexing two tables into the same index? Or
>> does one entry in the index consist of data from both tables? How
>> are these linked together without an ID?
>>
>> - Aleksander
>>
>> On Wed, 19 Nov 2008 10:42:00 +0100, Raghunandan Rao
> <Raghunandan.Rao@newscale.com
>>> wrote:
>>
>>> Hi,
>>>
>>> Is the uniqueKey in schema.xml really required?
>>>
>>>
>>> Reason is, I am indexing two tables and I have id as unique key in
>>> schema.xml but id field is not there in one of the tables and
>>> indexing
>>> fails. Do I really require this unique field for Solr to index it
>>> better
>>> or can I do away with this?
>>>
>>>
>>> Thanks,
>>>
>>> Rahgu
>>>
>>
>>
>>
>> -- 
>> Aleksander M. Stensby
>> Senior software developer
>> Integrasco A/S
>> www.integrasco.no


Re: Unique id

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
I'd suggest aggregating those three columns into a string that can  
serve as the Solr uniqueKey field value.

	Erik


On Nov 20, 2008, at 1:10 AM, Raghunandan Rao wrote:

> Basically, I am working on two views. First one has an ID column. The
> second view has no unique ID column. What to do in such situations?
> There are 3 other columns where I can make a composite key out of  
> those.
> I have to index these two views now.
>
>
> -----Original Message-----
> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
> Sent: Wednesday, November 19, 2008 5:24 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Unique id
>
> Technically, no, a uniqueKey field is NOT required.  I've yet to run
> into a situation where it made sense not to use one though.
>
> As for indexing database tables - if one of your tables doesn't have a
> primary key, does it have an aggregate unique "key" of some sort?  Do
> you plan on updating the rows in that table and reindexing them?
> Seems like some kind of unique key would make sense for updating
> documents.
>
> But yeah, a more detailed description of your table structure and
> searching needs would be helpful.
>
> 	Erik
>
>
> On Nov 19, 2008, at 5:18 AM, Aleksander M. Stensby wrote:
>
>> Yes it is. You need a unique id because the add method works as and
>> "add or update" method. When adding a document whose ID is already
>> found in the index, the old document will be deleted and the new
>> will be added. Are you indexing two tables into the same index? Or
>> does one entry in the index consist of data from both tables? How
>> are these linked together without an ID?
>>
>> - Aleksander
>>
>> On Wed, 19 Nov 2008 10:42:00 +0100, Raghunandan Rao
> <Raghunandan.Rao@newscale.com
>>> wrote:
>>
>>> Hi,
>>>
>>> Is the uniqueKey in schema.xml really required?
>>>
>>>
>>> Reason is, I am indexing two tables and I have id as unique key in
>>> schema.xml but id field is not there in one of the tables and
>>> indexing
>>> fails. Do I really require this unique field for Solr to index it
>>> better
>>> or can I do away with this?
>>>
>>>
>>> Thanks,
>>>
>>> Rahgu
>>>
>>
>>
>>
>> -- 
>> Aleksander M. Stensby
>> Senior software developer
>> Integrasco A/S
>> www.integrasco.no


RE: Unique id

Posted by Raghunandan Rao <Ra...@newScale.com>.
Basically, I am working on two views. First one has an ID column. The
second view has no unique ID column. What to do in such situations?
There are 3 other columns where I can make a composite key out of those.
I have to index these two views now. 


-----Original Message-----
From: Erik Hatcher [mailto:erik@ehatchersolutions.com] 
Sent: Wednesday, November 19, 2008 5:24 PM
To: solr-user@lucene.apache.org
Subject: Re: Unique id

Technically, no, a uniqueKey field is NOT required.  I've yet to run  
into a situation where it made sense not to use one though.

As for indexing database tables - if one of your tables doesn't have a  
primary key, does it have an aggregate unique "key" of some sort?  Do  
you plan on updating the rows in that table and reindexing them?   
Seems like some kind of unique key would make sense for updating  
documents.

But yeah, a more detailed description of your table structure and  
searching needs would be helpful.

	Erik


On Nov 19, 2008, at 5:18 AM, Aleksander M. Stensby wrote:

> Yes it is. You need a unique id because the add method works as and  
> "add or update" method. When adding a document whose ID is already  
> found in the index, the old document will be deleted and the new  
> will be added. Are you indexing two tables into the same index? Or  
> does one entry in the index consist of data from both tables? How  
> are these linked together without an ID?
>
> - Aleksander
>
> On Wed, 19 Nov 2008 10:42:00 +0100, Raghunandan Rao
<Raghunandan.Rao@newscale.com 
> > wrote:
>
>> Hi,
>>
>> Is the uniqueKey in schema.xml really required?
>>
>>
>> Reason is, I am indexing two tables and I have id as unique key in
>> schema.xml but id field is not there in one of the tables and  
>> indexing
>> fails. Do I really require this unique field for Solr to index it  
>> better
>> or can I do away with this?
>>
>>
>> Thanks,
>>
>> Rahgu
>>
>
>
>
> -- 
> Aleksander M. Stensby
> Senior software developer
> Integrasco A/S
> www.integrasco.no


Re: Unique id

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Technically, no, a uniqueKey field is NOT required.  I've yet to run  
into a situation where it made sense not to use one though.

As for indexing database tables - if one of your tables doesn't have a  
primary key, does it have an aggregate unique "key" of some sort?  Do  
you plan on updating the rows in that table and reindexing them?   
Seems like some kind of unique key would make sense for updating  
documents.

But yeah, a more detailed description of your table structure and  
searching needs would be helpful.

	Erik


On Nov 19, 2008, at 5:18 AM, Aleksander M. Stensby wrote:

> Yes it is. You need a unique id because the add method works as and  
> "add or update" method. When adding a document whose ID is already  
> found in the index, the old document will be deleted and the new  
> will be added. Are you indexing two tables into the same index? Or  
> does one entry in the index consist of data from both tables? How  
> are these linked together without an ID?
>
> - Aleksander
>
> On Wed, 19 Nov 2008 10:42:00 +0100, Raghunandan Rao <Raghunandan.Rao@newscale.com 
> > wrote:
>
>> Hi,
>>
>> Is the uniqueKey in schema.xml really required?
>>
>>
>> Reason is, I am indexing two tables and I have id as unique key in
>> schema.xml but id field is not there in one of the tables and  
>> indexing
>> fails. Do I really require this unique field for Solr to index it  
>> better
>> or can I do away with this?
>>
>>
>> Thanks,
>>
>> Rahgu
>>
>
>
>
> -- 
> Aleksander M. Stensby
> Senior software developer
> Integrasco A/S
> www.integrasco.no


RE: Unique id

Posted by Raghunandan Rao <Ra...@newScale.com>.
I am not indexing to same index. I have two methods which adds doc by
calling server.addBeans(list) twice. (2 different lists obtained from
DB). 

Now I call server.query("some query1") and obtain result. Then from this
I create query based on first result and call server.query("some
query2"); 

-----Original Message-----
From: Aleksander M. Stensby [mailto:aleksander.stensby@integrasco.no] 
Sent: Wednesday, November 19, 2008 4:22 PM
To: solr-user@lucene.apache.org
Subject: Re: Unique id

Ok, but how do you map your table structure to the index? As far as I
can  
understand, the two tables have different structre, so why/how do you
map  
two different datastructures onto a single index? Are the two tables  
connected in some way? If so, you could make your index structure
reflect  
the union of both tables and just make one insertion into the index per

entry of the two tables.

Maybe you could post the table structure so that I can get a better  
understanding of your use-case...

- Aleks

On Wed, 19 Nov 2008 11:25:56 +0100, Raghunandan Rao  
<Ra...@newscale.com> wrote:

> Ok got it.
> I am indexing two tables differently. I am using Solrj to index with
> @Field annotation. I make two queries initially and fetch the data
from
> two tables and index them separately. But what if the ids in two
tables
> are same? That means documents with same id will be deleted when doing
> update.
>
> How does this work? Please explain.
>
> Thanks.
>
> -----Original Message-----
> From: Aleksander M. Stensby [mailto:aleksander.stensby@integrasco.no]
> Sent: Wednesday, November 19, 2008 3:49 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Unique id
>
> Yes it is. You need a unique id because the add method works as and
"add
>
> or update" method. When adding a document whose ID is already found in
> the
> index, the old document will be deleted and the new will be added. Are
> you
> indexing two tables into the same index? Or does one entry in the
index
>
> consist of data from both tables? How are these linked together
without
> an
> ID?
>
> - Aleksander
>
> On Wed, 19 Nov 2008 10:42:00 +0100, Raghunandan Rao
> <Ra...@newscale.com> wrote:
>
>> Hi,
>>
>> Is the uniqueKey in schema.xml really required?
>>
>>
>> Reason is, I am indexing two tables and I have id as unique key in
>> schema.xml but id field is not there in one of the tables and
indexing
>> fails. Do I really require this unique field for Solr to index it
> better
>> or can I do away with this?
>>
>>
>> Thanks,
>>
>> Rahgu
>>
>
>

Re: Unique id

Posted by "Aleksander M. Stensby" <al...@integrasco.no>.
Ok, but how do you map your table structure to the index? As far as I can  
understand, the two tables have different structre, so why/how do you map  
two different datastructures onto a single index? Are the two tables  
connected in some way? If so, you could make your index structure reflect  
the union of both tables and just make one insertion into the index per  
entry of the two tables.

Maybe you could post the table structure so that I can get a better  
understanding of your use-case...

- Aleks

On Wed, 19 Nov 2008 11:25:56 +0100, Raghunandan Rao  
<Ra...@newscale.com> wrote:

> Ok got it.
> I am indexing two tables differently. I am using Solrj to index with
> @Field annotation. I make two queries initially and fetch the data from
> two tables and index them separately. But what if the ids in two tables
> are same? That means documents with same id will be deleted when doing
> update.
>
> How does this work? Please explain.
>
> Thanks.
>
> -----Original Message-----
> From: Aleksander M. Stensby [mailto:aleksander.stensby@integrasco.no]
> Sent: Wednesday, November 19, 2008 3:49 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Unique id
>
> Yes it is. You need a unique id because the add method works as and "add
>
> or update" method. When adding a document whose ID is already found in
> the
> index, the old document will be deleted and the new will be added. Are
> you
> indexing two tables into the same index? Or does one entry in the index
>
> consist of data from both tables? How are these linked together without
> an
> ID?
>
> - Aleksander
>
> On Wed, 19 Nov 2008 10:42:00 +0100, Raghunandan Rao
> <Ra...@newscale.com> wrote:
>
>> Hi,
>>
>> Is the uniqueKey in schema.xml really required?
>>
>>
>> Reason is, I am indexing two tables and I have id as unique key in
>> schema.xml but id field is not there in one of the tables and indexing
>> fails. Do I really require this unique field for Solr to index it
> better
>> or can I do away with this?
>>
>>
>> Thanks,
>>
>> Rahgu
>>
>
>

RE: Unique id

Posted by Raghunandan Rao <Ra...@newScale.com>.
Ok got it. 
I am indexing two tables differently. I am using Solrj to index with
@Field annotation. I make two queries initially and fetch the data from
two tables and index them separately. But what if the ids in two tables
are same? That means documents with same id will be deleted when doing
update. 

How does this work? Please explain. 

Thanks. 

-----Original Message-----
From: Aleksander M. Stensby [mailto:aleksander.stensby@integrasco.no] 
Sent: Wednesday, November 19, 2008 3:49 PM
To: solr-user@lucene.apache.org
Subject: Re: Unique id

Yes it is. You need a unique id because the add method works as and "add

or update" method. When adding a document whose ID is already found in
the  
index, the old document will be deleted and the new will be added. Are
you  
indexing two tables into the same index? Or does one entry in the index

consist of data from both tables? How are these linked together without
an  
ID?

- Aleksander

On Wed, 19 Nov 2008 10:42:00 +0100, Raghunandan Rao  
<Ra...@newscale.com> wrote:

> Hi,
>
> Is the uniqueKey in schema.xml really required?
>
>
> Reason is, I am indexing two tables and I have id as unique key in
> schema.xml but id field is not there in one of the tables and indexing
> fails. Do I really require this unique field for Solr to index it
better
> or can I do away with this?
>
>
> Thanks,
>
> Rahgu
>



-- 
Aleksander M. Stensby
Senior software developer
Integrasco A/S
www.integrasco.no