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 19:11:50 UTC

Delta import possible when no timestamp of specific field is set

I want to show the new avatar of an ad as soon as the thumbid value of that
ad is updated.

This is what I had before delta query which works all fine:

    <document name="ads">
        <entity pk="id" 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}'">	
            <field name="id" column="ID" />
            <field name="userid" column="userid" />
            <field name="thumbid" column="thumbid" />

			&lt;entity name=&quot;ad_thumb&quot; query=&quot;SELECT locpath =
ISNULL((select locpath FROM ad_photos where id='${ad.thumbid}'),'')&quot;
				&lt;field name=&quot;thumb&quot; column=&quot;locpath&quot;  /&gt;
			</entity>
        </entity>
		
    </document>

	
	in my schema.xml I have this field:
	<field name="thumb" type="text" indexed="true" stored="true"/>
	

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 	



Now Im trying to add delta query functionality to the ad_thumb entity...
Now my guess is that the problem is that nowhere is saved WHEN the thumbid
was changed, the only place where the new thumb is updated is when the value
of column [ad].[thumbid] has changed, but without a timestamp.

I tried this:
		<entity name="ad_thumb" query="SELECT locpath = ISNULL((select locpath
FROM ad_photos where id='${ad.thumbid}'),'')"
		deltaImportQuery="SELECT locpath = ISNULL((select locpath FROM ad_photos
where id='${dataimporter.delta.id}'),'')"
		deltaQuery="SELECT locpath = ISNULL((select locpath FROM ad_photos where
createdate &gt; '${dataimporter.last_index_time}'">					
			<field name="thumb" column="locpath"  />
		</entity>

But as you can see it doenst really make sense...:$ I have no idea how to
approach this and if its possible without having the timestamp of thumb
changed date.

--
View this message in context: http://lucene.472066.n3.nabble.com/Delta-import-possible-when-no-timestamp-of-specific-field-is-set-tp3163190p3163190.html
Sent from the Solr - User mailing list archive at Nabble.com.