Skip to content

Commit

Permalink
Hans/no subsites (#124)
Browse files Browse the repository at this point in the history
* Remove subsites as a part of the code

* Remove subsites from circleci and extensions

* Add suggestion

* Add subsite to the docs

* Can return null for current state
  • Loading branch information
Firesphere authored and marczhermo committed Sep 17, 2019
1 parent cc6eb65 commit a5c216b
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 65 deletions.
9 changes: 0 additions & 9 deletions .circleci/Subsite.phpsrc

This file was deleted.

5 changes: 2 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ jobs:
command: |
cp .circleci/.env.test ./.env
cp .circleci/CircleCITestIndex.phpsrc app/src/CircleCITestIndex.php
cp .circleci/Subsite.phpsrc app/src/Subsite.php
cp .circleci/TestIndexTwo.yml app/_config/search.yml
- run: vendor/bin/sake dev/build flush=all skipannotation=true
- run:
Expand Down Expand Up @@ -184,7 +183,6 @@ jobs:
command: |
cp .circleci/.env.test ./.env
cp .circleci/CircleCITestIndex.phpsrc app/src/CircleCITestIndex.php
cp .circleci/Subsite.phpsrc app/src/Subsite.php
cp .circleci/TestIndexTwo.yml app/_config/search.yml
- run: git clone [email protected]:silverstripe-archive/silverstripe-fulltextsearch-localsolr.git localsolr
- run:
Expand Down Expand Up @@ -240,6 +238,7 @@ jobs:
case $CIRCLE_BRANCH in "master") git clone [email protected]:Firesphere/silverstripe-solr-compatibility.git compat -q ;; esac
case $CIRCLE_BRANCH in "master") git clone [email protected]:Firesphere/silverstripe-solr-search.git search -q ;; esac
case $CIRCLE_BRANCH in "master") git clone [email protected]:Firesphere/silverstripe-fluent-solr.git fluent -q ;; esac
case $CIRCLE_BRANCH in "master") git clone [email protected]:Firesphere/silverstripe-subsite-solr.git subsite -q ;; esac
- run:
name: Setup git
command: |
Expand All @@ -250,7 +249,7 @@ jobs:
name: Generate docs
command: |
rm -rf solr
case $CIRCLE_BRANCH in "master") php phpdoc.phar -d "compat/src","search/src","fluent/src" -t solr ;; esac
case $CIRCLE_BRANCH in "master") php phpdoc.phar -d "compat/src","search/src","fluent/src","subsite/src" -t solr ;; esac
- run:
name: Commit and upload
command: |
Expand Down
3 changes: 0 additions & 3 deletions _config/extensions.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
SilverStripe\ORM\DataObject:
extensions:
- Firesphere\SolrSearch\Extensions\DataObjectExtension
Firesphere\SolrSearch\Indexes\BaseIndex:
extensions:
- Firesphere\SolrSearch\Compat\SubsitesExtension # Subsites compatibility
SilverStripe\Forms\GridField\GridField:
extensions:
- Firesphere\SolrSearch\Extensions\GridFieldExtension
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
},
"suggest": {
"firesphere/fluent-solr-search": "For Fluent support",
"firesphere/fts-compat": "Migration support from Fulltext Search module"
"firesphere/fts-compat": "Migration support from Fulltext Search module",
"firesphere/subsite-solr-search": "Support for Subsites"
},
"minimum-stability": "dev",
"prefer-stable": true
Expand Down
30 changes: 0 additions & 30 deletions src/Compat/SubsitesExtension.php

This file was deleted.

4 changes: 2 additions & 2 deletions src/Interfaces/SiteStateInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public function setDefaultState($state = null);
/**
* Return the current state of the site
*
* @return string
* @return string|null
*/
public function currentState(): string;
public function currentState(): ?string;

