2013-02-27 91 views
2

我有一个关键字在他们的元数据模式中。该模式由两个字段组成,每个字段都是类别。结构非常简单,但在发布过程中它解决那些元数据关键字字段插入错误TCM的URI而不是关键字的标题,如下所示:enter image description here关键字在自定义meta中有不正确的值

2)部署包

<tcmc:Topic rdf:about="tcm:10-11325-1024"> 
     <rdfs:label>Analytics and optimization</rdfs:label> 
     <rdfs:comment>Analytics and optimization</rdfs:comment> 
     <tcmt:key>Analytics and optimization</tcmt:key> 
     <tcmt:isAbstract>false</tcmt:isAbstract> 
     <tcmt:isRoot>true</tcmt:isRoot> 
     <tcmt:metadata rdf:parseType="Literal"> 
     <Metadata xmlns="uuid:a30b06d3-b6c5-4c2e-a53b-2b88771370ed"> 
     <Divisions xlink:title="cma" xmlns:xlink="http://www.w3.org/1999/xlink"   xlink:href="tcm:0-17737-1024">cma</Divisions> 
     <InterestProfile xlink:title="CMAAnalytics" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="tcm:0-11175-1024">CMAAnalytics</InterestProfile> 
     </Metadata> 
    </tcmt:metadata> 
    </tcmc:Topic> 

3)的含量代码我在哪里查询Tridion它返回这些uris:

TaxonomyFactory taxonomyFactory = new TaxonomyFactory(); 
    TKeyword taxonomy = taxonomyFactory.GetTaxonomyKeywords(“tcm_of_the_category”); 
    if (taxonomy != null && taxonomy.KeywordChildren != null) 
    { 
     foreach (var item in taxonomy.KeywordChildren) //keyword metadata contains tcm uri with zero instead of title 
     { 
      Keyword keywordChildren = item as Keyword; 
      if (keywordChildren != null) 
      { 
       . . . 
      } 
     } 
    } 

有没有人有任何想法可能会导致这样的问题?

回答

3

我的猜测是,用于转换类别的内部模板是直接从数据库读取元数据字段数据(或接近BL层),并且不会对其应用任何蓝图规则性能)。

如果您查看TCM​​ Uris的内容,当它们存储在数据库中时,它们全都使用0作为它们的发布ID,并且此ID在“读取”时被修改。

你的电话:你可以称之为缺陷,要求Tridion修复它,它会降低发布类别的性能,或者你可以在交付方面处理它 - 你知道出版物Uri是0,并且如果您打算将其用于任何目的,则需要将其替换为当前的发布ID。

编辑

等我回去,做一些简单的黑客攻击。事实上,您无法加载关键字的内容,因为根据Tridion的说法,“Divisions”字段的“值”是关键字URI。没办法。

解决此

快速的方法:加载有问题的关键字:

TaxonomyFactory tf = new TaxonomyFactory(); 
Keyword taxonomy = tf.GetTaxonomyKeywords("tcm:5-369-512"); 
if(taxonomy != null && taxonomy.KeywordChildren != null) 
{ 
    foreach (Keyword item in taxonomy.KeywordChildren) 
    { 
     NameValuePair key = (NameValuePair) item.KeywordMeta.NameValues["Field1"]; 
     string correctUri = key.Value.ToString().Replace("tcm:0-", "tcm:5-"); 
     Keyword theOtherKeyword = tf.GetTaxonomyKeyword(correctUri); 
     string title = theOtherKeyword.KeywordName; 
    } 
} 

现在......你可能想成为比我聪明一点上创造性的发布ID改写:)

+0

谢谢你的回复,努诺。换句话说,就当前的Tridion实现而言,我无法在KeywordMeta字典中获得关键字的标题,对吗? KeywordMeta属性是否始终包含tcm uri,其关键字字段中包含零作为发布内容? – beardeddev 2013-02-27 14:09:02

+0

不知道我关注你。标题在元数据中。如果你想更多的控制这个,你将不得不编写自己的模板来将这些信息作为一个页面发布。这里的简短例子:http://nunolinhares.blogspot.com/2010/04/outputting-keyword-hierarchy-in-xml.html – 2013-02-27 14:15:42

+0

对不起,让我澄清一点。当我访问((NameValuePair)((关键字)项目).KeywordMeta.NameValues [“InterestProfile”])。它等于tcm uri的值(例如tcm:0-17786-1024),我想要标题而不是它。那可能吗? – beardeddev 2013-02-27 15:24:49

1

你可以请将该字段视为组件链接,然后链接到特定的关键字项目(对象)。因此,您主要获取URI,我认为它不会自动解析为Value属性。

因此,下一步是使用URI获取Keyword对象,并可能构造URI以包含正确的发布上下文。