I am a bit late but something like this might work.
public class ExamineEvents : ApplicationBase
{
public ExamineEvents()
{
ExamineManager.Instance.IndexProviderCollection["indexername"].GatheringNodeData += ExamineEvents_GatheringNodeData;
}
void ExamineEvents_GatheringNodeData(object sender, IndexingNodeDataEventArgs e)
{
if (e.IndexType == IndexTypes.Content)
{
if (n.NodeTypeAlias == "somenodetype")
{
// do some logic to work out the values
e.Fields.Add("CustomField", Values );
}
}
}
}
UmbracoExamine clarification creating a custom field in lucene index
Can we create a custom field in Lucene Index file that is created by Umbraco Examine?
Lets say i need to create a custom field named "CONTENT" that should contain all the tokenized string/word of UserFields in umbraco documents.
ForExample
NodeTypeAlias: AboutUs
Contains UserFields: Field1, Field2, Field3
UserFields contains LONG text that need to be tokenized.
Tokenized words needs to be stored ONLY in lucene index custom column "CONTENT"
CONTENT should contain all the TOKENIZED word, so that i can execute a lucene query like CONTENT:searchword
GroupBy NodeId and then i can get the desired nodes and display to the users search results page.
Is that possible to define a custom field using UmbracoExamine and direct the userfields tokenized words only to the one custom field in lucene index?
I am a bit late but something like this might work.
public class ExamineEvents : ApplicationBase { public ExamineEvents() { ExamineManager.Instance.IndexProviderCollection["indexername"].GatheringNodeData += ExamineEvents_GatheringNodeData; } void ExamineEvents_GatheringNodeData(object sender, IndexingNodeDataEventArgs e) { if (e.IndexType == IndexTypes.Content) { if (n.NodeTypeAlias == "somenodetype") { // do some logic to work out the values e.Fields.Add("CustomField", Values ); } } } }
bharth,
like travis's code however where you have e.fields.add call the following method:
eg
AddToContentsField(e);
that will take all your fields defined and contenate them to one field called contents that you can search on. I did for site i built.
Regards
Ismail
is working on a reply...