add depth to coverage model
This commit is contained in:
parent
52b166601c
commit
2f930457d1
13 changed files with 306 additions and 187 deletions
|
@ -410,15 +410,15 @@ class IndexController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
if (isset($data['geolocation'])) {
|
||||
$formGeolocation = $request->input('geolocation');
|
||||
if ($formGeolocation['xmin'] !== null && $formGeolocation['ymin'] !== null &&
|
||||
$formGeolocation['xmax'] !== null && $formGeolocation['ymax'] !== null) {
|
||||
$geolocation = new GeolocationBox($formGeolocation);
|
||||
$dataset->geolocation()->save($geolocation);
|
||||
//$geolocation->dataset()->associate($dataset)->save();
|
||||
}
|
||||
}
|
||||
// if (isset($data['geolocation'])) {
|
||||
// $formGeolocation = $request->input('geolocation');
|
||||
// if ($formGeolocation['xmin'] !== null && $formGeolocation['ymin'] !== null &&
|
||||
// $formGeolocation['xmax'] !== null && $formGeolocation['ymax'] !== null) {
|
||||
// $geolocation = new GeolocationBox($formGeolocation);
|
||||
// $dataset->geolocation()->save($geolocation);
|
||||
// //$geolocation->dataset()->associate($dataset)->save();
|
||||
// }
|
||||
// }
|
||||
|
||||
if (isset($data['coverage'])) {
|
||||
$formCoverage = $request->input('coverage');
|
||||
|
|
|
@ -64,7 +64,8 @@ class SolariumAdapter
|
|||
$update = $this->client->createUpdate();
|
||||
|
||||
$updateDocs = array_map(function ($rdrDoc) use ($builder, $update) {
|
||||
return $builder->toSolrUpdateDocument($rdrDoc, $update->createDocument());
|
||||
$solarium_document = $update->createDocument();
|
||||
return $builder->toSolrUpdateDocument($rdrDoc, $solarium_document);
|
||||
}, $slice);
|
||||
|
||||
// adding the document to the update query
|
||||
|
@ -129,7 +130,8 @@ class SolariumAdapter
|
|||
//}
|
||||
|
||||
// $filter = $parameters->getFilter();//"aa"
|
||||
// if ( $filter instanceof Opus_Search_Solr_Filter_Raw || $filter instanceof Opus_Search_Solr_Solarium_Filter_Complex ) {
|
||||
// if ( $filter instanceof Opus_Search_Solr_Filter_Raw
|
||||
// || $filter instanceof Opus_Search_Solr_Solarium_Filter_Complex ) {
|
||||
// if ( !$query->getQuery() || !$preferOriginalQuery ) {
|
||||
// $compiled = $filter->compile( $query );
|
||||
// if ( $compiled !== null ) {
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace App\Library\Search;
|
|||
|
||||
use App\Models\Dataset;
|
||||
use Solarium\QueryType\Update\Query\Document\Document;
|
||||
use Solarium\QueryType\Update\Query\Document\DocumentInterface;
|
||||
|
||||
class SolariumDocument extends SolrDocumentXslt
|
||||
{
|
||||
|
@ -12,7 +13,7 @@ class SolariumDocument extends SolrDocumentXslt
|
|||
parent::__construct($options);
|
||||
}
|
||||
|
||||
public function toSolrUpdateDocument(Dataset $rdrDataset, Document $solrDoc)
|
||||
public function toSolrUpdateDocument(Dataset $rdrDataset, DocumentInterface $solrDoc)
|
||||
{
|
||||
if (!($solrDoc instanceof Document)) {
|
||||
throw new \Exception('provided Solr document must be instance of Solarium Update Document');
|
||||
|
|
|
@ -7,6 +7,7 @@ use App\Models\License;
|
|||
use App\Models\Person;
|
||||
use App\Models\File;
|
||||
use App\Models\GeolocationBox;
|
||||
use App\Models\Coverage;
|
||||
use App\Models\Subject;
|
||||
|
||||
/**
|
||||
|
@ -64,9 +65,14 @@ trait DatasetExtension
|
|||
'relation' => 'files',
|
||||
'fetch' => 'eager'
|
||||
),
|
||||
'GeolocationBox' => array(
|
||||
'model' => GeolocationBox::class,
|
||||
'relation' => 'geolocation',
|
||||
// 'GeolocationBox' => array(
|
||||
// 'model' => GeolocationBox::class,
|
||||
// 'relation' => 'geolocation',
|
||||
// 'fetch' => 'eager'
|
||||
// ),
|
||||
'Coverage' => array(
|
||||
'model' => Coverage::class,
|
||||
'relation' => 'coverage',
|
||||
'fetch' => 'eager'
|
||||
),
|
||||
);
|
||||
|
|
|
@ -15,7 +15,11 @@ class Coverage extends Model
|
|||
'elevation_absolut',
|
||||
'depth_min',
|
||||
'depth_max',
|
||||
'depth_absolut'
|
||||
'depth_absolut',
|
||||
'time_min',
|
||||
'time_max',
|
||||
'time_absolut',
|
||||
'xmin', 'xmax', 'ymin', 'ymax'
|
||||
];
|
||||
|
||||
public function dataset()
|
||||
|
|
|
@ -65,10 +65,10 @@ class Dataset extends Model
|
|||
/**
|
||||
* Get the geolocation that owns the dataset.
|
||||
*/
|
||||
public function geolocation()
|
||||
{
|
||||
return $this->hasOne(GeolocationBox::class, 'dataset_id', 'id');
|
||||
}
|
||||
// public function geolocation()
|
||||
// {
|
||||
// return $this->hasOne(GeolocationBox::class, 'dataset_id', 'id');
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the coverage that owns the dataset.
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue