如何在Tridion中的富文本字段的源选项卡内搜索内容

use*_*567 3 tridion tridion-2011

我目前正在使用以下代码在Tridion中搜索.它根据输入获取Items(Components和Pages).

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

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);
Run Code Online (Sandbox Code Playgroud)

vik*_*mar 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);
Run Code Online (Sandbox Code Playgroud)

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

BasedOnSchemaData basedSchemaNote = new BasedOnSchemaData();
    basedSchemaNote.Schema = new LinkToSchemaData() { IdRef = "tcm:XX-xxxx-8" };
    basedSchemaNote.Field = "FieldName";
    basedSchemaNote.FieldValue = "*SeachText*";
Run Code Online (Sandbox Code Playgroud)