I need to create a custom user field that I need to be indexed for search (I'm doing a faceted search using Xuntos).
I've tried creating a custom field using the ExamineEventHandler and the GatheringNodeData function, it all appears to work fine on the surface - however when I rebuild the index I don't see the the new field in the users fields table. But when I search I can see it has been indexed - how to I get my custom field to appear in the list?
Heres my code:-
private void ExamineEventHandler_GatheringNodeData(object sender, IndexingNodeDataEventArgs e)
{
if (e.IndexType != UmbracoExamine.IndexTypes.Content)
return;
var fields = e.Fields;
var tagKey = new StringBuilder();
foreach (var field in fields)
{
try
{
if (field.Key == "npt")
{
if (!string.IsNullOrEmpty(field.Value))
{
var array = field.Value;
List<string> tmp = Regex.Replace(array, "[^0-9a-zA-Z/,]+", "").Split(',').ToList();
foreach (var tag in tmp)
{
tagKey.Append(tag + ",");
}
}
}
}
catch (Exception ex)
{
// Do nothing
}
}
// Add field to index
e.Fields.Add("nptLocations", tagKey.ToString().TrimEnd(','));
}
Indexing Custom User fields in Examine
Hello,
I need to create a custom user field that I need to be indexed for search (I'm doing a faceted search using Xuntos).
I've tried creating a custom field using the ExamineEventHandler and the GatheringNodeData function, it all appears to work fine on the surface - however when I rebuild the index I don't see the the new field in the users fields table. But when I search I can see it has been indexed - how to I get my custom field to appear in the list?
Heres my code:-
is working on a reply...