Page and message indexing is now more robust and pages that cannot be indexed are skipped.

This commit is contained in:
Dario Solera 2010-05-30 06:29:13 +00:00
parent 4a91270ff1
commit 44311ba307
4 changed files with 79 additions and 55 deletions

View file

@ -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")]

View file

@ -1188,6 +1188,7 @@ namespace ScrewTurn.Wiki {
/// <returns>The number of indexed words, including duplicates.</returns>
private int IndexPage(PageContent content) {
lock(this) {
try {
string documentName = PageDocument.GetDocumentName(content.PageInfo);
DumpedDocument ddoc = new DumpedDocument(0, documentName, host.PrepareTitleForIndexing(content.PageInfo, content.Title),
@ -1205,6 +1206,11 @@ namespace ScrewTurn.Wiki {
return count;
}
catch(Exception ex) {
host.LogEntry("Page indexing error for " + content.PageInfo.FullName + " (skipping page): " + ex.ToString(), LogEntryType.Error, null, this);
return 0;
}
}
}
/// <summary>
@ -2389,6 +2395,7 @@ namespace ScrewTurn.Wiki {
/// <returns>The number of indexed words, including duplicates.</returns>
private int IndexMessage(PageInfo page, int id, string subject, DateTime dateTime, string body) {
lock(this) {
try {
// Trim "RE:" to avoid polluting the search engine index
if(subject.ToLowerInvariant().StartsWith("re:") && subject.Length > 3) subject = subject.Substring(3).Trim();
@ -2409,6 +2416,11 @@ namespace ScrewTurn.Wiki {
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;
}
}
}
/// <summary>

View file

@ -592,6 +592,7 @@ namespace ScrewTurn.Wiki.Plugins.SqlCommon {
/// <param name="transaction">The current transaction.</param>
/// <returns>The number of indexed words, including duplicates.</returns>
private int IndexPage(PageContent content, DbTransaction transaction) {
try {
string documentName = PageDocument.GetDocumentName(content.PageInfo);
DumpedDocument ddoc = new DumpedDocument(0, documentName, host.PrepareTitleForIndexing(content.PageInfo, content.Title),
@ -609,6 +610,11 @@ namespace ScrewTurn.Wiki.Plugins.SqlCommon {
return count;
}
catch(Exception ex) {
host.LogEntry("Page indexing error for " + content.PageInfo.FullName + " (skipping page): " + ex.ToString(), LogEntryType.Error, null, this);
return 0;
}
}
/// <summary>
/// Removes a page from the search engine index.
@ -647,6 +653,7 @@ namespace ScrewTurn.Wiki.Plugins.SqlCommon {
/// <param name="transaction">The current transaction.</param>
/// <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 {
// Trim "RE:" to avoid polluting the search engine index
if(subject.ToLowerInvariant().StartsWith("re:") && subject.Length > 3) subject = subject.Substring(3).Trim();
@ -667,6 +674,11 @@ namespace ScrewTurn.Wiki.Plugins.SqlCommon {
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;
}
}
/// <summary>
/// Removes a message tree from the search engine index.

View file

@ -13,7 +13,7 @@ namespace ScrewTurn.Wiki.Plugins.SqlServer {
/// </summary>
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();