mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 12:05:29 +00:00
Remove all further references to getClassNameFromIndex()
This commit is contained in:
parent
9153365313
commit
0fbff7ca6a
@ -124,29 +124,6 @@ abstract class SolrIndex extends SearchIndex
|
|||||||
return implode($indexParts);
|
return implode($indexParts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper for returning the indexer class name from an index name, encoded via {@link getIndexName()}
|
|
||||||
*
|
|
||||||
* @param string $indexName
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public static function getClassNameFromIndex($indexName)
|
|
||||||
{
|
|
||||||
if (($indexPrefix = Environment::getEnv('SS_SOLR_INDEX_PREFIX'))
|
|
||||||
&& (substr($indexName, 0, strlen($indexPrefix)) === $indexPrefix)
|
|
||||||
) {
|
|
||||||
$indexName = substr($indexName, strlen($indexPrefix));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($indexSuffix = Environment::getEnv('SS_SOLR_INDEX_SUFFIX'))
|
|
||||||
&& (substr($indexName, -strlen($indexSuffix)) === $indexSuffix)
|
|
||||||
) {
|
|
||||||
$indexName = substr($indexName, 0, -strlen($indexSuffix));
|
|
||||||
}
|
|
||||||
|
|
||||||
return str_replace('-', '\\', $indexName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTypes()
|
public function getTypes()
|
||||||
{
|
{
|
||||||
return $this->renderWith($this->getTemplatesPath() . '/types.ss');
|
return $this->renderWith($this->getTemplatesPath() . '/types.ss');
|
||||||
|
@ -386,7 +386,7 @@ class SolrIndexTest extends SapphireTest
|
|||||||
Environment::putEnv('SS_SOLR_INDEX_PREFIX="foo_"');
|
Environment::putEnv('SS_SOLR_INDEX_PREFIX="foo_"');
|
||||||
Environment::putEnv('SS_SOLR_INDEX_SUFFIX="_bar"');
|
Environment::putEnv('SS_SOLR_INDEX_SUFFIX="_bar"');
|
||||||
|
|
||||||
$this->assertSame($expected, SolrIndex::getClassNameFromIndex($indexName));
|
$this->assertSame($expected, $indexName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user