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 PeterKerk <ve...@hotmail.com> on 2011/07/12 16:27:01 UTC

Delta import issue

I'm having an issue with a delta import.

I have the following in my data-config.xml:

    <document name="ads">
        <entity name="ad" 
		query="select * from ads WHERE approvedate &gt; '1/1/1900' and publishdate
&lt; getdate() AND depublishdate &gt; getdate() and deletedate = '1/1/1900'"
		deltaImportQuery="select * from ads WHERE approvedate &gt; '1/1/1900' and
publishdate &lt; getdate() AND depublishdate &gt; getdate() and deletedate =
'1/1/1900' and id='${dataimporter.delta.id}'"
		deltaQuery="select id from ads where updatedate &gt;
'${dataimporter.last_index_time}'">	

			<entity name="photo" query="select locpath as locpath FROM ad_photos
where adid=${ad.id}"
			deltaImportQuery="select locpath as locpath FROM ad_photos where
adid='${dataimporter.delta.id}'"
			deltaQuery="select locpath as locpath FROM ad_photos where createdate
&gt; '${dataimporter.last_index_time}'">			
				<field name="photos" column="locpath"  />
			</entity>

        </entity>
    </document>

Now, when I add a new photo to the ad_photos table, its not index when I
perform a delta import like so:
http://localhost:8983/solr/i2m/dataimport?command=delta-import.
When I do a FULL import I do see the new images.


Here's the definition of ad_photos table:

CREATE TABLE [dbo].[ad_photos](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[adid] [int] NOT NULL,
	[locpath] [nvarchar](150) NOT NULL,
	[title] [nvarchar](50) NULL,
	[createdate] [datetime] NOT NULL,
 CONSTRAINT [PK_ad_photos] 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



What am I doing wrong?

--
View this message in context: http://lucene.472066.n3.nabble.com/Delta-import-issue-tp3162581p3162581.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Delta import issue

Posted by PeterKerk <ve...@hotmail.com>.
That did the trick! Thanks!

--
View this message in context: http://lucene.472066.n3.nabble.com/Delta-import-issue-tp3162581p3163009.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Delta import issue

Posted by Rahul Warawdekar <ra...@gmail.com>.
<entity *pk="id"* name="ad"  .........................>

On Tue, Jul 12, 2011 at 11:34 AM, PeterKerk <ve...@hotmail.com> wrote:

> Hi Rahul,
>
> Not sure how I would do this "Try adding the primary key attribute to the
> root entity 'ad'"?
>
> In my entity ad I already have these fields (I left those out earlier for
> readability):
> <field name="id" column="ID" />   <-- this is primary key of ads table
> <field name="userid" column="userid" />
> <field name="title" column="title" />
>
> Is that what you mean?
>
> And I'm using MSSQL2008
>
>
> Thanks!
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Delta-import-issue-tp3162581p3162809.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
Thanks and Regards
Rahul A. Warawdekar

Re: Delta import issue

Posted by PeterKerk <ve...@hotmail.com>.
Hi Rahul,

Not sure how I would do this "Try adding the primary key attribute to the
root entity 'ad'"?

In my entity ad I already have these fields (I left those out earlier for
readability):
<field name="id" column="ID" />   <-- this is primary key of ads table
<field name="userid" column="userid" />
<field name="title" column="title" />

Is that what you mean?

And I'm using MSSQL2008


Thanks!

--
View this message in context: http://lucene.472066.n3.nabble.com/Delta-import-issue-tp3162581p3162809.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Delta import issue

Posted by Rahul Warawdekar <ra...@gmail.com>.
Hi Peter,

Try adding the primary key attribute to the root entity 'ad' and check if
delta import works.
By the way, which database are you using ?

On Tue, Jul 12, 2011 at 10:27 AM, PeterKerk <ve...@hotmail.com> wrote:

>
> I'm having an issue with a delta import.
>
> I have the following in my data-config.xml:
>
>    <document name="ads">
>        <entity name="ad"
>                query="select * from ads WHERE approvedate > '1/1/1900' and
> publishdate
> < getdate() AND depublishdate > getdate() and deletedate = '1/1/1900'"
>                deltaImportQuery="select * from ads WHERE approvedate >
> '1/1/1900' and
> publishdate < getdate() AND depublishdate > getdate() and deletedate =
> '1/1/1900' and id='${dataimporter.delta.id}'"
>                deltaQuery="select id from ads where updatedate >
> '${dataimporter.last_index_time}'">
>
>                        <entity name="photo" query="select locpath as
> locpath FROM ad_photos
> where adid=${ad.id}"
>                        deltaImportQuery="select locpath as locpath FROM
> ad_photos where
> adid='${dataimporter.delta.id}'"
>                        deltaQuery="select locpath as locpath FROM ad_photos
> where createdate
> > '${dataimporter.last_index_time}'">
>                                <field name="photos" column="locpath"  />
>                        </entity>
>
>        </entity>
>    </document>
>
> Now, when I add a new photo to the ad_photos table, its not index when I
> perform a delta import like so:
> http://localhost:8983/solr/i2m/dataimport?command=delta-import.
> When I do a FULL import I do see the new images.
>
>
> Here's the definition of ad_photos table:
>
> CREATE TABLE [dbo].[ad_photos](
>        [id] [int] IDENTITY(1,1) NOT NULL,
>        [adid] [int] NOT NULL,
>        [locpath] [nvarchar](150) NOT NULL,
>        [title] [nvarchar](50) NULL,
>        [createdate] [datetime] NOT NULL,
>  CONSTRAINT [PK_ad_photos] 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
>
>
>
> What am I doing wrong?
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Delta-import-issue-tp3162581p3162581.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
Thanks and Regards
Rahul A. Warawdekar