Fix serializing indexed unified search array as object
We expect an array of results from the search provider. If the search provider returns an array with indexes, php will serialize it as object, not as array (to preserve the keys). The client doesn't need this info, so we should just discard it and take the values only to always render a JSON array. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
8ab2d5a8d9
commit
0022b63fe8
|
@ -28,6 +28,7 @@ declare(strict_types=1);
|
||||||
namespace OCP\Search;
|
namespace OCP\Search;
|
||||||
|
|
||||||
use JsonSerializable;
|
use JsonSerializable;
|
||||||
|
use function array_values;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 20.0.0
|
* @since 20.0.0
|
||||||
|
@ -107,7 +108,7 @@ final class SearchResult implements JsonSerializable {
|
||||||
return [
|
return [
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
'isPaginated' => $this->isPaginated,
|
'isPaginated' => $this->isPaginated,
|
||||||
'entries' => $this->entries,
|
'entries' => array_values($this->entries),
|
||||||
'cursor' => $this->cursor,
|
'cursor' => $this->cursor,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue