You are here

protected function FuzzySearchService::sqlType in Fuzzy Search 7

Helper to match Search API types to SQL types.

2 calls to FuzzySearchService::sqlType()
FuzzySearchService::createFieldTable in includes/service.inc
Helper method for creating the table for a field.
FuzzySearchService::fieldsUpdated in includes/service.inc
Implements SearchApiServiceInterface::__construct().

File

includes/service.inc, line 237

Class

FuzzySearchService
Search service class using the database for storing index information.

Code

protected function sqlType($type) {
  $type = search_api_extract_inner_type($type);
  switch ($type) {
    case 'string':
    case 'uri':
      return array(
        'type' => 'varchar',
        'length' => 255,
      );
    case 'integer':
    case 'duration':

    // Convert dates into a timestamp.
    case 'date':
      return array(
        'type' => 'int',
      );
    case 'decimal':
      return array(
        'type' => 'float',
      );
    case 'boolean':
      return array(
        'type' => 'int',
        'size' => 'tiny',
      );
    default:
      throw new SearchApiException(t('Unknown field type !type. Database search module might be out of sync with Search API.', array(
        '!type' => $type,
      )));
  }
}