...
Code Block | ||
---|---|---|
| ||
<?xml version="1.0" encoding="utf-8"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:search="http://www.sitecore.net/xmlconfig/search/"> <sitecore search:require="solr"> <contentSearch> <indexConfigurations> <!-- If no configuration is specified for an index, it uses the default configuration. The configurations are not merged if the index also has a configuration. The system uses either the default configuration or the index configuration. --> <DFS.ContentSearch.Solr.IndexConfiguration ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration"> <documentOptions type="Sitecore.ContentSearch.SolrProvider.SolrDocumentBuilderOptions, Sitecore.ContentSearch.SolrProvider"> <indexAllFields>true</indexAllFields> <include hint="list:AddIncludedTemplate"> <DFSRootTemplateId>{316978B1-1C41-4F4F-82D5-82863665EDE6}</DFSRootTemplateId> <AssetsSiloTemplateId>{4133449F-6EC1-4D10-A930-3EC828650FA6}</AssetsSiloTemplateId> <AssetTemplateId>{2D63B0B3-89AA-4A87-9A32-D822C71B5BD8}</AssetTemplateId> <MappedEntityTemplateId>{B8879FB6-ADE9-4971-B580-CF0073FC182A}</MappedEntityTemplateId> <DigizuiteEntityTemplateId>{801EC0D4-6D99-4609-B042-96388D314BFD}</DigizuiteEntityTemplateId> </include> <fields hint="raw:AddComputedIndexField"> <field fieldName="mfTitle" metafieldGuid="5eb3eefc-a043-410f-89b0-29ed3ef37078" returnType="string">DFS.Client.Services.ContentSearch.ComputedFields.DynamicMetadata, DFS.Client.Services</field> <field fieldName="mfPublishTo" metafieldGuid="74a5a102-a310-4bb7-9e84-0b14c36436b2" returnType="stringCollection">DFS.Client.Services.ContentSearch.ComputedFields.DynamicMetadata, DFS.Client.Services</field> <field fieldName="thumbHtmlTag" returnType="string">DFS.Client.Services.ContentSearch.ComputedFields.ThumbHtmlTag, DFS.Client.Services</field> <field fieldName="derivedFrom" returnType="string">DFS.Client.Services.ContentSearch.ComputedFields.DerivedFrom, DFS.Client.Services</field> </fields> </documentOptions> </DFS.ContentSearch.Solr.IndexConfiguration> </indexConfigurations> </contentSearch> </sitecore> </configuration> |
We have added some As you can see we added AddComputedIndexField
to show how to add new custom fields to the index, that runs som c# code to generate the values. Lets focus on the computedField DynamicMetadata
. With this one we can extract value for the fields.a specific metafield. Which metafield is defined by the attribute metafieldGuid
.
Her is an example of the data in solr:
...
You can download all the code examples configuration and c# files here:
View file | ||
---|---|---|
|
...