[completed: 594] Tentatively fixed issue occurring when trying to index a page with empty title or content.

This commit is contained in:
Dario Solera 2011-04-22 17:33:11 +02:00
parent 7e9f87853e
commit f16f67cff2
4 changed files with 11 additions and 3 deletions

View file

@ -593,6 +593,8 @@ namespace ScrewTurn.Wiki.Plugins.SqlCommon {
/// <returns>The number of indexed words, including duplicates.</returns>
private int IndexPage(PageContent content, DbTransaction transaction) {
try {
if(string.IsNullOrEmpty(content.Title) || string.IsNullOrEmpty(content.Content)) return 0;
string documentName = PageDocument.GetDocumentName(content.PageInfo);
DumpedDocument ddoc = new DumpedDocument(0, documentName, host.PrepareTitleForIndexing(content.PageInfo, content.Title),
@ -654,6 +656,8 @@ namespace ScrewTurn.Wiki.Plugins.SqlCommon {
/// <returns>The number of indexed words, including duplicates.</returns>
private int IndexMessage(PageInfo page, int id, string subject, DateTime dateTime, string body, DbTransaction transaction) {
try {
if(string.IsNullOrEmpty(subject) || string.IsNullOrEmpty(body)) return 0;
// Trim "RE:" to avoid polluting the search engine index
if(subject.ToLowerInvariant().StartsWith("re:") && subject.Length > 3) subject = subject.Substring(3).Trim();