lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ian Smith" <Ian.Sm...@gossinteractive.com>
Subject RE: How do I set up an embedded server with version 1.3.0 ?
Date Thu, 25 Jun 2009 11:11:11 GMT
From: Shalin Shekhar Mangar [mailto:shalinmangar@gmail.com] 
Sent: 25 June 2009 10:41
To: solr-user@lucene.apache.org
Subject: Re: How do I set up an embedded server with version 1.3.0 ?

On Thu, Jun 25, 2009 at 2:05 PM, Ian Smith
<Ian.Smith@gossinteractive.com>wrote:

>
> Can you or someone else possibly help me with a working SolrCore 
> constructor call?
>
>
Here is a working example for single index/core:

        System.setProperty("solr.solr.home",
"/home/shalinsmangar/work/oss/branch-1.3/example/solr");
        CoreContainer.Initializer initializer = new
CoreContainer.Initializer();
        CoreContainer coreContainer = initializer.initialize();
        EmbeddedSolrServer server = new
EmbeddedSolrServer(coreContainer, "");
        SolrInputDocument doc = new SolrInputDocument();
        doc.addField("id", "101");
        server.add(doc);
        server.commit(true, true);
        SolrQuery query = new SolrQuery();
        query.setQuery("id:101");
        QueryResponse response = server.query(query);
        SolrDocumentList list = response.getResults();
        System.out.println("list.size() = " + list.size());
        coreContainer.shutdown();

Make sure your dataDir in solrconfig.xml is fixed (absolute) otherwise
your data directory will get created relative to the current working
directory (or you could set a system property for solr.data.dir)

Hope that helps. I'll add it to the wiki too.
--
Regards,
Shalin Shekhar Mangar.
-----------------------------------------------

Fantastic, I now have the embedded server working, thank you!

PS. Sorry about all the huge sigs, I don't have the facility to suppress
them from work, I'll post from a webmail account in future . . .

Ian.

Website Content Management

Tamar Science Park, 15 Research Way, Plymouth, PL6 8BT

Save a tree, think before printing this email.

This email contains proprietary information, some or all of which may be legally privileged.
It is for the intended recipient only. If an addressing or transmission error has misdirected
this email, please notify the author by replying to this email. If you are not the intended
recipient you may not use, disclose, distribute, copy, print or rely on this email. 
 

Email transmission cannot be guaranteed to be secure or error free, as information may be
intercepted, corrupted, lost, destroyed, arrive late or incomplete or contain viruses. This
email and any files attached to it have been checked with virus detection software before
transmission. You should nonetheless carry out your own virus check before opening any attachment.
GOSS Interactive Ltd accepts no liability for any loss or damage that may be caused by software
viruses.
 
Registered Office: c/o Bishop Fleming, Cobourg House, Mayflower Street, Plymouth, PL1 1LG.
 Company Registration No: 3553908  
 
 



Mime
View raw message