1

我想创建一个驻留在 CMS 服务器上的 .NET 页面,该页面显示基于特定架构(tcm:3-3-8)和特定出版物(tcm:0-3-1)的所有组件,包括 BluePrinted和本地化项目,但前提是它们在该架构中的“URL”字段具有值“http://www.google.com”。

这是否可能,而不使用搜索服务,因为这相当慢且不可靠?

4

3 回答 3

2

由于未对搜索集合编制索引,您的搜索可能会很慢。

您应该定期索引搜索集合以获得更好和更快的结果。

于 2012-12-05T18:13:56.113 回答
1

这是一项昂贵的操作,因为打开每个单独的组件以检查字段的值的成本,但肯定是可行的。

  1. 获取架构对象
  2. 获取使用此架构的组件列表(架构上的 WhereUsed 与 ItemType = 组件上的过滤器)
  3. 打开每个组件并检查字段的值,List<Component>如果匹配则添加到
  4. 显示列表(可能使用 ASP.NET GridView)
于 2012-12-05T16:33:19.320 回答
0

我没有任何机会测试它,但是像这样

    Common common = new Common();
    TDSE tdse = new TDSE();
    ListRowFilter ComponentFilter = tdse.CreateListRowFilter();



    Schema schema = (Schema)common.getObject("tcm:126-238630-8", ItemType.ItemTypeSchema);
    ComponentFilter.SetCondition("ItemType", ItemType.ItemTypeComponent);
    ComponentFilter.SetCondition("Recursive", true);

    XDocument doc = common.ReadXML(schema.Info.GetListUsingItems(ListColumnFilter.XMLListID, ComponentFilter));
    List<Component> MatchedComponents = new List<Component>();

    XmlNamespaceManager NS = new XmlNamespaceManager(new NameTable());
    NS.AddNamespace("tcm", "http://www.tridion.com/ContentManager/5.0");
    NS.AddNamespace("Content", "uuid:4432F3C3-9F3E-45E4-AE31-408C5C46E2BF");
    foreach (XElement component in doc.XPathSelectElements("/tcm:ListUsingItems/tcm:Item", NS))
    {
        Component comp = common.getComponent(component.Attribute("ID").Value);

        XDocument compDoc = common.ReadXML(comp.GetXML(XMLReadFilter.XMLReadData));
        foreach (XElement compNode in compDoc.XPathSelectElements("/tcm:Component/tcm:Data/tcm:Content/Content:Content/Content:feederUrl", NS))
        {
            MatchedComponents.Add(comp);
        }
    }
于 2013-01-07T10:11:12.173 回答