tags:

views:

342

answers:

2

Hello,

I have just started using SOLR. I have configured the data directory in the solrconfig.xml. However, I've noticed that a subdirectory called index is always created in the end. Is there any way to avoid it?

+1  A: 

From my solrconfig.xml:

<!-- Used to specify an alternate directory to hold all index data
   other than the default ./data under the Solr home.
   If replication is in use, this should match the replication configuration. -->     
<!--  <dataDir>${solr.solr.home}data</dataDir>  -->

The SOLR index will be built in this directory when you start the SOLR server. The 'index' directory within it is where the SOLR server will place all your index data, without it you would not have a valid SOLR installation.

harschware
Really? Of course that is the "index" subdirectory I don't want to exist, because I want to access a Lucene index which is currently working and I can't change the route. Would it be the same event if I try to do it through solrj?
Carlos
I think you're real question may be "What are some good ways to migrate from Lucene to SOLR". I suggest opening another question for that.
harschware
Have you tried setting SOLR_HOME to the path containing the "index" directory? Start up a SOLR server without changing the config and you'll see the base set of directories contained in a SOLR_HOME. Shut it down and then copy over the index path with your Lucene data. Maybe that will work. Don't forget to design your schema to match as @Maurcio suggested in your previous question.
harschware
It is a good idea, I will try it on Monday. And I would like to avoid the data migration, I just want to access the data through Solr to make some faceted searches, I can still work with regular Lucene for the rest.
Carlos
A: 

Seems like there's a simple solution here.

Say your lucene directory is /path/to/lucene/lucene_index and solr's data dir is /path/to/solr/data, inside of which, it expects to find a /index subdirectory.

Why not symlink /path/to/solr/data/index to /path/to/lucene/lucene_index like so?

ln -s /path/to/lucene/lucene_index /path/to/solr/data/index

Of course, this assumes that solr will just work, when given a raw lucene index.

Frank Farmer
I think it is a very simple and good idea, I will do it, thank you very much
Carlos