我想创建一个驻留在服务器上的.NET页面,显示基于特定模式(tcm:3-3-8)和来自特定出版物(tcm:0-3-1)的所有组件,包括BluePrinted和本地化项目,但前提是它们在该模式中的字段"URL“具有"http://www.google.com”值。
这是可能的,而不使用搜索服务,因为这是相当慢和不可靠的?
发布于 2012-12-06 02:13:56
您的搜索可能会因为没有索引搜索集合而变得很慢。
您应该定期对搜索集合进行索引,以获得更好、更快的结果。
发布于 2012-12-06 00:33:19
这是一个昂贵的操作,因为打开每个单独的组件来检查字段的值的成本,但肯定是可以做到的。
List<Component>发布于 2013-01-07 18:11:12
我还没有机会测试它,但是像这样的东西
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);
}
}https://stackoverflow.com/questions/13727782
复制相似问题