我想创建一个驻留在CMS服务器上的.NET页面,该页面显示基于特定架构(tcm:3-3-8)和特定出版物(tcm:0-3-1)的所有组件)包括BluePrinted和Localized项目,但前提是该模式中的字段“URL”的值为“http://www.google.com”。
这是否可行,而不使用搜索服务,因为这是相当缓慢和不可靠的?
答案 0 :(得分:2)
由于未对搜索集合编制索引,您的搜索可能会很慢。
您应该定期为搜索集合建立索引,以获得更好,更快的结果。
答案 1 :(得分:1)
这是一项昂贵的操作,因为打开每个组件以检查字段值的成本,但肯定可行。
List<Component>
答案 2 :(得分: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);
}
}