mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 14:05:29 +02:00
Batch fixes for tests #2
This commit is contained in:
parent
6a2a4a8dd2
commit
9d5ea9393d
@ -43,7 +43,12 @@ class SearchIntrospection
|
||||
$classes = array_unique(array_merge($classes, array_values(ClassInfo::subclassesFor($class))));
|
||||
}
|
||||
|
||||
$idx = array_search('DataObject', $classes);
|
||||
$idx = array_search('SilverStripe\View\ViewableData', $classes);
|
||||
if ($idx !== false) {
|
||||
array_splice($classes, 0, $idx+1);
|
||||
}
|
||||
|
||||
$idx = array_search('SilverStripe\Core\Object', $classes);
|
||||
if ($idx !== false) {
|
||||
array_splice($classes, 0, $idx+1);
|
||||
}
|
||||
|
@ -7,6 +7,9 @@ use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\ORM\DataObjectSchema;
|
||||
use SilverStripe\Core\Object;
|
||||
use SilverStripe\Core\ClassInfo;
|
||||
use SilverStripe\FullTextSearch\Search\SearchIntrospection;
|
||||
use SilverStripe\FullTextSearch\Search\Variants\SearchVariant;
|
||||
use SilverStripe\FullTextSearch\Utils\MultipleArrayIterator;
|
||||
/**
|
||||
* SearchIndex is the base index class. Each connector will provide a subclass of this that
|
||||
* provides search engine specific behavior.
|
||||
@ -90,20 +93,20 @@ abstract class SearchIndex extends ViewableData
|
||||
foreach (SearchIntrospection::hierarchy($source, $options['include_children']) as $dataclass) {
|
||||
$singleton = singleton($dataclass);
|
||||
|
||||
if ($hasOne = $singleton->has_one($lookup)) {
|
||||
if ($hasOne = $singleton->hasOne($lookup)) {
|
||||
$class = $hasOne;
|
||||
$options['lookup_chain'][] = array(
|
||||
'call' => 'method', 'method' => $lookup,
|
||||
'through' => 'has_one', 'class' => $dataclass, 'otherclass' => $class, 'foreignkey' => "{$lookup}ID"
|
||||
);
|
||||
} elseif ($hasMany = $singleton->has_many($lookup)) {
|
||||
} elseif ($hasMany = $singleton->hasMany($lookup)) {
|
||||
$class = $hasMany;
|
||||
$options['multi_valued'] = true;
|
||||
$options['lookup_chain'][] = array(
|
||||
'call' => 'method', 'method' => $lookup,
|
||||
'through' => 'has_many', 'class' => $dataclass, 'otherclass' => $class, 'foreignkey' => $singleton->getRemoteJoinField($lookup, 'has_many')
|
||||
);
|
||||
} elseif ($manyMany = $singleton->many_many($lookup)) {
|
||||
} elseif ($manyMany = $singleton->manyMany($lookup)) {
|
||||
$class = $manyMany[1];
|
||||
$options['multi_valued'] = true;
|
||||
$options['lookup_chain'][] = array(
|
||||
@ -112,7 +115,7 @@ abstract class SearchIndex extends ViewableData
|
||||
);
|
||||
}
|
||||
|
||||
if ($class) {
|
||||
if (is_string($class) && $class) {
|
||||
if (!isset($options['origin'])) {
|
||||
$options['origin'] = $dataclass;
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\FullTextSearch\Search\Updaters;
|
||||
|
||||
use SilverStripe\ORM\DB;
|
||||
/**
|
||||
* This class is responsible for capturing changes to DataObjects and triggering index updates of the resulting dirty index
|
||||
* items.
|
||||
|
@ -3,6 +3,7 @@
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\FullTextSearch\Search\Indexes\SearchIndex_Recording;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\FullTextSearch\Search\Updaters\SearchUpdater;
|
||||
|
||||
class SearchUpdaterTest_Container extends DataObject
|
||||
{
|
||||
|
@ -4,19 +4,20 @@ namespace SilverStripe\FullTextSearch\Tests\SolrVersionedTest;
|
||||
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
|
||||
/**
|
||||
* Non-sitetree versioned dataobject
|
||||
*/
|
||||
class SolrIndexVersionedTest_Object extends DataObject implements TestOnly {
|
||||
|
||||
private static $extensions = array(
|
||||
'Versioned'
|
||||
);
|
||||
private static $extensions = [
|
||||
Versioned::class
|
||||
];
|
||||
|
||||
private static $db = array(
|
||||
private static $db = [
|
||||
'Title' => 'Varchar',
|
||||
'Content' => 'Text',
|
||||
'TestText' => 'Varchar',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
@ -4,15 +4,16 @@ namespace SilverStripe\FullTextSearch\Tests\SolrReindexTest;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\FullTextSearch\Tests\SolrReindexTest\SolrReindexTest_ItemExtension;
|
||||
|
||||
/**
|
||||
* Does not have any variant extensions
|
||||
*/
|
||||
class SolrReindexTest_Item extends DataObject implements TestOnly
|
||||
{
|
||||
private static $extensions = array(
|
||||
'SolrReindexTest_ItemExtension'
|
||||
);
|
||||
private static $extensions = [
|
||||
SolrReindexTest_ItemExtension::class
|
||||
];
|
||||
|
||||
private static $db = array(
|
||||
'Title' => 'Varchar(255)',
|
||||
|
Loading…
Reference in New Issue
Block a user