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 penela <pe...@gmail.com> on 2011/09/05 14:02:00 UTC

Accessing a doc field while working at entity level

Hi!

This might probably be a stupid question, but I can't find clear info on how
to do it (sorry if it is too obvious).

I have a the following document configuration (only key elements shown) with
two entities, one embedded into the other:
<dataConfig>
    <dataSource type="URLDataSource" name="rss-ds" />
    <dataSource type="JdbcDataSource" name="db-ds" driver="com........" /> 
    <document>
		<entity name="feed-source"
				dataSource="db-ds"
                                ...
				rootEntity="false">
			<field column="last-update" dateTimeFormat="yyyy-MM-dd HH:mm:ss"
locale="en"  />
			
			<entity name="feed-content" dataSource="rss-ds"
					pk="link"	                
	                ...
	                transformer="DateFormatTransformer, DummyTransformer">

	            <field column="timestamp" xpath="/rss/channel/item/pubDate"
dateTimeFormat="EEE, dd MMM yyyy HH:mm:ss z" locale="en"  />     
	        </entity>
        </entity>
    </document>
</dataConfig>

What I want to do is accessing the outer entity field "last-update" while
I'm in the inner entity Transformer DummyTransformer. Debugging with Eclipse
it looks like that data is correctly stored during runtime on the Context
variable passed as parameter to the Transformer in: context.doc.fields

So the question is: Is there any way to access higher level entities' fields
while in an embedded entity? Or document fields at least?

Thanks!
-Víctor

--
View this message in context: http://lucene.472066.n3.nabble.com/Accessing-a-doc-field-while-working-at-entity-level-tp3310680p3310680.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Accessing a doc field while working at entity level

Posted by Jayendra Patil <ja...@gmail.com>.
you should be able to do it using ${feed-source.last-update}

You can find examples and explaination @
http://wiki.apache.org/solr/DataImportHandler

Regards,
Jayendra

On Mon, Sep 5, 2011 at 8:02 AM, penela <pe...@gmail.com> wrote:
> Hi!
>
> This might probably be a stupid question, but I can't find clear info on how
> to do it (sorry if it is too obvious).
>
> I have a the following document configuration (only key elements shown) with
> two entities, one embedded into the other:
> <dataConfig>
>    <dataSource type="URLDataSource" name="rss-ds" />
>    <dataSource type="JdbcDataSource" name="db-ds" driver="com........" />
>    <document>
>                <entity name="feed-source"
>                                dataSource="db-ds"
>                                ...
>                                rootEntity="false">
>                        <field column="last-update" dateTimeFormat="yyyy-MM-dd HH:mm:ss"
> locale="en"  />
>
>                        <entity name="feed-content" dataSource="rss-ds"
>                                        pk="link"
>                        ...
>                        transformer="DateFormatTransformer, DummyTransformer">
>
>                    <field column="timestamp" xpath="/rss/channel/item/pubDate"
> dateTimeFormat="EEE, dd MMM yyyy HH:mm:ss z" locale="en"  />
>                </entity>
>        </entity>
>    </document>
> </dataConfig>
>
> What I want to do is accessing the outer entity field "last-update" while
> I'm in the inner entity Transformer DummyTransformer. Debugging with Eclipse
> it looks like that data is correctly stored during runtime on the Context
> variable passed as parameter to the Transformer in: context.doc.fields
>
> So the question is: Is there any way to access higher level entities' fields
> while in an embedded entity? Or document fields at least?
>
> Thanks!
> -Víctor
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Accessing-a-doc-field-while-working-at-entity-level-tp3310680p3310680.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>