3

我目前正在使用以下代码在 Tridion 中进行搜索。它根据输入获取项目(组件和页面)。

问题:在富文本字段中,我们有设计、源代码和预览选项卡。以下代码仅搜索“设计”选项卡中存在的内容。在执行搜索时,我还需要考虑源选项卡内容。

CoreServiceSession client = new CoreServiceSession();
SessionAwareCoreServiceClient csClient = client.GetClient();

var find = new SearchQueryData
{
  Description  = "Universe"
  ItemTypes = new ItemType[] { ItemType.Page, ItemType.Component }
);

IdentifiableObjectData[] foundItems = csClient.GetSearchResults(find);
4

1 回答 1

5

你试过FullTextQuery

CoreServiceSession client = new CoreServiceSession();
SessionAwareCoreServiceClient csClient = client.GetClient();
ReadOptions readoption = new ReadOptions();

var find = new SearchQueryData
{
Description  = "Universe"
FullTextQuery= "Universe"
ItemTypes = new ItemType[] { ItemType.Component }
);

IdentifiableObjectData[] foundItems = csClient.GetSearchResults(find);

由于 FullTextQuery 会影响您的 CMS 性能,您可能希望它仅限于特定的架构组件字段。

BasedOnSchemaData basedSchemaNote = new BasedOnSchemaData();
    basedSchemaNote.Schema = new LinkToSchemaData() { IdRef = "tcm:XX-xxxx-8" };
    basedSchemaNote.Field = "FieldName";
    basedSchemaNote.FieldValue = "*SeachText*";
于 2012-10-12T07:41:04.423 回答