mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-25 16:36:12 +01:00
Merge remote-tracking branch 'origin/develop' into hotfix/135-limit-page-indexing
This commit is contained in:
commit
81b210b3b7
6 changed files with 85 additions and 23 deletions
|
@ -174,7 +174,7 @@ class TcaTableService implements TcaTableServiceInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isBlackListedRootLineConfigured()) {
|
if ($this->isBlackListedRootLineConfigured()) {
|
||||||
$parameters[':blacklistedRootLine'] = $this->getBlackListedRootLine();
|
$parameters[':blacklistedRootLine'] = implode(',', $this->getBlackListedRootLine());
|
||||||
$whereClause .= ' AND pages.uid NOT IN (:blacklistedRootLine)'
|
$whereClause .= ' AND pages.uid NOT IN (:blacklistedRootLine)'
|
||||||
. ' AND pages.pid NOT IN (:blacklistedRootLine)';
|
. ' AND pages.pid NOT IN (:blacklistedRootLine)';
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,7 +257,6 @@ class TcaTableService76 implements TcaTableServiceInterface
|
||||||
$this->tca['ctrl']['cruser_id'],
|
$this->tca['ctrl']['cruser_id'],
|
||||||
$this->tca['ctrl']['fe_cruser_id'],
|
$this->tca['ctrl']['fe_cruser_id'],
|
||||||
$this->tca['ctrl']['fe_crgroup_id'],
|
$this->tca['ctrl']['fe_crgroup_id'],
|
||||||
$this->tca['ctrl']['languageField'],
|
|
||||||
$this->tca['ctrl']['origUid'],
|
$this->tca['ctrl']['origUid'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,9 @@ class SearchRequest implements SearchRequestInterface
|
||||||
return $this->query;
|
return $this->query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $filter
|
||||||
|
*/
|
||||||
public function setFilter(array $filter)
|
public function setFilter(array $filter)
|
||||||
{
|
{
|
||||||
$filter = \TYPO3\CMS\Core\Utility\ArrayUtility::removeArrayEntryByValue($filter, '');
|
$filter = \TYPO3\CMS\Core\Utility\ArrayUtility::removeArrayEntryByValue($filter, '');
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<dataset>
|
||||||
|
<tt_content>
|
||||||
|
<uid>1</uid>
|
||||||
|
<pid>1</pid>
|
||||||
|
<tstamp>1480686370</tstamp>
|
||||||
|
<crdate>1480686370</crdate>
|
||||||
|
<hidden>0</hidden>
|
||||||
|
<sorting>72</sorting>
|
||||||
|
<sys_language_uid>2</sys_language_uid>
|
||||||
|
<CType>header</CType>
|
||||||
|
<header>indexed content element</header>
|
||||||
|
<bodytext>this is the content of header content element that should get indexed</bodytext>
|
||||||
|
<media>0</media>
|
||||||
|
<layout>0</layout>
|
||||||
|
<deleted>0</deleted>
|
||||||
|
<cols>0</cols>
|
||||||
|
<starttime>0</starttime>
|
||||||
|
<endtime>0</endtime>
|
||||||
|
<colPos>0</colPos>
|
||||||
|
<filelink_sorting>0</filelink_sorting>
|
||||||
|
</tt_content>
|
||||||
|
</dataset>
|
|
@ -77,4 +77,40 @@ class TcaIndexerTest extends AbstractFunctionalTestCase
|
||||||
|
|
||||||
$objectManager->get(TcaIndexer::class, $tableService, $connection)->indexAllDocuments();
|
$objectManager->get(TcaIndexer::class, $tableService, $connection)->indexAllDocuments();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function sysLanguageIsKept()
|
||||||
|
{
|
||||||
|
$this->importDataSet('Tests/Functional/Fixtures/Indexing/TcaIndexer/KeepSysLanguageUid.xml');
|
||||||
|
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class);
|
||||||
|
$tableName = 'tt_content';
|
||||||
|
$tableService = $objectManager->get(
|
||||||
|
TcaTableServiceInterface::class,
|
||||||
|
$tableName,
|
||||||
|
$objectManager->get(RelationResolver::class),
|
||||||
|
$objectManager->get(ConfigurationContainerInterface::class)
|
||||||
|
);
|
||||||
|
|
||||||
|
$connection = $this->getMockBuilder(Elasticsearch::class)
|
||||||
|
->setMethods(['addDocuments'])
|
||||||
|
->disableOriginalConstructor()
|
||||||
|
->getMock();
|
||||||
|
|
||||||
|
$connection->expects($this->once())
|
||||||
|
->method('addDocuments')
|
||||||
|
->with(
|
||||||
|
$this->stringContains('tt_content'),
|
||||||
|
$this->callback(function ($documents) {
|
||||||
|
if ($this->isLegacyVersion()) {
|
||||||
|
return isset($documents[0]['sys_language_uid']) && $documents[0]['sys_language_uid'] === '2';
|
||||||
|
} else {
|
||||||
|
return isset($documents[0]['sys_language_uid']) && $documents[0]['sys_language_uid'] === 2;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
$objectManager->get(TcaIndexer::class, $tableService, $connection)->indexAllDocuments();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ class TcaTableServiceTest extends AbstractUnitTestCase
|
||||||
*/
|
*/
|
||||||
public function doUsePlainQueryIfNoAdditionalWhereClauseIsDefined()
|
public function doUsePlainQueryIfNoAdditionalWhereClauseIsDefined()
|
||||||
{
|
{
|
||||||
$this->markTestSkipped('We have to migrate this test for TYPO3 CMS 8.x');
|
$this->markTestIncomplete('We have to migrate this test for TYPO3 CMS 8.x');
|
||||||
$this->configuration->expects($this->exactly(2))
|
$this->configuration->expects($this->exactly(2))
|
||||||
->method('getIfExists')
|
->method('getIfExists')
|
||||||
->withConsecutive(['indexing.table.additionalWhereClause'], ['indexing.table.rootLineBlacklist'])
|
->withConsecutive(['indexing.table.additionalWhereClause'], ['indexing.table.rootLineBlacklist'])
|
||||||
|
@ -98,7 +98,7 @@ class TcaTableServiceTest extends AbstractUnitTestCase
|
||||||
*/
|
*/
|
||||||
public function configuredAdditionalWhereClauseIsAdded()
|
public function configuredAdditionalWhereClauseIsAdded()
|
||||||
{
|
{
|
||||||
$this->markTestSkipped('We have to migrate this test for TYPO3 CMS 8.x');
|
$this->markTestIncomplete('We have to migrate this test for TYPO3 CMS 8.x');
|
||||||
$this->configuration->expects($this->exactly(2))
|
$this->configuration->expects($this->exactly(2))
|
||||||
->method('getIfExists')
|
->method('getIfExists')
|
||||||
->withConsecutive(['indexing.table.additionalWhereClause'], ['indexing.table.rootLineBlacklist'])
|
->withConsecutive(['indexing.table.additionalWhereClause'], ['indexing.table.rootLineBlacklist'])
|
||||||
|
@ -110,15 +110,15 @@ class TcaTableServiceTest extends AbstractUnitTestCase
|
||||||
|
|
||||||
$this->subject->getRecord(10);
|
$this->subject->getRecord(10);
|
||||||
|
|
||||||
// $whereClause = $this->subject->getWhereClause();
|
$whereClause = $this->subject->getWhereClause();
|
||||||
// $this->assertSame(
|
$this->assertSame(
|
||||||
// '1=1 AND pages.no_search = 0 AND table.field = "someValue"',
|
'1=1 AND pages.no_search = 0 AND table.field = "someValue"',
|
||||||
// $whereClause->getStatement()
|
$whereClause->getStatement()
|
||||||
// );
|
);
|
||||||
// $this->assertSame(
|
$this->assertSame(
|
||||||
// [],
|
[],
|
||||||
// $whereClause->getParameters()
|
$whereClause->getParameters()
|
||||||
// );
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,6 +126,7 @@ class TcaTableServiceTest extends AbstractUnitTestCase
|
||||||
*/
|
*/
|
||||||
public function allConfiguredAndAllowedTcaColumnsAreReturnedAsFields()
|
public function allConfiguredAndAllowedTcaColumnsAreReturnedAsFields()
|
||||||
{
|
{
|
||||||
|
$this->markTestIncomplete('We have to migrate this test');
|
||||||
$GLOBALS['TCA']['test_table'] = [
|
$GLOBALS['TCA']['test_table'] = [
|
||||||
'ctrl' => [
|
'ctrl' => [
|
||||||
'languageField' => 'sys_language_uid',
|
'languageField' => 'sys_language_uid',
|
||||||
|
@ -161,16 +162,16 @@ class TcaTableServiceTest extends AbstractUnitTestCase
|
||||||
);
|
);
|
||||||
$this->inject($subject, 'logger', $this->getMockedLogger());
|
$this->inject($subject, 'logger', $this->getMockedLogger());
|
||||||
|
|
||||||
// $this->assertSame(
|
$this->assertSame(
|
||||||
// [
|
[
|
||||||
// 'test_table.uid',
|
'test_table.uid',
|
||||||
// 'test_table.pid',
|
'test_table.pid',
|
||||||
// 'test_table.sys_language_uid',
|
'test_table.sys_language_uid',
|
||||||
// 'test_table.available_column',
|
'test_table.available_column',
|
||||||
// ],
|
],
|
||||||
// $subject->getFields(),
|
$subject->getFields(),
|
||||||
// ''
|
''
|
||||||
// );
|
);
|
||||||
unset($GLOBALS['TCA']['test_table']);
|
unset($GLOBALS['TCA']['test_table']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue