Пример #1
0
 public function testESDateRewrite()
 {
     // day-less
     $this->assertEquals('2014-04-01T00:00:00Z', caRewriteDateForElasticSearch('2014-04-00T00:00:00Z', true));
     $this->assertEquals('2014-04-30T00:00:00Z', caRewriteDateForElasticSearch('2014-04-00T00:00:00Z', false));
     // month- and day-less
     $this->assertEquals('2014-01-01T00:00:00Z', caRewriteDateForElasticSearch('2014-00-00T00:00:00Z', true));
     $this->assertEquals('2014-12-31T00:00:00Z', caRewriteDateForElasticSearch('2014-00-00T00:00:00Z', false));
 }
Пример #2
0
 public function getIndexingFragment($pm_content, $pa_options)
 {
     if (is_array($pm_content)) {
         $pm_content = serialize($pm_content);
     }
     $va_return = array();
     if (!is_array($pa_parsed_content = caGetISODates($pm_content))) {
         return array();
     }
     $va_return[$this->getTableName() . '/' . $this->getElementCode() . '_text'] = $pm_content;
     $ps_rewritten_start = caRewriteDateForElasticSearch($pa_parsed_content["start"], true);
     $ps_rewritten_end = caRewriteDateForElasticSearch($pa_parsed_content["end"], false);
     $va_return[$this->getTableName() . '/' . $this->getElementCode()] = array($ps_rewritten_start, $ps_rewritten_end);
     return $va_return;
 }