include/SugarSearchEngine/SugarSearchEngineMappingHelper.php
\SugarSearchEngineMappingHelper
Helper class for search engine mappings
- Api
Properties
array
$ftsEnabledFieldTypes= 'array('name', 'user_name', 'varchar', 'decimal', 'float', 'int', 'phone', 'text', 'url')'
this defines the field types that can be enabled for full text search
array('name', 'user_name', 'varchar', 'decimal', 'float', 'int', 'phone', 'text', 'url')
Details- Type
- array
array
$mappingMap= 'array (
'Elastic' => array (
'boost' => 'boost',
'analyzer' => 'analyzer',
'type' => 'type',
),
)'
mapping map This defines the vardefs to search engine mapping.
Technically we only need to define them if the vardef name is different from the search engine mapping name. But it won't hurt to define them even if they are the same.
array (
'Elastic' => array (
'boost' => 'boost',
'analyzer' => 'analyzer',
'type' => 'type',
),
)
Details- Type
- array
array
$typeMap= 'array(
'Elastic' => array (
// searching string in non string types seems to cause elastic to return 500 error
// for example, search 'aaa' in case_number field (type=long) when no data indexed causes error
// we also need to figure out how date works with date format
// so use only strings for now
/*
'type' => array(
'bool' => 'boolean',
'int' => 'long',
'currency' => 'double',
'date' => 'date',
'datetime' => 'date',
),
'dbType' => array(
'decimal' => 'double',
),
*/
),
)'
non string type map sugar vardef type to search engine type mapping
array(
'Elastic' => array (
// searching string in non string types seems to cause elastic to return 500 error
// for example, search 'aaa' in case_number field (type=long) when no data indexed causes error
// we also need to figure out how date works with date format
// so use only strings for now
/*
'type' => array(
'bool' => 'boolean',
'int' => 'long',
'currency' => 'double',
'date' => 'date',
'datetime' => 'date',
),
'dbType' => array(
'decimal' => 'double',
),
*/
),
)
Details- Type
- array
Methods
getMappingName(
\$name $name, \$sugarName $sugarName
)
:
string
Given a search engine name and a vardef name, this function returns corresponding search engine map type.
Name | Type | Description |
---|---|---|
$name | \$name | search engine name |
$sugarName | \$sugarName | vardef name |
Type | Description |
---|---|
string | search engine map name, or the original name if the mapping is not found |
getTypeFromSugarType(
\$name $name, \$fieldDefs $fieldDef
)
:
string
This function returns search engine dependent field type.
Name | Type | Description |
---|---|---|
$name | \$name | search engine name |
$fieldDef | \$fieldDefs | array of field definitions |
Type | Description |
---|---|
string | search engine dependent type |
isTypeFtsEnabled(
\$type $type
)
:
boolean
Given a field type, determine whether this type can be enabled for full text search.
Name | Type | Description |
---|---|---|
$type | \$type | field type |
Type | Description |
---|---|
boolean | whether the field type can be enabled for full text search |
shouldShowModule(
\$moduleName $moduleName
)
:
boolean
Given a modulename, determine whether this module can be enabled for full text search.
Name | Type | Description |
---|---|---|
$moduleName | \$moduleName | module name |
Type | Description |
---|---|
boolean | whether the module can be enabled for full text search |