Hi,

I'm using Apache Solr to index RSS Feeds.
I'm with success getting data (url and if feed is active to index) from a 
database, and using that has a source of an entity to index the rss data.

I'm trying to reach a result but i don't get it. I will try to explain that 
with an example.

The RSS feed has something like: 
<enclosure url="http://www.engadget.com/podcasts/Engadget_Podcast_353.mp3"; 
length="32642192" type="audio/mpeg"/>

In my Schema.xml:
    <dynamicField name="enclosure_*" type="string" indexed="false" 
stored="false" multiValued="true" />

    <field name="enclosure" type="text" indexed="true" stored="true" 
multiValued="true" />

    <copyField source="enclosure_*" dest="enclosure" />

In my data-config.xml:

<dataSource name="sql-ds" 
        type="JdbcDataSource" 
        driver="com.mysql.jdbc.Driver" 
        url="jdbc:mysql://localhost/<db>" 
        user="<user>" 
        password="<pass>"
        readOnly="true"/>
    
    <dataSource name="url-ds" type="URLDataSource" />

    <document>

        <entity name="src"
            rootEntity="false"
            dataSource="sql-ds"
            query="SELECT Feeds.IDFeed, Feeds.FeedUrl FROM meshapp.Feeds where 
Feeds.Active = 1">

            <!-- Field created by MeshApp Reader to identify the source -->
            <field column="IDFeed" name="source-id" />

                <entity name="xml"
                        rootEntity="true" 
                        dataSource="url-ds"
                        url='${src.FeedUrl}'
                        onError="skip"
                        processor="XPathEntityProcessor"
                        forEach="/rss/channel/item | /rss/channel"
                        transformer="DateFormatTransformer">
                                        
                    <!-- Lot of fields -->

                    <field column="enclosure_url" 
xpath="/rss/channel/item/enclosure/@url" />
                    <field column="enclosure_length" 
xpath="/rss/channel/item/enclosure/@length" />
                    <field column="enclosure_type" 
xpath="/rss/channel/item/enclosure/@type" />

                </entity>
        </entity>
    </document>

 This is working and i get the a result like that:

enclosure: [
"audio/mpeg",
"http://www.engadget.com/podcasts/EngadgetHD_Podcast_359.mp3";,
"37521428"
],


BUT, this is not the result that i'm trying to reach. I want to reach something 
like:

enclosure: {
type: "audio/mpeg",
url: "http://www.engadget.com/podcasts/EngadgetHD_Podcast_359.mp3";,
length: "37521428"
},


So, how i intend this, this should be 3 fields inside of another field, no?

I have try something like (doesn't work):

In my schema.xml (I think that this doesn't make sense):
    <field name="enclosure" type="html" indexed="false" stored="true" 
multiValued="true">
        <dynamicField name="enclosure_*" type="string" indexed="false" 
stored="true" multiValued="true" />
    </field>


In my data-config.xml:
    <field name="enclosure" column="enclosure" > -->
        <field column="enclosure_url" xpath="/rss/channel/item/enclosure/@url" 
/>
        <field column="enclosure_length" 
xpath="/rss/channel/item/enclosure/@length" />
        <field column="enclosure_type" 
xpath="/rss/channel/item/enclosure/@type" />
    </field>


Can you please help me?

Many Thanks,
Luís Portela Afonso






Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to