NullIndexField.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Null index field - means search engine does not implement this field.
  4. */
  5. class NullIndexField implements SearchIndexField {
  6. /**
  7. * Get mapping for specific search engine
  8. * @param SearchEngine $engine
  9. * @return array|null Null means this field does not map to anything
  10. */
  11. public function getMapping( SearchEngine $engine ) {
  12. return null;
  13. }
  14. /**
  15. * Set global flag for this field.
  16. *
  17. * @param int $flag Bit flag to set/unset
  18. * @param bool $unset True if flag should be unset, false by default
  19. * @return $this
  20. */
  21. public function setFlag( $flag, $unset = false ) {
  22. return $this;
  23. }
  24. /**
  25. * Check if flag is set.
  26. * @param int $flag
  27. * @return int 0 if unset, !=0 if set
  28. */
  29. public function checkFlag( $flag ) {
  30. return 0;
  31. }
  32. /**
  33. * Merge two field definitions if possible.
  34. *
  35. * @param SearchIndexField $that
  36. * @return SearchIndexField|false New definition or false if not mergeable.
  37. */
  38. public function merge( SearchIndexField $that ) {
  39. return $that;
  40. }
  41. /**
  42. * @inheritDoc
  43. */
  44. public function getEngineHints( SearchEngine $engine ) {
  45. return [];
  46. }
  47. }