Ejemplo n.º 1
0
        public static Document ArticleToDocument(Article article)
        {
            // Build the fields to be indexed
            string content = article.IntroText + System.Environment.NewLine + article.Content;
            string intro = content.Substring(0, content.Length > 100 ? 100 : content.Length);
            MembershipUser user = Membership.GetUser(article.CreatedBy);
            string author = user.UserName;
            string strPubDate = DateTools.DateToString(article.DateCreated, DateTools.Resolution.DAY);

            Document doc = new Document();
            doc.Add(new Field("ArticleId", article.ArticleId.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED));
            doc.Add(new Field("Title", article.Title, Field.Store.YES, Field.Index.ANALYZED));
            doc.Add(new Field("Content", content, Field.Store.NO, Field.Index.ANALYZED));
            doc.Add(new Field("Intro", intro, Field.Store.YES, Field.Index.NO));
            doc.Add(new Field("Author", author, Field.Store.YES, Field.Index.NO));
            doc.Add(new Field("SectionId", article.SectionId.ToString(), Field.Store.NO, Field.Index.NOT_ANALYZED));
            doc.Add(new Field("Published", article.Published.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED));
            doc.Add(new Field("PubDate", strPubDate, Field.Store.YES, Field.Index.NOT_ANALYZED));

            return doc;
        }
Ejemplo n.º 2
0
 public static void UpdateArticle(Article article)
 {
     System.Threading.Thread thread = new System.Threading.Thread(UpdateArticleThreadProc);
     thread.Start(article);
 }
Ejemplo n.º 3
0
		private void attach_Articles(Article entity)
		{
			this.SendPropertyChanging();
			entity.Section = this;
		}
Ejemplo n.º 4
0
		private void detach_Articles(Article entity)
		{
			this.SendPropertyChanging();
			entity.Section = null;
		}
Ejemplo n.º 5
0
 partial void DeleteArticle(Article instance);
Ejemplo n.º 6
0
 partial void UpdateArticle(Article instance);
Ejemplo n.º 7
0
 partial void InsertArticle(Article instance);
Ejemplo n.º 8
0
		private void detach_Articles1(Article entity)
		{
			this.SendPropertyChanging();
			entity.aspnet_User1 = null;
		}
Ejemplo n.º 9
0
		private void attach_Articles(Article entity)
		{
			this.SendPropertyChanging();
			entity.aspnet_User = this;
		}