Mapping Targets
Mapping Targets
Mapping targets were introduced in Sitecore 7.0 Update-1 as a breaking change.
They were added as a parameter to the method MapDocumentFieldsToType inside the AbstractFieldNameTranslator class.
Mapping targets specify how the fields retrieved from the index should be mapped on the C# object.
Currently, three mapping targets exist:
-
Indexerwill map the index fields directly onto the C# object indexer (for example,airport["City"] = indexField;). -
Propertieswill map the index fields directly onto the C# object properties (for example,airport.City = indexField;). -
Anythingwill simply map the index fields on the C# object indexer and its properties.
Coveo for Sitecore ignores the MappingTargetType parameter and, instead, maps the fields to the C# object indexer and its properties, as depicted by the Anything mapping target type.
There’s no significant performance gain in mapping the index fields only on the indexer or the properties.
Therefore, both targets are always mapped.
Furthermore, mapping targets are only specified in the document mapping phase.
Developers using the Solr, Lucene, or Coveo for Sitecore search providers can’t configure this value.
The mapping targets can only be modified within the search provider itself.
|
|
Note
A possible use case for discriminating the mapping targets inside a generic Search Provider would be to have a different naming convention for properties and indexer values.
For example, a field with special characters such as OfAirplanes in the index could be mapped to the property |