[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

@ -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.4.565")]
[assembly: AssemblyFileVersion("3.0.4.565")]
[assembly: AssemblyVersion("3.0.4.566")]
[assembly: AssemblyFileVersion("3.0.4.566")]

View file

@ -1189,6 +1189,8 @@ namespace ScrewTurn.Wiki {
private int IndexPage(PageContent content) {
lock(this) {
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),
@ -2396,6 +2398,8 @@ namespace ScrewTurn.Wiki {
private int IndexMessage(PageInfo page, int id, string subject, DateTime dateTime, string body) {
lock(this) {
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();

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();

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.2.541", "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.4.566", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/SQLServerProv/Pages.txt");
private readonly SqlServerCommandBuilder commandBuilder = new SqlServerCommandBuilder();