Customizations
The HawkSearch Salesforce connector supports two primary extension points to incorporate custom Apex logic before indexing:
- Field and Facet Creation
- Custom Item Processing
Field and Facet Creation
Fields defined within your indexing configuration file are automatically created. This customization is generally combined with custom item processing to handle fields that the connector doesn't recognize by default.
The connector provides the interface hwk.IFieldAndFacetExtension
for this functionality.
global with sharing class FieldAndFacetExtension implements hwk.IFieldAndFacetExtension {
public List<hwk.Field> getAdditionalFields() { ... }
public List<hwk.Facet> getAdditionalFacets() { ... }
}
hwk.Field
andhwk.Facet
objects match the definitions documented in HawkSearch's Field Objects and Facet Objects references.- The connector only creates fields and facets that don't already exist in HawkSearch; it never updates existing ones.
Item Processing
The connector processes records in batches of 125. This custom code will be called by the connector after it processes a batch of records, immediately before sending them to HawkSearch. The code may make any changes to the item list, such as adding/removing fields or adding/removing field values.
global with sharing class hawk_MRCIndexingExtension implements hwk.IIndexingExtension {
public List<Map<String, String[]>> beforeIndexItems(List<Map<String, String[]>> items) { ... }
}
The List<Map<String, String[]>> object is passed directly to the HawkSearch Indexing API, and the keys/values in each inner Map will reflect the HawkSearch field names and Salesforce values defined in the indexing configuration JSON file. Refer to Indexing API - Index-Items for details on this object.
Updated 12 days ago