Hi Alex,
Thanks for confirming this (I had stumbled across this article after I posted) but am struggling to get this to work as the documentation is a bit confusing.
I have writtien a custom Document mapper below:
public class MyDocumentMapper : DocumentMapper
{
public override void Load()
{
Map<MyType>(mytype=>
{
mytype.MyTypeId.MapTo(SearchFields.ContentID).Key();
mytype.MyTypeTitle.MapTo(SearchFields.Title);
mytype.MyTypeDesc.MapTo(SearchFields.Content);
mytype.MyTypeDate.MapTo(SearchFields.Date);
});
Rehydrate<MyType>(mytype=> MyType.GetTypeById(mytypeid));
}
public override int Priority
{
get { return 10; }
}
MyType class is as follows:
public class MyType
{
public string MyTypeId{ get; set; }
public string MyTypeTitle{ get; set; }
public string MyTypeDesc{ get; set; }
public string MyTypeDate{ get; set; }
public static MyType GetTypeById(object MyTypeId)
{
MyType mytype= new MyType();
mytype.MyTypeId= "1";
mytype.MyTypeTitle= "Test Rehydrate Title";
mytype.MyTypeDesc= "Test Rehydrate Desc";
mytype.MyTypeDate= "14/06/1982";
return mytype;
}
}
I have added the following to the CommunityServer.config Index Task to register my mapper:
<handler type="BBCommunity.Extensions.MyDocumentMapper, BBCommunity.Extensions" />
The indexing job seems to be trying to apply my mapper, however I get an error in the event logs about the indexing job erroring:
Error occurred while running background task SearchIndexJob
System.NullReferenceException: Object reference not set to an
instance of an object.
at
Telligent.Search.Mapping.ContentHandlerTask.Execute()
at
Telligent.Tasks.Task.ExecuteTask()
I am not sure where to look first as I don't know which part of the code is throwing the "object refernce error" and don't really undestand how the search index task know which items in SOLR to use this mapping on or how it does this (AppType? maybe). Obvioulsly I just want to apply this to my custom documents.
Please can you explain a little further and let me know if I am doing anything wrong here so I can progress with this?
Thanks
Adam