Skip to content

Commit 4eb0764

Browse files
fix[indexes]: Inverted index to use default options as defined in its class
1 parent 89b65c6 commit 4eb0764

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/Collection/Index/Index.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,22 @@ public function __construct(string $type, array $fields, array $attributes = [])
9898
}
9999

100100
$fieldNames = [];
101-
102101
foreach ($fields as $key => $field) {
103102
if (is_string($field)) {
104-
array_push($fieldNames, $field);
103+
$fieldNames[] = $field;
105104
continue;
106105
}
107106

108107
if (is_array($field)) {
109-
array_push($fieldNames, $field['name']);
108+
$fieldNames[] = $field['name'];
110109
continue;
111110
}
112111

113112
throw new InvalidParameterException("fields[$key]", $field);
114113
}
115114

116115
$this->type = $type;
117-
$this->fields = $fields;
116+
$this->fields = $fieldNames;
118117

119118
// Default values;
120119
$this->id = $attributes['id'] ?? '';

src/Collection/Index/InvertedIndex.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
use ArangoDB\Validation\Exceptions\InvalidParameterException;
66

77
/**
8-
* Inverted index representation
9-
*
10-
* @package ArangoDB\Collection\Index
11-
* @author Lucas S. Vieira
12-
*/
8+
* Inverted index representation
9+
*
10+
* @package ArangoDB\Collection\Index
11+
* @author Lucas S. Vieira
12+
*/
1313
final class InvertedIndex extends Index
1414
{
1515
/**
@@ -35,6 +35,7 @@ final class InvertedIndex extends Index
3535
*/
3636
public function __construct(array $fields, array $attributes = [])
3737
{
38+
$attributes = array_merge($this->defaultOptions, $attributes);
3839
parent::__construct('inverted', $fields, $attributes);
3940
}
4041
}

0 commit comments

Comments
 (0)