Skip to content

Commit e84409a

Browse files
committed
removed type
1 parent 89660b6 commit e84409a

File tree

11 files changed

+25
-50
lines changed

11 files changed

+25
-50
lines changed

src/Document.php

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,15 @@ class Document implements \Spameri\ElasticQuery\Entity\ArrayInterface
99
{
1010

1111
public function __construct(
12-
private string|null $index,
13-
private \Spameri\ElasticQuery\Document\BodyInterface|null $body = null,
14-
private string|null $type = null,
15-
private string|null $id = null,
16-
private array $options = [],
12+
public string|null $index,
13+
public \Spameri\ElasticQuery\Document\BodyInterface|null $body = null,
14+
public string|null $id = null,
15+
public array $options = [],
1716
)
1817
{
1918
}
2019

2120

22-
public function index(): string|null
23-
{
24-
return $this->index;
25-
}
26-
27-
28-
public function type(): string|null
29-
{
30-
return $this->type;
31-
}
32-
33-
3421
public function toArray(): array
3522
{
3623
$array = [];
@@ -43,10 +30,6 @@ public function toArray(): array
4330
$array['body'] = $this->body->toArray();
4431
}
4532

46-
if ($this->type) {
47-
$array['type'] = $this->type;
48-
}
49-
5033
if ($this->id) {
5134
$array['id'] = $this->id;
5235
}

tests/SpameriTests/ElasticQuery/ElasticQuery.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class ElasticQuery extends \Tester\TestCase
113113
);
114114

115115
$ch = \curl_init();
116-
\curl_setopt($ch, \CURLOPT_URL, 'localhost:9200/' . $document->index() . '/_search');
116+
\curl_setopt($ch, \CURLOPT_URL, 'localhost:9200/' . $document->index . '/_search');
117117
\curl_setopt($ch, \CURLOPT_RETURNTRANSFER, 1);
118118
\curl_setopt($ch, \CURLOPT_CUSTOMREQUEST, 'GET');
119119
\curl_setopt($ch, \CURLOPT_HTTPHEADER, ['Content-Type: application/json']);

tests/SpameriTests/ElasticQuery/Mapping/Analyzer/Custom/CzechDictionary.phpt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@ class CzechDictionary extends \Tester\TestCase
2323
self::INDEX,
2424
new \Spameri\ElasticQuery\Document\Body\Plain(
2525
$settings->toArray()
26-
),
27-
self::INDEX
26+
)
2827
);
2928

3029
// Set up index and analyzer
3130

3231
$ch = \curl_init();
33-
\curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index() . '/');
32+
\curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index . '/');
3433
\curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
3534
\curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
3635
\curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
@@ -45,7 +44,7 @@ class CzechDictionary extends \Tester\TestCase
4544

4645
// Fetch settings and test if analyzer is configured
4746

48-
\curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index() . '/_settings');
47+
\curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index . '/_settings');
4948
\curl_setopt($ch, CURLOPT_POSTFIELDS, []);
5049
\curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
5150

@@ -67,7 +66,7 @@ class CzechDictionary extends \Tester\TestCase
6766

6867
$text = 'Playstation 4 je nejlepší se SodaStream drinkem a kouskem GS-condro!';
6968

70-
\curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index() . '/_analyze');
69+
\curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index . '/_analyze');
7170
\curl_setopt($ch, CURLOPT_POSTFIELDS, \json_encode([
7271
'text' => $text,
7372
'analyzer' => 'czechDictionary',

tests/SpameriTests/ElasticQuery/Query/ElasticMatch.phpt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,11 @@ class ElasticMatch extends \Tester\TestCase
6161
)
6262
)
6363
)->toArray()
64-
),
65-
self::INDEX
64+
)
6665
);
6766

6867
$ch = curl_init();
69-
curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index() . '/_search');
68+
curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index . '/_search');
7069
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
7170
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
7271
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);

tests/SpameriTests/ElasticQuery/Query/Fuzzy.phpt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,11 @@ class Fuzzy extends \Tester\TestCase
5757
)
5858
)
5959
)->toArray()
60-
),
61-
self::INDEX
60+
)
6261
);
6362

6463
$ch = curl_init();
65-
curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index() . '/_search');
64+
curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index . '/_search');
6665
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
6766
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
6867
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);

tests/SpameriTests/ElasticQuery/Query/MatchPhrase.phpt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,11 @@ class MatchPhrase extends \Tester\TestCase
5555
)
5656
)
5757
)->toArray()
58-
),
59-
self::INDEX
58+
)
6059
);
6160

6261
$ch = curl_init();
63-
curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index() . '/_search');
62+
curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index . '/_search');
6463
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
6564
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
6665
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);

tests/SpameriTests/ElasticQuery/Query/Range.phpt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,11 @@ class Range extends \Tester\TestCase
5353
)
5454
)
5555
)->toArray()
56-
),
57-
self::INDEX
56+
)
5857
);
5958

6059
$ch = curl_init();
61-
curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index() . '/_search');
60+
curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index . '/_search');
6261
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
6362
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
6463
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);

tests/SpameriTests/ElasticQuery/Query/Term.phpt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,11 @@ class Term extends \Tester\TestCase
5151
)
5252
)
5353
)->toArray()
54-
),
55-
self::INDEX
54+
)
5655
);
5756

5857
$ch = curl_init();
59-
curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index() . '/_search');
58+
curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index . '/_search');
6059
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
6160
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
6261
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);

tests/SpameriTests/ElasticQuery/Query/Terms.phpt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,11 @@ class Terms extends \Tester\TestCase
5050
)
5151
)
5252
)->toArray()
53-
),
54-
self::INDEX
53+
)
5554
);
5655

5756
$ch = curl_init();
58-
curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index() . '/_search');
57+
curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index . '/_search');
5958
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
6059
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
6160
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);

tests/SpameriTests/ElasticQuery/Query/WildCard.phpt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,11 @@ class WildCard extends \Tester\TestCase
5151
)
5252
)
5353
)->toArray()
54-
),
55-
self::INDEX
54+
)
5655
);
5756

5857
$ch = curl_init();
59-
curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index() . '/_search');
58+
curl_setopt($ch, CURLOPT_URL, 'localhost:9200/' . $document->index . '/_search');
6059
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
6160
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
6261
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);

0 commit comments

Comments
 (0)