PageRenderTime 34ms CodeModel.GetById 7ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/Elastica/Query/Range.php

https://github.com/nordsee/Elastica
PHP | 39 lines | 15 code | 3 blank | 21 comment | 1 complexity | 2562a5bcd24596d1a680c714e0e20236 MD5 | raw file
Possible License(s): Apache-2.0
  1. <?php
  2. namespace Elastica\Query;
  3. /**
  4. * Range query
  5. *
  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 Range extends AbstractQuery
  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. }