Hi,
 
No luck, I tried as follows, my solr home is there out of of my solrj
client. I think it is looking for the config at CWD,
 
config = new SolrConfig();
           String dir= config.getResourceLoader().getDataDir(); ( I used
getInstanceDir() also )
            //File f = new File( home, "solr.xml" );
        System.out.println("solr home : "+dir);
 
But got an exception 
 
Apr 1, 2009 8:20:41 PM org.apache.solr.core.SolrResourceLoader
locateInstanceDir
INFO: JNDI not configured for solr (NoInitialContextEx)
Apr 1, 2009 8:20:41 PM org.apache.solr.core.SolrResourceLoader
locateInstanceDir
INFO: solr home defaulted to 'solr/' (could not find system property or
JNDI)
Apr 1, 2009 8:20:41 PM org.apache.solr.core.SolrResourceLoader <init>
INFO: Solr home set to 'solr/'
Apr 1, 2009 8:20:41 PM org.apache.solr.core.SolrResourceLoader
createClassLoader
INFO: Reusing parent classloader
Exception in thread "main" java.lang.RuntimeException: Can't find resource
'solrconfig.xml' in classpath or 'solr/conf/', cwd=D:\Lucene\solrjclient
        at
org.apache.solr.core.SolrResourceLoader.openResource(SolrResourceLoader.java
:197)
        at
org.apache.solr.core.SolrResourceLoader.openConfig(SolrResourceLoader.java:1
65)
        at org.apache.solr.core.Config.<init>(Config.java:101)
        at org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:111)
        at org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:68)
        at SolrDeleteTest.main(SolrDeleteTest.java:30)
Java Result: 1
 
 
Anybody have any idea ??


  _____  

From: Giovanni De Stefano [mailto:giovanni.destef...@gmail.com] 
Sent: Wednesday, April 01, 2009 8:19 PM
To: solr-user@lucene.apache.org; cra...@ceiindia.com
Subject: Re: Indexing fields of xml file using solrj


Hello,
 
you can try with:
 
SolrConfig.config.getResourceLoader().getInstanceDir()
 
Let me know if it works.
 
Cheers,
Giovanni

 
On 4/1/09, Radha C. <cra...@ceiindia.com> wrote: 

Hey No,

Actually I did not look at your response email. But I saw your email after I
responded to shalin and you gave me a correct answer. Thanks a lot.
So I started coding it also, I thought to reply to u once I executed
successfully. Here is my code,
DirectXmlRequest xmlreq = new DirectXmlRequest( "/update", xml.toString() );

server.request( xmlreq );

server.commit();
But I am having trouble in identifying the xml location,
I am having the input xml in $solrhome/inputdata/example.xml, Do you have
any idea about how to get solrhome
location dynamically by using any solrj API class?


_____

From: Giovanni De Stefano [mailto:giovanni.destef...@gmail.com]
Sent: Wednesday, April 01, 2009 7:30 PM
To: solr-user@lucene.apache.org; cra...@ceiindia.com
Subject: Re: Indexing fields of xml file using solrj


I understand Shalin is a guru and I am nobody but...

http://lucene.apache.org/solr/api/org/apache/solr/client/solrj/request/Direc
tXmlRequest.html

Is what you need if you want to use Solrj...

:-)


On 4/1/09, Radha C. <cra...@ceiindia.com> wrote:

Thanks shalin,

I need to index the xml which is in solr's format only. I want to index that
xnl directly using solrj same like how we post using curl. Is there any API
class is available for that?

Can you please provide me any reference link?

-----Original Message-----
From: Shalin Shekhar Mangar [mailto:shalinman...@gmail.com]
Sent: Wednesday, April 01, 2009 6:07 PM
To: solr-user@lucene.apache.org; cra...@ceiindia.com
Subject: Re: Indexing fields of xml file using solrj

On Wed, Apr 1, 2009 at 5:17 PM, Radha C. <cra...@ceiindia.com> wrote:
> Hi All,
>
> I want to index the document fields in a xml file to index using
> solrj. I know how to index the document fields using doc.addfield().
> But I dont know how to post the xml document instead of adding each field
in solrj.
>
> Can I index xml file using solrj? Can anyone help me in how to do this?
>

Solr will only accept xml files which are in the solr's update xml format.
You cannot post any arbitrary xml (you can convert using the xslt). You can
also parse it yourself and use solrj for adding the document. There's
DataImportHandler too which can parse XML using xpath.

--
Regards,
Shalin Shekhar Mangar.







Reply via email to