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 poeta simbolista <po...@gmail.com> on 2009/10/09 12:11:34 UTC
SolrJ - open existing index in EmbeddedSolrServer - query mode
Hi,
I'm trying to open an existing local index with the following code:
/**
* get the SolrServer
*/
public static SolrServer startEmbeddedSolr(String indexdir) throws
IOException,
ParserConfigurationException, SAXException,
SolrServerException
{
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: http://www.nabble.com/SolrJ---open-existing-index-in-EmbeddedSolrServer---query-mode-tp25818657p25818657.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: SolrJ - open existing index in EmbeddedSolrServer - query mode
Posted by Chris Hostetter <ho...@fucit.org>.
: 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
SolrCore doesn't take in the exact path ofhte index -- it takes in a
"dataDir" ... Solr expects the index to be named "index" and live inside
of the dataDir, but solr also expects to be able to put other things in
the dataDir as well.
so do something like this...
mkdir /tmp/solr_data_dir
mv /tmp/output /tmp/solr_data_dir/index
...and then point your SolrCore at /tmp/solr_data_dir
-Hoss