update solr index
This commit is contained in:
parent
7c6654398d
commit
535a9363cc
18 changed files with 773 additions and 90 deletions
|
@ -26,16 +26,17 @@ class Dataset extends Model
|
|||
const UPDATED_AT = 'server_date_modified';
|
||||
const PUBLISHED_AT = 'server_date_published';
|
||||
|
||||
protected $fillable = [
|
||||
'type',
|
||||
'language',
|
||||
'server_state',
|
||||
'creating_corporation',
|
||||
'project_id',
|
||||
'embargo_date',
|
||||
'belongs_to_bibliography',
|
||||
];
|
||||
/**
|
||||
// protected $fillable = [
|
||||
// 'type',
|
||||
// 'language',
|
||||
// 'server_state',
|
||||
// 'creating_corporation',
|
||||
// 'project_id',
|
||||
// 'embargo_date',
|
||||
// 'belongs_to_bibliography',
|
||||
// ];
|
||||
protected $guarded = [];
|
||||
/**
|
||||
* The attributes that should be mutated to dates.
|
||||
*
|
||||
* @var array
|
||||
|
@ -54,6 +55,11 @@ class Dataset extends Model
|
|||
// $this->_init();
|
||||
}
|
||||
|
||||
// public function setUpdatedAt($value)
|
||||
// {
|
||||
// $this->{static::UPDATED_AT} = $value;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the geolocation that owns the dataset.
|
||||
*/
|
||||
|
@ -62,6 +68,8 @@ class Dataset extends Model
|
|||
return $this->hasOne(GeolocationBox::class, 'dataset_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the project that the dataset belongs to.
|
||||
*/
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace App\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Dataset;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class XmlCache extends Model
|
||||
{
|
||||
|
@ -13,7 +14,7 @@ class XmlCache extends Model
|
|||
* @var string
|
||||
*/
|
||||
protected $table = 'document_xml_cache';
|
||||
public $timestamps = false;
|
||||
public $timestamps = false;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -22,7 +23,8 @@ class XmlCache extends Model
|
|||
* @var integer
|
||||
* @access protected
|
||||
*/
|
||||
protected $primaryKey = null;
|
||||
//protected $primaryKey = null;
|
||||
public $primaryKey = 'document_id';
|
||||
public $incrementing = false;
|
||||
|
||||
/**
|
||||
|
@ -61,22 +63,18 @@ class XmlCache extends Model
|
|||
* @param mixed $serverDateModified
|
||||
* @return bool Returns true on cached hit else false.
|
||||
*/
|
||||
//public function scopeHasValidEntry($query, $datasetId, $xmlVersion, $serverDateModified)
|
||||
//{
|
||||
// //$select = $this->_table->select()->from($this->_table);
|
||||
// $query->where('document_id = ?', $datasetId)
|
||||
// ->where('xml_version = ?', $xmlVersion)
|
||||
// ->where('server_date_modified = ?', $serverDateModified);
|
||||
public function hasValidEntry($datasetId, $serverDateModified)
|
||||
{
|
||||
$select = DB::table('document_xml_cache');
|
||||
$select->where('document_id', '=', $datasetId)
|
||||
->where('server_date_modified', '=', $serverDateModified);
|
||||
|
||||
$row = $select->first();
|
||||
|
||||
// $row = $query->get();
|
||||
|
||||
// if (null === $row)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
//}
|
||||
if (null === $row) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue