Beispiel #1
0
        public static string ReIndexProjects()
        {
            Businesslogic.Indexer i = new Businesslogic.Indexer();
            new EventHandlers.ProjectHandler().Indexer_AfterReIndex(i, new Businesslogic.ReIndexEventArgs());

            return("");
        }
Beispiel #2
0
        public static string ReIndexVideo()
        {
            Businesslogic.Indexer i = new Businesslogic.Indexer();
            //new EventHandlers.Video().Indexer_AfterReIndex(i, new Businesslogic.ReIndexEventArgs());

            return("");
        }
Beispiel #3
0
        public void Indexer_AfterReIndex(object sender, uSearch.Businesslogic.ReIndexEventArgs e)
        {
            Businesslogic.Indexer        i  = (Businesslogic.Indexer)sender;
            Lucene.Net.Index.IndexWriter iw = i.ContentIndex(false);


            umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "Re-indexing projects");
            try {
                int projectRoot         = 1113;
                XPathNodeIterator pages = umbraco.library.GetXmlNodeById(projectRoot.ToString()).Current.Select(".//node [@nodeTypeAlias = 'Project']");

                //umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, pages.Current.OuterXml);

                while (pages.MoveNext())
                {
                    if (pages.Current is IHasXmlNode)
                    {
                        XmlNode node = ((IHasXmlNode)pages.Current).GetNode();

                        string key = "project_" + node.Attributes["id"].Value;

                        Hashtable fields = new Hashtable();

                        fields.Add("id", node.Attributes["id"].Value);
                        fields.Add("name", node.Attributes["nodeName"].Value);

                        fields.Add("content", umbraco.library.StripHtml(umbraco.xmlHelper.GetNodeValue(node.SelectSingleNode("data [@alias = 'description']"))));
                        fields.Add("path", (node.Attributes["path"].Value.Replace("-1,", "").Replace(",", i.IndexerSettings.PathSplit)));


                        i.AddToIndex(key, "project", fields, iw);
                    }
                }
            } catch (Exception ex) {
                //umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString());
            }

            umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "Re-indexing projects - DONE");
            iw.Optimize();
            iw.Close();
            //umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "Wiki index done");
        }
Beispiel #4
0
        public void Indexer_AfterReIndex(object sender, Businesslogic.ReIndexEventArgs e)
        {
            Businesslogic.Indexer        i  = (Businesslogic.Indexer)sender;
            Lucene.Net.Index.IndexWriter iw = i.ContentIndex(false);

            try
            {
                umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "Re-indexing Video");

                string            url = "http://umbraco.org/FullVideoXmlFeed.aspx";
                XPathNodeIterator xni = umbraco.library.GetXmlDocumentByUrl(url, 3600).Current.Select("//item");

                while (xni.MoveNext())
                {
                    string content = umbraco.library.StripHtml(xni.Current.SelectSingleNode("./content").Value);
                    string name    = xni.Current.SelectSingleNode("./title").Value;
                    string image   = xni.Current.SelectSingleNode("./image").Value;
                    string id      = xni.Current.SelectSingleNode("./id").Value;
                    string link    = xni.Current.SelectSingleNode("./link").Value;

                    Hashtable fields = new Hashtable();

                    fields.Add("name", name);
                    fields.Add("content", content);
                    fields.Add("image", image);
                    fields.Add("id", id);
                    fields.Add("url", link);

                    i.AddToIndex("video_" + id.ToString(), "videos", fields, iw);

                    umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "adding " + name + " video");
                }
            } catch (Exception ex) {
                umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString());
            }

            umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "Re-indexing videos - DONE");


            iw.Optimize();
            iw.Close();
        }
Beispiel #5
0
        public void Indexer_AfterReIndex(object sender, uSearch.Businesslogic.ReIndexEventArgs e)
        {
            Businesslogic.Indexer i  = (uSearch.Businesslogic.Indexer)sender;
            IndexWriter           iw = i.ContentIndex(false);

            umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "Re-indexing forum posts");

            try {
                List <Forum> forums = uForum.Businesslogic.Forum.Forums();
                foreach (Forum f in forums)
                {
                    try{
                        foreach (Topic t in Topic.TopicsInForum(f.Id))
                        {
                            Hashtable fields = new Hashtable();

                            fields.Add("id", t.Id.ToString());
                            fields.Add("name", t.Title);
                            fields.Add("author", t.MemberId.ToString());
                            fields.Add("content", umbraco.library.StripHtml(t.Body));

                            i.AddToIndex("topic_" + t.Id.ToString(), "forumTopics", fields, iw);
                        }
                    }catch (Exception ex) {
                        umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString());
                    }
                }
            } catch (Exception ex) {
                umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString());
            }

            umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "Re-indexing forum posts - DONE");

            iw.Optimize();
            iw.Close();
        }
Beispiel #6
0
        public static string ReIndexWiki()
        {
            Businesslogic.Indexer i = new Businesslogic.Indexer();
            new EventHandlers.WikiHandler().Indexer_AfterReIndex(i, new Businesslogic.ReIndexEventArgs());

            return "";
        }