Ich habe 10 Artikel Inhaltselemente und jeder Artikel Artikel hat eine Beiträger PrüflisteSitecores Suche Facetten und Berechnete Felder
ich Mitwirkende Facet für Facettensuche im Editor erstellt haben. Checklistenwerte werden jedoch als String-IDs indiziert.
Jetzt auf Seite Suchergebnis der Facettenwerte als String-IDs erscheinen. Ich habe einen ComputedField indiziert die Anzeigenamen
public class Contributors : IComputedIndexField
{
public object ComputeFieldValue(IIndexable indexable)
{
var item = indexable as SitecoreIndexableItem;
if (item == null || item.Item == null) return string.Empty;
StringBuilder ContributorsNameList = new StringBuilder();
IIndexableDataField cField = indexable.GetFieldByName("Contributors");
if (cField != null)
{
var cList = cField.Value.ToString().Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).ToList();
foreach (var cId in cList)
{
var cItem = item.Item.Database.GetItem(new ID(cId));
if (cItem != null)
ContributorsNameList.Append(cItem.Name.ToString());
}
return ContributorsNameList;
}
return null;
}
public string FieldName { get; set; }
public string ReturnType { get; set; }
}
und Konfigurationsdatei
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<configuration>
<defaultIndexConfiguration>
<fields hint="raw:AddComputedIndexField">
<field fieldName="tagsfacet" storageType="yes" indexType="untokenized"> Sandbox.SitecoreCustomizations.ComputedIndexFields.TagsFacet, Sandbox</field>
</fields>
<fields hint="raw:AddFieldByFieldName">
<field fieldName="tagsfacet" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
<Analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.LowerCaseKeywordAnalyzer, Sitecore.ContentSearch.LuceneProvider" />
</field>
</fields>
</defaultIndexConfiguration>
</configuration>
</contentSearch>
</sitecore>
</configuration>
erstellt, aber jetzt immer sowohl die IDs und Namen (vorkommende zweimal)

Haben Sie versucht, einen Breakpoint zu setzen oder 'Log.Info' zu Ihrem Code hinzuzufügen, um zu debuggen, was er zurückgibt? Sie müssen 'tagsFacet' nicht in den Abschnitten' AddComputedField' und 'AddFieldByFieldName' hinzufügen. 'AddComputedField' sollte ausreichen. Hast du auch nachgesehen, wie groß das Feld 'tagsFacet' in Luke ist? Ich sehe nur einen Screenshot von dem, was sich im Feld "Mitwirkende" befindet. –