/**
* Activate a given state. This should only be done if the state is applicable
Expand Down
4 changes: 1 addition & 3 deletions tests/fixtures/DataResolver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,11 @@ Firesphere\SolrSearch\Tests\TestObject:
ShowInSearch: 0
Firesphere\SolrSearch\Tests\TestPage:
pageOne:
SubsiteID: 0
Title: Page One
Content: This is page one content
ShowInSearch: 1
TestObject: =>Firesphere\SolrSearch\Tests\TestObject.objectOne
pageTwo:
SubsiteID: 0
Title: Page Two
Content: This is page two content
ShowInSearch: 1
Expand All @@ -73,4 +71,4 @@ Firesphere\SolrSearch\Tests\TestRelationObject:
TestObject: =>Firesphere\SolrSearch\Tests\TestObject.objectOne
relationTwo:
Title: Relation Object Two
TestObject: =>Firesphere\SolrSearch\Tests\TestObject.objectOne
TestObject: =>Firesphere\SolrSearch\Tests\TestObject.objectOne
9 changes: 0 additions & 9 deletions tests/unit/BaseIndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
namespace Firesphere\SolrSearch\Tests;

use CircleCITestIndex;
use Firesphere\SolrSearch\Compat\SubsitesExtension;
use Firesphere\SolrSearch\Extensions\DataObjectExtension;
use Firesphere\SolrSearch\Helpers\Synonyms;
use Firesphere\SolrSearch\Indexes\BaseIndex;
Expand Down Expand Up @@ -46,7 +45,6 @@ class BaseIndexTest extends SapphireTest
*/
protected static $required_extensions = [
DataObject::class => [DataObjectExtension::class],
BaseIndex::class => [SubsitesExtension::class],
];

/**
Expand All @@ -72,7 +70,6 @@ public function testInit()
'Title',
'Content',
'ParentID',
'SubsiteID',
'Created',
];

Expand Down Expand Up @@ -228,7 +225,6 @@ public function testGetFieldsForIndexing()
'Title',
'Content',
'ParentID',
'SubsiteID',
'Created',
];
$this->assertEquals($expected, array_values($this->index->getFieldsForIndexing()));
Expand Down Expand Up @@ -333,11 +329,6 @@ public function testDoRetry()
}
}

public function testGetFieldsForSubsites()
{
$this->assertContains('SubsiteID', $this->index->getFilterFields());
}

public function testSetFacets()
{
$this->index->addFacetField(Page::class, ['Title' => 'Title', 'Field' => 'Content']);
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/DocumentFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

namespace Firesphere\SolrSearch\Tests;

use Firesphere\SolrSearch\Compat\SubsitesExtension;
use Firesphere\SolrSearch\Extensions\DataObjectExtension;
use Firesphere\SolrSearch\Factories\DocumentFactory;
use Firesphere\SolrSearch\Helpers\FieldResolver;
Expand All @@ -29,7 +28,6 @@ class DocumentFactoryTest extends SapphireTest

protected static $required_extensions = [
DataObject::class => [DataObjectExtension::class],
BaseIndex::class => [SubsitesExtension::class],
];
/**
* We can't use the constant here for unknown reasons
Expand Down Expand Up @@ -177,7 +175,7 @@ public function testBuildItems()
$this->assertInstanceOf(Document::class, $doc);
$fields = $doc->getFields();
$this->assertArrayHasKey('SiteTree_Created', $fields);
unset($fields['SiteTree_Created'], $fields['SiteTree_SubsiteID']); // Unset the Created, it changes per run
unset($fields['SiteTree_Created']); // Unset the Created, it changes per run
foreach (static::$expected_docs as $expectedDoc) {
if ($expectedDoc['id'] === $doc['ItemID']) {
// Make sure any anomalies are ignored, we care about the doc being found
Expand Down
2 changes: 0 additions & 2 deletions tests/unit/SolrIndexTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
namespace Firesphere\SolrSearch\Tests;

use Firesphere\PartialUserforms\Tests\TestHelper;
use Firesphere\SolrSearch\Compat\SubsitesExtension;
use Firesphere\SolrSearch\Extensions\DataObjectExtension;
use Firesphere\SolrSearch\Indexes\BaseIndex;
use Firesphere\SolrSearch\Tasks\SolrIndexTask;
Expand All @@ -26,7 +25,6 @@ class SolrIndexTaskTest extends SapphireTest

protected static $required_extensions = [
DataObject::class => [DataObjectExtension::class],
BaseIndex::class => [SubsitesExtension::class],
];

public function setUp()
Expand Down

0 comments on commit a5c216b

Please sign in to comment.