Skip to content

Commit 7648fcb

Browse files
committed
Implement interface functions for Mapping - Analyzers, Filters, Tokenizers
1 parent 27cd601 commit 7648fcb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+835
-11
lines changed

src/Mapping/Analyzer/Fingerprint.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ public function __construct(
3636
}
3737

3838

39+
public function name(): string
40+
{
41+
return 'customFingerprint';
42+
}
43+
44+
3945
public function getType(): string
4046
{
4147
return 'fingerprint';

src/Mapping/Analyzer/Keyword.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ public function getType(): string
1414
}
1515

1616

17+
public function name(): string
18+
{
19+
return 'customKeywod';
20+
}
21+
22+
1723
public function toArray(): array
1824
{
1925
return [

src/Mapping/Analyzer/Pattern.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ public function __construct(
4343
}
4444

4545

46+
public function name(): string
47+
{
48+
return 'customPattern';
49+
}
50+
51+
4652
public function getType(): string
4753
{
4854
return 'pattern';

src/Mapping/Analyzer/Simple.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ public function getType(): string
1414
}
1515

1616

17+
public function name(): string
18+
{
19+
return 'customSimple';
20+
}
21+
22+
1723
public function toArray(): array
1824
{
1925
return [

src/Mapping/Analyzer/Standard.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ public function __construct(
2929
}
3030

3131

32+
public function name(): string
33+
{
34+
return 'customStandard';
35+
}
36+
37+
3238
public function getType(): string
3339
{
3440
return 'standard';

src/Mapping/Analyzer/Stop.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public function __construct(
2121
$this->stopWords = $stopWords;
2222
}
2323

24+
public function name(): string
25+
{
26+
return 'customStop';
27+
}
28+
2429

2530
public function getType(): string
2631
{

src/Mapping/Analyzer/Whitespace.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ public function getType(): string
1414
}
1515

1616

17+
public function name(): string
18+
{
19+
return 'customWhitespace';
20+
}
21+
22+
1723
public function toArray(): array
1824
{
1925
return [

src/Mapping/Filter/ASCIIFolding.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public function getType(): string
1313
return 'asciifolding';
1414
}
1515

16+
1617
public function key(): string
1718
{
1819
return $this->getType();
@@ -21,7 +22,11 @@ public function key(): string
2122

2223
public function toArray(): array
2324
{
24-
return [];
25+
return [
26+
$this->key() => [
27+
'type' => $this->getType(),
28+
],
29+
];
2530
}
2631

2732
}

src/Mapping/Filter/Apostrophe.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-apostrophe-tokenfilter.html
77
*/
8-
class Apostrophe implements \Spameri\ElasticQuery\Mapping\FilterInterface, \Spameri\ElasticQuery\Collection\Item
8+
class Apostrophe implements \Spameri\ElasticQuery\Mapping\FilterInterface
99
{
1010

1111
public function getType(): string
@@ -14,15 +14,19 @@ public function getType(): string
1414
}
1515

1616

17-
public function toArray() : array
17+
public function key(): string
1818
{
19-
// TODO: Implement toArray() method.
19+
return $this->getType();
2020
}
2121

2222

23-
public function key() : string
23+
public function toArray(): array
2424
{
25-
// TODO: Implement key() method.
25+
return [
26+
$this->key() => [
27+
'type' => $this->getType(),
28+
],
29+
];
2630
}
2731

2832
}

src/Mapping/Filter/Classic.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,20 @@ public function getType(): string
1313
return 'classic';
1414
}
1515

16+
17+
public function key(): string
18+
{
19+
return $this->getType();
20+
}
21+
22+
23+
public function toArray(): array
24+
{
25+
return [
26+
$this->key() => [
27+
'type' => $this->getType(),
28+
],
29+
];
30+
}
31+
1632
}

0 commit comments

Comments
 (0)