public function getFtsTypeFromDef($fieldDef)
 {
     if ($fieldDef['name'] == 'lat_long_c') {
         return array('type' => 'geo_point');
     }
     return parent::getFtsTypeFromDef($fieldDef);
 }
 /**
  * This function returns an array of fields that can be passed to search engine.
  * @param Array $options
  * @param boolean $prefixed Add module name prefix (i.e. Contacts.first_name)
  * @return Array array of fields
  */
 protected function getSearchFields($options, $prefixed = true)
 {
     $fields = array();
     // determine list of modules/fields
     $allFieldDefs = array();
     if (!empty($options['moduleFilter'])) {
         foreach ($options['moduleFilter'] as $module) {
             $allFieldDefs[$module] = SugarSearchEngineMetadataHelper::retrieveFtsEnabledFieldsPerModule($module);
         }
     } else {
         $allFieldDefs = SugarSearchEngineMetadataHelper::retrieveFtsEnabledFieldsForAllModules();
     }
     // build list of fields with optional boost values (i.e. Accouns.name^3)
     foreach ($allFieldDefs as $module => $fieldDefs) {
         foreach ($fieldDefs as $fieldName => $fieldDef) {
             // skip non-supported field types
             $ftsType = $this->mapper->getFtsTypeFromDef($fieldDef);
             if (!$ftsType || in_array($ftsType['type'], $this->ignoreSearchTypes)) {
                 $this->logger->debug("Elastic: Ignoring unsupported type in query for {$module}/{$fieldName}");
                 continue;
             }
             // base field name
             if ($prefixed) {
                 $fieldName = $module . '.' . $fieldName;
             }
             // To enable a field for user search we require a boost value. There may be other fields
             // we index into Elastic but which should not be user searchable. We use the boost value
             // being set or not to distinguish between both scenarios. For example for extended facets
             // and related fields we can store additional fields or non analyzed data. While we need
             // those fields being indexed, we do not want the user to be able to hit those when
             // performing a search.
             if (empty($fieldDef['full_text_search']['boost'])) {
                 $this->logger->debug("Elastic: skipping {$module}/{$fieldName} for search field (no boost set)");
                 continue;
             } else {
                 if (!empty($options['addSearchBoosts'])) {
                     $fieldName .= '^' . $fieldDef['full_text_search']['boost'];
                 }
                 $fields[] = $fieldName;
             }
         }
     }
     return $fields;
 }
 /**
  *
  * Create index mapping
  * @param SugarSearchEngineElasticMapping $mapper
  */
 protected function setMapping(SugarSearchEngineElasticMapping $mapper)
 {
     $mapper->setFullMapping();
 }