Try adding the "pk" attribute to the parent entity in any of these 4 ways:

<entity name="freemedia" pk="id" query="select * from freemedia WHERE categor...
<entity name="freemedia" pk="ID" query="select * from freemedia WHERE categor...
<entity name="freemedia" pk="freemedia.id" query="select * from freemedia WHERE 
categor...
<entity name="freemedia" pk="freemedia.ID" query="select * from freemedia WHERE 
categor...

...not entirely sure, but I think one of these (maybe all of them) would fix 
your problem.

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311


-----Original Message-----
From: PeterKerk [mailto:vettepa...@hotmail.com] 
Sent: Friday, January 11, 2013 1:18 PM
To: solr-user@lucene.apache.org
Subject: RE: how to perform a delta-import when related table is updated

Hi James,

Ok, so I did this:
        <entity name="freemedia" query="select * from freemedia WHERE 
categoryid>0"
        deltaImportQuery="select * from freemedia WHERE updatedate &lt; 
getdate()
AND id='${dataimporter.delta.id}' AND categoryid>0"
        deltaQuery="select id from freemedia where id in
                                                        (select freemediaid as 
id from freemedialikes where createdate >
'${dih.last_index_time}') or updatedate &gt;
'${dataimporter.last_index_time}' AND categoryid>0">            

I now get this error in the logfile:                                            
                

SEVERE: Delta Import Failed
java.lang.IllegalArgumentException: deltaQuery has no column to resolve to
declared primary key pk='ID'                                                    
                                                                        

                                                                
Now, my table looks like this:                                                  
        

CREATE TABLE [dbo].[freemedialikes](
        [id] [int] IDENTITY(1,1) NOT NULL,
        [userid] [nvarchar](50) NOT NULL,
        [freemediaid] [int] NOT NULL,
        [createdate] [datetime] NOT NULL,
 CONSTRAINT [PK_freemedialikes] PRIMARY KEY CLUSTERED 
(
        [id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
                                                                
ALTER TABLE [dbo].[freemedialikes]  WITH CHECK ADD  CONSTRAINT
[FK_freemedialikes_freemedia] FOREIGN KEY([freemediaid])
REFERENCES [dbo].[freemedia] ([id])
ON DELETE CASCADE
GO

ALTER TABLE [dbo].[freemedialikes] CHECK CONSTRAINT
[FK_freemedialikes_freemedia]
GO

ALTER TABLE [dbo].[freemedialikes] ADD  CONSTRAINT
[DF_freemedialikes_createdate]  DEFAULT (getdate()) FOR [createdate]
GO
                                                                

So in the deltaquery I thought I had to reference the freemediaid, like so:
"select freemediaid as id from freemedialikes"

Got the same error as above.
So then I thought since there was mention of a PK in the error I just
reference the PK of the childtable, didn't make sense, but hey :)
"select id from freemedialikes w"

But I got the same error again.


Any suggestions?
Thanks!                                                         



--
View this message in context: 
http://lucene.472066.n3.nabble.com/how-to-perform-a-delta-import-when-related-table-is-updated-tp4032587p4032608.html
Sent from the Solr - User mailing list archive at Nabble.com.


Reply via email to