chg: [decaying] Improved coverage of model overrides to the API

pull/5032/head
mokaddem 2019-08-16 16:58:07 +02:00
parent 8d8526977d
commit 0e00413259
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 7 additions and 5 deletions

View File

@ -17,6 +17,7 @@ class DecayingModel extends AppModel
);
private $__registered_model_classes = array();
public $allowed_overrides = array('threshold' => 1, 'tau', 'delta');
public function afterFind($results, $primary = false) {
foreach ($results as $k => $v) {
@ -438,9 +439,8 @@ class DecayingModel extends AppModel
public function overrideModelParameters(&$model, $model_overrides)
{
$allowed_overrides = array('threshold' => 1);
foreach ($model_overrides as $parameter => $value) {
if (isset($allowed_overrides[$parameter])) {
if (isset($this->allowed_overrides[$parameter])) {
$model['DecayingModel']['parameters'][$parameter] = $value;
}
}

View File

@ -31,11 +31,13 @@
{
"includeDecayScore": 1,
"excludeDecayed": 0,
"decayingModel": <?php echo h($decaying_model['DecayingModel']['id']); ?>,
"decayingModel": [<?php echo h($decaying_model['DecayingModel']['id']); ?>],
"to_ids": 1,
"org": <?php echo h($user['Organisation']['id']);?>,
"tags": <?php echo json_encode($registered_taxonomies); ?>
"tags": <?php echo json_encode($registered_taxonomies); ?>,
"modelOverrides": {
}
}</textarea>
</br>
<span class="btn btn-primary" style="width: fit-content;" role="button" onclick="doRestSearch(this)"><?php echo __('Search'); ?></span>