Hi
I'm trying to figure out why my use of NHibernate.Search and Lucene
causes timeouts for requests.
I've followed the steps in using.castleproject for how to use
NHibernate.Search with AR but that procedure caused even slower
creates and updates than the current one I use.
The old one was like this and it was complete crap.
page.Content=page.Title+" "+Regex.Replace(page.HtmlContent, "</?[a-z]
[a-z0-9]*[^<>]*>", " ");
page.Save()
This is how I currently do it. I had to add more stuff because the
extreme slowness and timeout requests didn't go away until I did it
like this.
using(new SessionScope())
{
page.Content=page.Title+"
"+Regex.Replace(page.HtmlContent, "</?[a-z][a-z0-9]*[^<>]*>", " ");
if (page.Id == 0)
ActiveRecordMediator.Create(page);
else
{
ActiveRecordMediator.Update(page);
var session =
ActiveRecordMediator.GetSessionFactoryHolder().CreateSession(typeof
(UserPage));
// Create a Full Text session
var fullTextSession =
Search.CreateFullTextSession(session);
fullTextSession.Index(page);
ActiveRecordMediator.GetSessionFactoryHolder().ReleaseSession(session);
}
}
This is how the page class looks, Added store.no in an attempt lower
timeouts. But it is the default value I later realised.
[ActiveRecord("userpages")]
[Indexed(Index="UserPages")]
public class UserPage:ActiveRecordBase<UserPage>
{
[PrimaryKey]
[DocumentId]
public int Id { get; set; }
[Field(Index.Tokenized, Store = Store.No)]
[Analyzer(typeof(StandardAnalyzer))]
[Property]
public string Title { get; set; }
[BelongsTo]
public User Owner { get; set; }
[Property(Index = "userpageauthor")]
[Field(Index.Tokenized, Store = Store.No)]
[Analyzer(typeof(StandardAnalyzer))]
public string OwnerScreenname { get; set; }
[Field(Index.Tokenized, Store = Store.No)]
[Analyzer(typeof(StandardAnalyzer))]
public string Content { get; set; }
[Property]
public string HtmlContent { get; set; }
[Property]
public DateTime Altered { get; set; }
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---