Esempio 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;
        }
Esempio n. 2
0
 public static void UpdateArticle(Article article)
 {
     System.Threading.Thread thread = new System.Threading.Thread(UpdateArticleThreadProc);
     thread.Start(article);
 }
		private void attach_Articles(Article entity)
		{
			this.SendPropertyChanging();
			entity.Section = this;
		}
		private void detach_Articles(Article entity)
		{
			this.SendPropertyChanging();
			entity.Section = null;
		}
 partial void DeleteArticle(Article instance);
 partial void UpdateArticle(Article instance);
 partial void InsertArticle(Article instance);
		private void detach_Articles1(Article entity)
		{
			this.SendPropertyChanging();
			entity.aspnet_User1 = null;
		}
		private void attach_Articles(Article entity)
		{
			this.SendPropertyChanging();
			entity.aspnet_User = this;
		}