@@ 4-75 (lines=72) @@ | ||
1 | <?php |
|
2 | namespace Elastica\Processor; |
|
3 | ||
4 | class Attachment extends AbstractProcessor |
|
5 | { |
|
6 | /** |
|
7 | * Attachment constructor. |
|
8 | * |
|
9 | * @param string $field |
|
10 | */ |
|
11 | public function __construct(string $field) |
|
12 | { |
|
13 | $this->setField($field); |
|
14 | } |
|
15 | ||
16 | /** |
|
17 | * Set field. |
|
18 | * |
|
19 | * @param string $field |
|
20 | * |
|
21 | * @return $this |
|
22 | */ |
|
23 | public function setField(string $field) |
|
24 | { |
|
25 | return $this->setParam('field', $field); |
|
26 | } |
|
27 | ||
28 | /** |
|
29 | * Set target_field. Default attachment. |
|
30 | * |
|
31 | * @param string $targetField |
|
32 | * |
|
33 | * @return $this |
|
34 | */ |
|
35 | public function setTargetField(string $targetField) |
|
36 | { |
|
37 | return $this->setParam('target_field', $targetField); |
|
38 | } |
|
39 | ||
40 | /** |
|
41 | * Set indexed_chars. Default 100000. |
|
42 | * |
|
43 | * @param int $indexedChars |
|
44 | * |
|
45 | * @return $this |
|
46 | */ |
|
47 | public function setIndexedChars(int $indexedChars) |
|
48 | { |
|
49 | return $this->setParam('indexed_chars', $indexedChars); |
|
50 | } |
|
51 | ||
52 | /** |
|
53 | * Set properties. Default all properties. Can be content, title, name, author, keywords, date, content_type, content_length, language |
|
54 | * |
|
55 | * @param array $properties |
|
56 | * |
|
57 | * @return $this |
|
58 | */ |
|
59 | public function setProperties(array $properties) |
|
60 | { |
|
61 | return $this->setParam('properties', $properties); |
|
62 | } |
|
63 | ||
64 | /** |
|
65 | * Set ignore_missing. Default false. |
|
66 | * |
|
67 | * @param bool $ignoreMissing |
|
68 | * |
|
69 | * @return $this |
|
70 | */ |
|
71 | public function setIgnoreMissing(bool $ignoreMissing) |
|
72 | { |
|
73 | return $this->setParam('ignore_missing', $ignoreMissing); |
|
74 | } |
|
75 | } |
@@ 10-83 (lines=74) @@ | ||
7 | * @author Federico Panini <[email protected]> |
|
8 | * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/date-processor.html |
|
9 | */ |
|
10 | class Date extends AbstractProcessor |
|
11 | { |
|
12 | /** |
|
13 | * Date constructor. |
|
14 | * |
|
15 | * @param string $field |
|
16 | * @param array $formats |
|
17 | */ |
|
18 | public function __construct(string $field, array $formats) |
|
19 | { |
|
20 | $this->setField($field); |
|
21 | $this->setFormats($formats); |
|
22 | } |
|
23 | ||
24 | /** |
|
25 | * Set field. |
|
26 | * |
|
27 | * @param string $field |
|
28 | * |
|
29 | * @return $this |
|
30 | */ |
|
31 | public function setField(string $field) |
|
32 | { |
|
33 | return $this->setParam('field', $field); |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * Set field format. Joda pattern or one of the following formats ISO8601, UNIX, UNIX_MS, or TAI64N. |
|
38 | * |
|
39 | * @param array $formats |
|
40 | * |
|
41 | * @return $this |
|
42 | */ |
|
43 | public function setFormats(array $formats) |
|
44 | { |
|
45 | return $this->setParam('formats', $formats); |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * Set target_field. Default value @timestamp. |
|
50 | * |
|
51 | * @param string $targetField |
|
52 | * |
|
53 | * @return $this |
|
54 | */ |
|
55 | public function setTargetField(string $targetField) |
|
56 | { |
|
57 | return $this->setParam('target_field', $targetField); |
|
58 | } |
|
59 | ||
60 | /** |
|
61 | * Set the timezone use when parsing the date. Default UTC. |
|
62 | * |
|
63 | * @param string $timezone |
|
64 | * |
|
65 | * @return $this |
|
66 | */ |
|
67 | public function setTimezone(string $timezone) |
|
68 | { |
|
69 | return $this->setParam('timezone', $timezone); |
|
70 | } |
|
71 | ||
72 | /** |
|
73 | * Set the locale to use when parsing the date. |
|
74 | * |
|
75 | * @param string $locale |
|
76 | * |
|
77 | * @return $this |
|
78 | */ |
|
79 | public function setLocale(string $locale) |
|
80 | { |
|
81 | return $this->setParam('locale', $locale); |
|
82 | } |
|
83 | } |