public void ProcessNode(IndexWriter writer, Node node) { Document document = new Document(); document.Add(new Field("Type", "Node", Field.Store.YES, Field.Index.NO)); document.Add(new Field("ID", node.Id.ToString(), Field.Store.YES, Field.Index.NO)); document.Add(new Field("Name", node.Name, Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.YES)); document.Add(new Field("CourseID", node.CourseId.ToString(), Field.Store.YES, Field.Index.ANALYZED)); document.Add(new Field("isFolder", node.IsFolder.ToString(), Field.Store.YES, Field.Index.ANALYZED)); if (node.IsFolder) { GetNodesMessage message = new GetNodesMessage { Input = new GetNodesInput { CourseId = node.CourseId, ParentId = node.Id } }; MvcContrib.Bus.Send(message); List <Node> nodes = (message.Result.Data as List <Node>); foreach (Node childNode in nodes) { ProcessNode(writer, childNode); } } else { GetNodeContentsMessage message = new GetNodeContentsMessage { Input = node.Id }; MvcContrib.Bus.Send(message); document.Add(new Field("Content", (message.Result.Data as string), Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.YES)); } writer.AddDocument(document); }
public void ProcessNode(IndexWriter writer, Node node) { Document document = new Document(); document.Add(new Field("Type", "Node", Field.Store.YES, Field.Index.NO)); document.Add(new Field("ID", node.Id.ToString(), Field.Store.YES, Field.Index.NO)); document.Add(new Field("Name", node.Name, Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.YES)); document.Add(new Field("CourseID", node.CourseId.ToString(), Field.Store.YES, Field.Index.ANALYZED)); document.Add(new Field("isFolder", node.IsFolder.ToString(), Field.Store.YES, Field.Index.ANALYZED)); if (node.IsFolder) { GetNodesMessage message = new GetNodesMessage { Input = new GetNodesInput {CourseId = node.CourseId, ParentId = node.Id} }; MvcContrib.Bus.Send(message); List<Node> nodes = (message.Result.Data as List<Node>); foreach (Node childNode in nodes) { ProcessNode(writer, childNode); } } else { GetNodeContentsMessage message = new GetNodeContentsMessage { Input = node.Id }; MvcContrib.Bus.Send(message); document.Add(new Field("Content", (message.Result.Data as string), Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.YES)); } writer.AddDocument(document); }