Hi Ahmet,

This is a great idea but still does not appear to be working correctly. The
idea is that I want to be able to add an RSS feed and then index that feed
on a schedule. My C# method looks something like this.

        public ActionResult Index()
        {
            try {
                HTTPGet req = new HTTPGet();
                string solrStr =
System.Configuration.ConfigurationManager.AppSettings["solrUrl"].ToString();
                req.Request(solrStr +
"/select?clean=true&commit=true&qt=/dataimport&command=reload-config");
                req.Request(solrStr +
"/select?clean=false&commit=true&qt=/dataimport&command=full-import");
                Response.Write(req.StatusLine);
                Response.Write(req.ResponseTime);
                Response.Write(req.StatusCode);
                return RedirectToAction("../Import/Feeds");
                //return View();
            } catch (SolrConnectionException) {
                throw new Exception(string.Format("Couldn't Import RSS
Feeds"));
            }
        }

My XML configuration file looks somethiing like this...

<dataConfig>
<dataSource type="HttpDataSource" />
  <document>
    <entity name="filedatasource"
            processor="FileListEntityProcessor"
            baseDir="./solr/conf/dataimporthandler"
            fileName="^.*xml$"
            recursive="true"
            rootEntity="false"
            dataSource="null">

      <entity name="cnn"
              pk="link"
              datasource="filedatasource"
              url="http://rss.cnn.com/rss/cnn_topstories.rss";
              processor="XPathEntityProcessor"
              forEach="/rss/channel | /rss/channel/item"
              transformer="DateFormatTransformer,HTMLStripTransformer">

        <field column="source"       xpath="/rss/channel/title"
commonField="true" />
        <field column="source-link"  xpath="/rss/channel/link"
 commonField="true" />
        <field column="subject"      xpath="/rss/channel/description"
commonField="true" />
        <field column="title"        xpath="/rss/channel/item/title" />
        <field column="link"         xpath="/rss/channel/item/link" />
        <field column="description"  xpath="/rss/channel/item/description"
stripHTML="true" />
        <field column="creator"      xpath="/rss/channel/item/creator" />
        <field column="item-subject" xpath="/rss/channel/item/subject" />
        <field column="author"       xpath="/rss/channel/item/author" />
        <field column="comments"     xpath="/rss/channel/item/comments" />
        <field column="pubdate"      xpath="/rss/channel/item/pubDate"
dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss'Z'" />
      </entity>

      <entity name="newsweek"
        pk="link"
        datasource="filedatasource"
        url="http://feeds.newsweek.com/newsweek/nation";
        processor="XPathEntityProcessor"
        forEach="/rss/channel | /rss/channel/item"
        transformer="DateFormatTransformer,HTMLStripTransformer">

        <field column="source"       xpath="/rss/channel/title"
commonField="true" />
        <field column="source-link"  xpath="/rss/channel/link"
 commonField="true" />
        <field column="subject"      xpath="/rss/channel/description"
commonField="true" />
        <field column="title"        xpath="/rss/channel/item/title" />
        <field column="link"         xpath="/rss/channel/item/link" />
        <field column="description"  xpath="/rss/channel/item/description"
stripHTML="true" />
        <field column="creator"      xpath="/rss/channel/item/creator" />
        <field column="item-subject" xpath="/rss/channel/item/subject" />
        <field column="author"       xpath="/rss/channel/item/author" />
        <field column="comments"     xpath="/rss/channel/item/comments" />
        <field column="pubdate"      xpath="/rss/channel/item/pubDate"
dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss'Z'"/>
      </entity>
       </entity>
  </document>
</dataConfig>

As you can see, I can add sub-entities from what appears to be as many times
as I want. The idea was to reload the xml file after each entity is added.
What else am I missing here because the reload-config command does not seem
to be working. Any ideas would be great!

Thanks,
Adam Estrada

On Sat, Dec 11, 2010 at 4:48 PM, Ahmet Arslan <iori...@yahoo.com> wrote:

> > I found that you can have a single config file that can
> > have several
> > entities in it. My question now is how can I add entities
> > without restarting
> > the Solr service?
>
> You mean changing and re-loading xml config file?
>
> dataimport?command=reload-config
> http://wiki.apache.org/solr/DataImportHandler#Commands
>
>
>
>

Reply via email to