You are here

protected function SarniaSolrService::formatFilterValue in Sarnia 7

Override SearchApiSolrService::formatFilterValue() because it relies on SearchApiSolrConnection::phrase().

Overrides SearchApiSolrService::formatFilterValue

See also

SarniaSolrService::phrase()

File

./service.inc, line 369

Class

SarniaSolrService
Search service class using Solr server.

Code

protected function formatFilterValue($value, $type) {
  switch ($type) {
    case 'boolean':
      $value = $value ? 'true' : 'false';
      break;
    case 'date':
      $value = is_numeric($value) ? (int) $value : strtotime($value);
      if ($value === FALSE) {
        return 0;
      }
      $value = format_date($value, 'custom', self::SOLR_DATE_FORMAT, 'UTC');
      break;
  }
  return SarniaSolrService::phrase($value);
}