PageRenderTime 53ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/Elastica/Query/Range.php

https://github.com/philippfrenzel/Elastica
PHP | 37 lines | 14 code | 1 blank | 22 comment | 1 complexity | ea568f087de69c12326a65bc34475c4a MD5 | raw file
Possible License(s): Apache-2.0
  1. <?php
  2. /**
  3. * Range query
  4. *
  5. * @uses Elastica_Query_Abstract
  6. * @category Xodoa
  7. * @package Elastica
  8. * @author Nicolas Ruflin <spam@ruflin.com>
  9. * @link http://www.elasticsearch.org/guide/reference/query-dsl/range-query.html
  10. */
  11. class Elastica_Query_Range extends Elastica_Query_Abstract
  12. {
  13. /**
  14. * Constructor
  15. *
  16. * @param string $fieldName Field name
  17. * @param array $args Field arguments
  18. */
  19. public function __construct($fieldName = null, array $args = array())
  20. {
  21. if ($fieldName) {
  22. $this->addField($fieldName, $args);
  23. }
  24. }
  25. /**
  26. * Adds a range field to the query
  27. *
  28. * @param string $fieldName Field name
  29. * @param array $args Field arguments
  30. * @return Elastica_Query_Range Current object
  31. */
  32. public function addField($fieldName, array $args)
  33. {
  34. return $this->setParam($fieldName, $args);
  35. }
  36. }