Sitecore 항목이 아닌 Sitecore 사용자를 색인하려고합니다.비 Sitecore 항목 (예 : 사용자)의 색인을 만들기 위해 Sitecore 7에서 사용자 지정 색인을 만드는 방법
다른 Sitecore 항목의 다른 필드를 결합하는 사용자 지정 인덱스를 만드는 경우와 동일한 방법으로 그 작업을 수행 할 수 있습니다. 일종의 데이터 제공 업체/저장소에서 반환 한 데이터가 있다고 가정하고이 데이터를 생성, 구성 및 색인화하는 방법을 설명합니다.
은 이미이 인덱스에 대한 몇 가지 구성을 작성했습니다 :
<configuration type="Sitecore.ContentSearch.LuceneProvider.LuceneSearchConfiguration, Sitecore.ContentSearch.LuceneProvider">
<indexes hint="list:AddIndex">
<index id="custom_user_index" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider">
<param desc="name">$(id)</param>
<param desc="folder">$(id)</param>
<!-- This initializes index property store. Id has to be set to the index id -->
<!--<param desc="propertyStore" ref="contentSearch/databasePropertyStore" param1="$(id)" />-->
<commitPolicyExecutor type="Sitecore.ContentSearch.CommitPolicyExecutor, Sitecore.ContentSearch">
<policies hint="list:AddCommitPolicy">
<policy type="Sitecore.ContentSearch.TimeIntervalCommitPolicy, Sitecore.ContentSearch" />
</policies>
</commitPolicyExecutor>
<locations hint="list:AddCrawler">
<crawler type="PT.Forum.Framework.Users.Infrastructure.UserCrawler, PT.Forum.Framework.Users"/>
</locations>
</index>
</indexes>
</configuration>
내 크롤러는이 작업을 수행합니다
public class UserCrawler : AbstractProviderCrawler
{
public override void Initialize(ISearchIndex index)
{
Assert.ArgumentNotNull(index, "index");
Database = "web";
Assert.IsNotNull(Database, "Database element not set.");
Assert.IsNotNull(Root, "Root element not set.");
base.Initialize(index);
LuceneIndex index2 = index as LuceneIndex;
if (Operations == null)
{
Operations = new LuceneIndexOperations(index2);
CrawlingLog.Log.Info(string.Format("[Index={0}] Initializing LuceneDatabaseCrawler. DB:{1}/Root:{2}", index.Name, Database, Root));
}
var users = new UserRepository().GetByConstraint(UserRepositoryContraints.IsNejTakPlusUser);
index.Configuration = new LuceneIndexConfiguration();
var updateContext = index.CreateUpdateContext();
Operations.Add(new ForumUser(users.First()), updateContext, index.Configuration);
}
}
는 그러나 인덱스 구성은 null입니다.
Sitecore 7의 색인 생성 메커니즘에 대한 블로그 게시물을 작성했습니다. 아마도 도움이 될 것입니다. http://www.partechit.nl/ko/blog/2013/04/sitecore-7-in-depth- 인덱싱 - 역학 –
내 문제는 블로그 게시물의 "3.3.1 특수 필드"부분과 관련이 있습니다. 모든 필드에 대해 기록 된 AddComputedIndexFields() 메서드에서 오류가 발생하기 때문에 Aparently 모든 computedIndexFields는 null입니다. –