lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From poeta simbolista <>
Subject SolrJ - open existing index in EmbeddedSolrServer - query mode
Date Fri, 09 Oct 2009 10:11:34 GMT

I'm trying to open an existing local index with the following code:

 * get the SolrServer
public static SolrServer startEmbeddedSolr(String indexdir) throws
    ParserConfigurationException, SAXException,
		final CoreContainer container = new CoreContainer();
		SolrCore core = new SolrCore(indexdir, null);
		container.register("querychecker", core, false);
		final SolrServer solr = new EmbeddedSolrServer(container, "querychecker");		
		return solr;

// Use the server to load an index.
public void check(String indexdir)
		SolrServer server = SolrHelper.startEmbeddedSolr(indexdir);

This code is called passing an existing index, say /tmp/output
But this code, instead of opening an existing index and read it and make
queries against it, it just creates a new one,
in /tmp/output/index 

Is this something configurable somehow? There's not much documentation about
it, and all examples and running code I see, they create an index and then
play with it - not take an existing one.
How can I make an EmbeddedSolrServer open an already existing index instead
of creating a new one?
Is it different if I use a CommonsHttpSolrServer? 

Thanks a lot in advance for your help.

View this message in context:
Sent from the Solr - User mailing list archive at

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message