diff --git a/AssemblyVersion.cs b/AssemblyVersion.cs index 66bc043..cc561f7 100644 --- a/AssemblyVersion.cs +++ b/AssemblyVersion.cs @@ -16,5 +16,5 @@ using System.Reflection; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("3.0.2.540")] -[assembly: AssemblyFileVersion("3.0.2.540")] +[assembly: AssemblyVersion("3.0.2.541")] +[assembly: AssemblyFileVersion("3.0.2.541")] diff --git a/Core/PagesStorageProvider.cs b/Core/PagesStorageProvider.cs index 982a4d2..6fb5fda 100644 --- a/Core/PagesStorageProvider.cs +++ b/Core/PagesStorageProvider.cs @@ -1188,22 +1188,28 @@ namespace ScrewTurn.Wiki { /// The number of indexed words, including duplicates. private int IndexPage(PageContent content) { lock(this) { - string documentName = PageDocument.GetDocumentName(content.PageInfo); + try { + string documentName = PageDocument.GetDocumentName(content.PageInfo); - DumpedDocument ddoc = new DumpedDocument(0, documentName, host.PrepareTitleForIndexing(content.PageInfo, content.Title), - PageDocument.StandardTypeTag, content.LastModified); + DumpedDocument ddoc = new DumpedDocument(0, documentName, host.PrepareTitleForIndexing(content.PageInfo, content.Title), + PageDocument.StandardTypeTag, content.LastModified); - // Store the document - // The content should always be prepared using IHost.PrepareForSearchEngineIndexing() - int count = index.StoreDocument(new PageDocument(content.PageInfo, ddoc, TokenizeContent), - content.Keywords, host.PrepareContentForIndexing(content.PageInfo, content.Content), null); + // Store the document + // The content should always be prepared using IHost.PrepareForSearchEngineIndexing() + int count = index.StoreDocument(new PageDocument(content.PageInfo, ddoc, TokenizeContent), + content.Keywords, host.PrepareContentForIndexing(content.PageInfo, content.Content), null); - if(count == 0 && content.Content.Length > 0) { - host.LogEntry("Indexed 0 words for page " + content.PageInfo.FullName + ": possible index corruption. Please report this error to the developers", - LogEntryType.Warning, null, this); + if(count == 0 && content.Content.Length > 0) { + host.LogEntry("Indexed 0 words for page " + content.PageInfo.FullName + ": possible index corruption. Please report this error to the developers", + LogEntryType.Warning, null, this); + } + + return count; + } + catch(Exception ex) { + host.LogEntry("Page indexing error for " + content.PageInfo.FullName + " (skipping page): " + ex.ToString(), LogEntryType.Error, null, this); + return 0; } - - return count; } } @@ -2389,25 +2395,31 @@ namespace ScrewTurn.Wiki { /// The number of indexed words, including duplicates. private int IndexMessage(PageInfo page, int id, string subject, DateTime dateTime, string body) { lock(this) { - // Trim "RE:" to avoid polluting the search engine index - if(subject.ToLowerInvariant().StartsWith("re:") && subject.Length > 3) subject = subject.Substring(3).Trim(); + try { + // Trim "RE:" to avoid polluting the search engine index + if(subject.ToLowerInvariant().StartsWith("re:") && subject.Length > 3) subject = subject.Substring(3).Trim(); - string documentName = MessageDocument.GetDocumentName(page, id); + string documentName = MessageDocument.GetDocumentName(page, id); - DumpedDocument ddoc = new DumpedDocument(0, documentName, host.PrepareTitleForIndexing(null, subject), - MessageDocument.StandardTypeTag, dateTime); + DumpedDocument ddoc = new DumpedDocument(0, documentName, host.PrepareTitleForIndexing(null, subject), + MessageDocument.StandardTypeTag, dateTime); - // Store the document - // The content should always be prepared using IHost.PrepareForSearchEngineIndexing() - int count = index.StoreDocument(new MessageDocument(page, id, ddoc, TokenizeContent), null, - host.PrepareContentForIndexing(null, body), null); + // Store the document + // The content should always be prepared using IHost.PrepareForSearchEngineIndexing() + int count = index.StoreDocument(new MessageDocument(page, id, ddoc, TokenizeContent), null, + host.PrepareContentForIndexing(null, body), null); - if(count == 0 && body.Length > 0) { - host.LogEntry("Indexed 0 words for message " + page.FullName + ":" + id.ToString() + ": possible index corruption. Please report this error to the developers", - LogEntryType.Warning, null, this); + if(count == 0 && body.Length > 0) { + host.LogEntry("Indexed 0 words for message " + page.FullName + ":" + id.ToString() + ": possible index corruption. Please report this error to the developers", + LogEntryType.Warning, null, this); + } + + return count; + } + catch(Exception ex) { + host.LogEntry("Message indexing error for " + page.FullName + ":" + id.ToString() + " (skipping message): " + ex.ToString(), LogEntryType.Error, null, this); + return 0; } - - return count; } } diff --git a/SqlProvidersCommon/SqlPagesStorageProviderBase.cs b/SqlProvidersCommon/SqlPagesStorageProviderBase.cs index 18dc9c5..0f4b0b8 100644 --- a/SqlProvidersCommon/SqlPagesStorageProviderBase.cs +++ b/SqlProvidersCommon/SqlPagesStorageProviderBase.cs @@ -592,22 +592,28 @@ namespace ScrewTurn.Wiki.Plugins.SqlCommon { /// The current transaction. /// The number of indexed words, including duplicates. private int IndexPage(PageContent content, DbTransaction transaction) { - string documentName = PageDocument.GetDocumentName(content.PageInfo); + try { + string documentName = PageDocument.GetDocumentName(content.PageInfo); - DumpedDocument ddoc = new DumpedDocument(0, documentName, host.PrepareTitleForIndexing(content.PageInfo, content.Title), - PageDocument.StandardTypeTag, content.LastModified); + DumpedDocument ddoc = new DumpedDocument(0, documentName, host.PrepareTitleForIndexing(content.PageInfo, content.Title), + PageDocument.StandardTypeTag, content.LastModified); - // Store the document - // The content should always be prepared using IHost.PrepareForSearchEngineIndexing() - int count = index.StoreDocument(new PageDocument(content.PageInfo, ddoc, TokenizeContent), - content.Keywords, host.PrepareContentForIndexing(content.PageInfo, content.Content), transaction); + // Store the document + // The content should always be prepared using IHost.PrepareForSearchEngineIndexing() + int count = index.StoreDocument(new PageDocument(content.PageInfo, ddoc, TokenizeContent), + content.Keywords, host.PrepareContentForIndexing(content.PageInfo, content.Content), transaction); - if(count == 0 && content.Content.Length > 0) { - host.LogEntry("Indexed 0 words for page " + content.PageInfo.FullName + ": possible index corruption. Please report this error to the developers", - LogEntryType.Warning, null, this); + if(count == 0 && content.Content.Length > 0) { + host.LogEntry("Indexed 0 words for page " + content.PageInfo.FullName + ": possible index corruption. Please report this error to the developers", + LogEntryType.Warning, null, this); + } + + return count; + } + catch(Exception ex) { + host.LogEntry("Page indexing error for " + content.PageInfo.FullName + " (skipping page): " + ex.ToString(), LogEntryType.Error, null, this); + return 0; } - - return count; } /// @@ -647,25 +653,31 @@ namespace ScrewTurn.Wiki.Plugins.SqlCommon { /// The current transaction. /// The number of indexed words, including duplicates. private int IndexMessage(PageInfo page, int id, string subject, DateTime dateTime, string body, DbTransaction transaction) { - // Trim "RE:" to avoid polluting the search engine index - if(subject.ToLowerInvariant().StartsWith("re:") && subject.Length > 3) subject = subject.Substring(3).Trim(); + try { + // Trim "RE:" to avoid polluting the search engine index + if(subject.ToLowerInvariant().StartsWith("re:") && subject.Length > 3) subject = subject.Substring(3).Trim(); - string documentName = MessageDocument.GetDocumentName(page, id); + string documentName = MessageDocument.GetDocumentName(page, id); - DumpedDocument ddoc = new DumpedDocument(0, documentName, host.PrepareTitleForIndexing(null, subject), - MessageDocument.StandardTypeTag, dateTime); + DumpedDocument ddoc = new DumpedDocument(0, documentName, host.PrepareTitleForIndexing(null, subject), + MessageDocument.StandardTypeTag, dateTime); - // Store the document - // The content should always be prepared using IHost.PrepareForSearchEngineIndexing() - int count = index.StoreDocument(new MessageDocument(page, id, ddoc, TokenizeContent), null, - host.PrepareContentForIndexing(null, body), transaction); + // Store the document + // The content should always be prepared using IHost.PrepareForSearchEngineIndexing() + int count = index.StoreDocument(new MessageDocument(page, id, ddoc, TokenizeContent), null, + host.PrepareContentForIndexing(null, body), transaction); - if(count == 0 && body.Length > 0) { - host.LogEntry("Indexed 0 words for message " + page.FullName + ":" + id.ToString() + ": possible index corruption. Please report this error to the developers", - LogEntryType.Warning, null, this); + if(count == 0 && body.Length > 0) { + host.LogEntry("Indexed 0 words for message " + page.FullName + ":" + id.ToString() + ": possible index corruption. Please report this error to the developers", + LogEntryType.Warning, null, this); + } + + return count; + } + catch(Exception ex) { + host.LogEntry("Message indexing error for " + page.FullName + ":" + id.ToString() + " (skipping message): " + ex.ToString(), LogEntryType.Error, null, this); + return 0; } - - return count; } /// diff --git a/SqlServerProviders/SqlServerPagesStorageProvider.cs b/SqlServerProviders/SqlServerPagesStorageProvider.cs index d691706..d73c2bf 100644 --- a/SqlServerProviders/SqlServerPagesStorageProvider.cs +++ b/SqlServerProviders/SqlServerPagesStorageProvider.cs @@ -13,7 +13,7 @@ namespace ScrewTurn.Wiki.Plugins.SqlServer { /// public class SqlServerPagesStorageProvider : SqlPagesStorageProviderBase, IPagesStorageProviderV30 { - private readonly ComponentInformation info = new ComponentInformation("SQL Server Pages Storage Provider", "Threeplicate Srl", "3.0.1.471", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/SQLServerProv/Pages.txt"); + private readonly ComponentInformation info = new ComponentInformation("SQL Server Pages Storage Provider", "Threeplicate Srl", "3.0.1.541", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/SQLServerProv/Pages.txt"); private readonly SqlServerCommandBuilder commandBuilder = new SqlServerCommandBuilder();