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 abhayd <aj...@hotmail.com> on 2011/07/21 21:12:39 UTC

dih fetching but not adding records to index

hi 
I m trying to load data into solr index from a xml file using dih

my promotions.xml file
------------------
<add>
	<doc>
		<field name="id">3</field>
	</doc>
	<doc>
		<field name="id">4</field>
	</doc>	
</add>
---------------------
schema.xml has
   <field name="id" type="string" indexed="true" stored="true"
omitNorms="true"/>

and dih config file is as follows
-----------------------------
<dataConfig>
    <dataSource type="FileDataSource" />
    <document>
        <entity name="f" processor="FileListEntityProcessor"
baseDir="c:\temp" fileName="promotions.xml" 
                recursive="false" rootEntity="false" dataSource="null">
            <entity name="x" processor="XPathEntityProcessor"
forEach="/add/doc" url="${f.fileAbsolutePath}" pk="id">
                <field column="id" xpath="/add/doc/id"/>
            </entity>
        </entity>
    </document>
</dataConfig>

After full index load i get message

Indexing completed. Added/Updated: 0 documents. Deleted 0 documents.
Requests: 0, Fetched: 1, Skipped: 0, Processed: 0

And nothing is added to solr iindex. Any idea whats happening? I dont see
any error messages either


--
View this message in context: http://lucene.472066.n3.nabble.com/dih-fetching-but-not-adding-records-to-index-tp3189438p3189438.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: dih fetching but not adding records to index

Posted by abhayd <aj...@hotmail.com>.
thanks!! it worked.

I was just wondering if xpath can be used to use process default xml format
for solr index doc



--
View this message in context: http://lucene.472066.n3.nabble.com/dih-fetching-but-not-adding-records-to-index-tp3189438p3198705.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: dih fetching but not adding records to index

Posted by abhayd <aj...@hotmail.com>.
quick question

if i want to just load document with id=2 how would that work?

I tried xpath expression that works with xpath tools but not in solr. How
would i do this?

<dataConfig>
    <dataSource type="FileDataSource" />
    <document>
        <entity name="f" processor="FileListEntityProcessor"
baseDir="c:\temp" fileName="promotions.xml"
                recursive="false" rootEntity="false" dataSource="null">
            <entity name="x" processor="XPathEntityProcessor"
forEach="/add/doc" url="${f.fileAbsolutePath}" pk="id">
                <field column="id" xpath="/add/doc/[id=2]/id"/>
            </entity>
        </entity>
    </document>
</dataConfig>

--
View this message in context: http://lucene.472066.n3.nabble.com/dih-fetching-but-not-adding-records-to-index-tp3189438p3211083.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: dih fetching but not adding records to index

Posted by Gora Mohanty <go...@mimirtech.com>.
On Mon, Jul 25, 2011 at 9:36 PM, abhayd <aj...@hotmail.com> wrote:
> hi
>
> thanks for the response
>
> I am aware of post.sh but i wanted to make use of dih and scheduling. We can
> not use cron due to some other issues.
>
> So was thinking of using scheduling Data import
[...]

OK, though in that case the <add></add> are superfluous
in the XML file. Also, DIH uses the tag itself in the XML
file rather than the "name" attribute. Thus, your XML should
look like:
------------------
<add>
       <doc>
               <id>3</id>
       </doc>
       <doc>
               <id>4</id>
       </doc>
</add>
---------------------

Regards,
Gora

Re: dih fetching but not adding records to index

Posted by abhayd <aj...@hotmail.com>.
hi

thanks for the response

I am aware of post.sh but i wanted to make use of dih and scheduling. We can
not use cron due to some other issues.

So was thinking of using scheduling Data import 

--
View this message in context: http://lucene.472066.n3.nabble.com/dih-fetching-but-not-adding-records-to-index-tp3189438p3197874.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: dih fetching but not adding records to index

Posted by Gora Mohanty <go...@mimirtech.com>.
On Fri, Jul 22, 2011 at 12:42 AM, abhayd <aj...@hotmail.com> wrote:
> hi
> I m trying to load data into solr index from a xml file using dih
>
> my promotions.xml file
> ------------------
> <add>
>        <doc>
>                <field name="id">3</field>
>        </doc>
>        <doc>
>                <field name="id">4</field>
>        </doc>
> </add>
[...]

This is already a complete SolrXML file, and you do not
need DIH. Instead, use post.sh in example/exampledocs
in your Solr distribution. With Solr running in the embedded
Jetty server, the command would be:
  ./post.sh promotions.xml
If you are running Solr in some other fashion, please modify
post.sh as needed.

Regards,
Gora