diff --git a/Solr/5/extras/elevate.xml b/Solr/5/extras/elevate.xml index d0d6a4e3..0e934fdd 100644 --- a/Solr/5/extras/elevate.xml +++ b/Solr/5/extras/elevate.xml @@ -23,14 +23,14 @@ - - - + + + - - + + diff --git a/Solr/5/extras/solrconfig.xml b/Solr/5/extras/solrconfig.xml index f9769aa3..92a23543 100644 --- a/Solr/5/extras/solrconfig.xml +++ b/Solr/5/extras/solrconfig.xml @@ -810,7 +810,7 @@ explicit 10 - _text + text default - _text + text solr.DirectSolrSpellChecker internal @@ -1320,7 +1320,7 @@ wordbreak solr.WordBreakSolrSpellChecker - _text + text true true 10 @@ -1380,7 +1380,7 @@ --> - _text + text - _text + text true @@ -1564,7 +1564,7 @@ --> - string + text elevate.xml diff --git a/src/Admins/SearchAdmin.php b/src/Admins/SearchAdmin.php index 42aa2372..bcb4baaf 100644 --- a/src/Admins/SearchAdmin.php +++ b/src/Admins/SearchAdmin.php @@ -14,6 +14,11 @@ use Firesphere\SolrSearch\Models\SolrLog; use SilverStripe\Admin\ModelAdmin; use SilverStripe\View\Requirements; +use Firesphere\SolrSearch\Forms\GridFieldOrderableSearch; +use Firesphere\SolrSearch\Models\SearchClass; +use Firesphere\SolrSearch\Models\Elevation; +use Firesphere\SolrSearch\Models\ElevatedItem; +use Symbiote\GridFieldExtensions\GridFieldOrderableRows; /** * Class \Firesphere\SolrSearch\Admins\SearchAdmin @@ -31,6 +36,8 @@ class SearchAdmin extends ModelAdmin SearchSynonym::class, SolrLog::class, DirtyClass::class, + Elevation::class, + ElevatedItem::class, ]; /** @@ -57,4 +64,23 @@ public function init() Requirements::css('firesphere/solr-search:client/dist/main.css'); } + + public function getEditForm($id = null, $fields = null) + { + $oldImportFrom = $this->showImportForm; + $this->showImportForm = false; + /** @var GridField $gridField */ + $form = parent::getEditForm($id, $fields); + $this->showImportForm = $oldImportFrom; + + if ($this->modelClass === ElevatedItem::class) { + $gridField = $form->Fields()->dataFieldByName($this->sanitiseClassName($this->modelClass)); + + $gridField + ->getConfig() + ->addComponent(new GridFieldOrderableRows('Rank')); + } + + return $form; + } } diff --git a/src/Models/ElevatedItem.php b/src/Models/ElevatedItem.php new file mode 100644 index 00000000..96f6be92 --- /dev/null +++ b/src/Models/ElevatedItem.php @@ -0,0 +1,26 @@ + 'Int', + 'Title' => 'Varchar(255)', + 'ObjectClass' => 'Varchar(255)', + 'ObjectID' => 'Int', + 'SolrID' => 'Varchar(255)', + 'Include' => 'Boolean(1)', + 'Exclude' => 'Boolean(0)', + ]; + + private static $belongs_many_many = [ + 'Keywords' => Elevation::class, + ]; + + private static $summary_fields = ['Title', 'Rank', 'ObjectClass', 'SolrID', 'Include', 'Exclude']; +} diff --git a/src/Models/Elevation.php b/src/Models/Elevation.php new file mode 100644 index 00000000..5f6d6965 --- /dev/null +++ b/src/Models/Elevation.php @@ -0,0 +1,20 @@ + 'Varchar(255)', + ]; + + private static $many_many = [ + 'Items' => ElevatedItem::class, + ]; + + private static $summary_fields = ['ID', 'Keyword']; +}