Attachment.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace Elastica\Processor;
  3. class Attachment extends AbstractProcessor
  4. {
  5. /**
  6. * Attachment constructor.
  7. *
  8. * @param string $field
  9. */
  10. public function __construct(string $field)
  11. {
  12. $this->setField($field);
  13. }
  14. /**
  15. * Set field.
  16. *
  17. * @param string $field
  18. *
  19. * @return $this
  20. */
  21. public function setField(string $field)
  22. {
  23. return $this->setParam('field', $field);
  24. }
  25. /**
  26. * Set target_field. Default attachment.
  27. *
  28. * @param string $targetField
  29. *
  30. * @return $this
  31. */
  32. public function setTargetField(string $targetField)
  33. {
  34. return $this->setParam('target_field', $targetField);
  35. }
  36. /**
  37. * Set indexed_chars. Default 100000.
  38. *
  39. * @param int $indexedChars
  40. *
  41. * @return $this
  42. */
  43. public function setIndexedChars(int $indexedChars)
  44. {
  45. return $this->setParam('indexed_chars', $indexedChars);
  46. }
  47. /**
  48. * Set properties. Default all properties. Can be content, title, name, author, keywords, date, content_type, content_length, language.
  49. *
  50. * @param array $properties
  51. *
  52. * @return $this
  53. */
  54. public function setProperties(array $properties)
  55. {
  56. return $this->setParam('properties', $properties);
  57. }
  58. /**
  59. * Set ignore_missing. Default false.
  60. *
  61. * @param bool $ignoreMissing
  62. *
  63. * @return $this
  64. */
  65. public function setIgnoreMissing(bool $ignoreMissing)
  66. {
  67. return $this->setParam('ignore_missing', $ignoreMissing);
  68. }
  69. }