Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 26 additions & 23 deletions openml_OS/libraries/ElasticSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ private function build_study($d) {
'uploader_id' => $d->creator,
'uploader' => array_key_exists($d->creator, $this->user_names) ? $this->user_names[$d->creator] : 'Unknown',
'visibility' => $d->visibility,
'type' => $d->main_entity_type,
'study_type' => $d->main_entity_type,
'legacy' => $d->legacy,
'suggest' => array(
'input' => array($d->name, $d->description . ' '),
Expand Down Expand Up @@ -1064,10 +1064,12 @@ private function fetch_classes($id = false) {

private function fetch_runfiles($min, $max) {
$index = array();
foreach ($this->db->query('SELECT source, field, name, format, file_id from runfile where source >= ' . $min . ' and source < ' . $max) as $r) {
$index[$r->source][$r->field]['url'] = BASE_URL . 'data/download/' . $r->file_id . '/' . $r->name;
$index[$r->source][$r->field]['format'] = $r->format;
}
$runfiles = $this->db->query('SELECT source, field, name, format, file_id from runfile where source >= ' . $min . ' and source < ' . $max);
if ($runfiles)
foreach ($runfiles as $r) {
$index[$r->source][$r->field]['url'] = BASE_URL . 'data/download/' . $r->file_id . '/' . $r->name;
$index[$r->source][$r->field]['format'] = $r->format;
}
return $index;
}

Expand Down Expand Up @@ -1439,16 +1441,16 @@ private function build_task_type($d) {
);

$inputs = $this->db->query('SELECT name, type, description, io, requirement FROM task_type_inout where ttid=' . $d->ttid);

foreach ($inputs as $i) {
$new_data['input'][] = array(
'name' => $i->name,
'type' => $i->type,
'description' => $i->description,
'io' => $i->io,
'requirement' => $i->requirement
);
}
if ($inputs)
foreach ($inputs as $i) {
$new_data['input'][] = array(
'name' => $i->name,
'type' => $i->type,
'description' => $i->description,
'io' => $i->io,
'requirement' => $i->requirement
);
}
return $new_data;
}

Expand Down Expand Up @@ -1767,15 +1769,16 @@ public function index_single_dataset($id) {
if ($id and ! $datasets)
return 'Error: data set ' . $id . ' is unknown';

foreach ($datasets as $d) {
$params['body'][] = array(
'index' => array(
'_id' => $d->did
)
);
if ($datasets)
foreach ($datasets as $d) {
$params['body'][] = array(
'index' => array(
'_id' => $d->did
)
);

$params['body'][] = $this->build_data($d);
}
$params['body'][] = $this->build_data($d);
}

$responses = $this->client->bulk($params);

Expand Down