Mark-
You're right that SolrCore#getIndexDir() did not directly read
index.properties in 3.6. In 3.6, it gets it indirectly from what is passed
to the constructor of SolrIndexSearcher. Here's SolrCore#getIndexDir() in
3.6:
public String getIndexDir() {
synchronized (searcherLock) {
if (_searcher == null)
return dataDir + "index/";
SolrIndexSearcher searcher = _searcher.get();
return searcher.getIndexDir() == null ? dataDir + "index/" :
searcher.getIndexDir();
}
}
In 3.6 the only time I see a new SolrIndexSearcher created without the
results of SolrCore#getNewIndexDir() getting passed in somehow would be if
SolrCore#newSearcher(String, boolean) is called manually before any other
SolrIndexSearcher. Otherwise, it looks like getNewIndexDir() is getting
passed to new SolrIndexSearcher which is then reflected back
in SolrCore#getIndexDir().
So, in 3.6 we had been able to rely on SolrCore#getIndexDir() giving us
either the value the index referenced in index.properties OR dataDir +
"index/" if index.properties was missing. In 4.1, it always gives us
dataDir + "index/".
Here's the comment in 3.6 on SolrCore#getNewIndexDir() that I think you
were referring to. The comment is unchanged in 4.1:
/**
* Returns the indexdir as given in index.properties. If index.properties
exists in dataDir and
* there is a property <i>index</i> available and it points to a valid
directory
* in dataDir that is returned Else dataDir/index is returned. Only
called for creating new indexSearchers
* and indexwriters. Use the getIndexDir() method to know the active
index directory
*
* @return the indexdir as given in index.properties
*/
public String getNewIndexDir() {
*"Use the getIndexDir() method to know the active index directory"* is the
behavior that we were reliant on. Since it's now hardcoded to dataDir +
"index/", it doesn't always return the active index directory.
--Gregg
On Wed, Feb 6, 2013 at 5:13 PM, Mark Miller <[email protected]> wrote:
>
> On Feb 6, 2013, at 4:23 PM, Gregg Donovan <[email protected]> wrote:
>
> > code we had that relied on the 3.6 behavior of SolrCore#getIndexDir() is
> > not working the same way.
>
> Can you be very specific about the different behavior that you are seeing?
> What exactly where you seeing and counting on and what are you seeing now?
>
> - Mark