var query = searchCritera.Field("nodeTypeAlias", nodeType).And().Field("nodeName", nodeName).Compile();
So if I did a search for Country = England I get that node back no problem, but I also want to get all locations under England at the same time in the Examine search.
But I also want to be able to search Country = UK I would want to get everything under that.
How about when indexing a (Location) node, you also also add the details of all it's ancestor (Country) nodes, (so that this data is available with that item).
public class IndexLocations : ApplicationBase
{
public IndexLocations()
{
ExamineManager.Instance.IndexProviderCollection["indexerName"].GatheringNodeData += new EventHandler(this.IndexLocations_GatheringNodeData);
}
private void IndexLocations_GatheringNodeData(object sender, IndexingNodeDataEventArgs e)
{
Node indexingNode = uQuery.GetNode(e.NodeId);
if (indexingNode != null && indexingNode.NodeTypeAlias == "Location")
{
StringBuilder countries = new StringBuilder();
foreach(Node countryNode in indexingNode.GetAcnestorNodes().Where(x => x.nodeTypeAlias == "Country"))
{
countries.Append(countryNode.Text + " "); // or the details you want to search that country on
}
e.Fields.Add("Countries", countries.ToString().TrimEnd());
}
}
}
Examine search - get children in results
Hi All,
I've implemented an Examine search and retrieving my results, but I also what to get the child nodes of the results I've found.
So for example my content is like so (node alias in brackets):
My query is like so:
So if I did a search for Country = England I get that node back no problem, but I also want to get all locations under England at the same time in the Examine search.
But I also want to be able to search Country = UK I would want to get everything under that.
Any ideas greatly appreciated.
Thanks,
Tom
Hi Tom,
How about when indexing a (Location) node, you also also add the details of all it's ancestor (Country) nodes, (so that this data is available with that item).
HTH,
Hendy
Hey Hendy,
Cheers bud, that works a treat.
Thanks,
Tom
is working on a reply...