Skip to content

Commit

Permalink
Fix NRE on migration from 1.4 -> 1.5 due to Lucene changes (#12831)
Browse files Browse the repository at this point in the history
  • Loading branch information
PBMikeW committed Nov 19, 2022
1 parent 0b174eb commit 4d326e9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/OrchardCore.Modules/OrchardCore.Search.Lucene/Migrations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ public int Create()
{
if (analyzed != null)
{
if ((bool)included)
if ((bool)included && !(bool)analyzed)
{
existingPartSettings["Keyword"] = true;
}
}
else
{
if ((bool)included && !(bool)analyzed)
if ((bool)included)
{
existingPartSettings["Keyword"] = true;
}
Expand Down Expand Up @@ -85,14 +85,14 @@ public int Create()
{
if (analyzed != null)
{
if ((bool)included)
if ((bool)included && !(bool)analyzed)
{
existingPartSettings["Keyword"] = true;
}
}
else
{
if ((bool)included && !(bool)analyzed)
if ((bool)included)
{
existingPartSettings["Keyword"] = true;
}
Expand All @@ -119,16 +119,16 @@ public int Create()
if (included != null)
{
if (analyzed == null)
if (analyzed != null)
{
if ((bool)included)
if ((bool)included && !(bool)analyzed)
{
existingFieldSettings["Keyword"] = true;
}
}
else
{
if ((bool)included && !(bool)analyzed)
if ((bool)included)
{
existingFieldSettings["Keyword"] = true;
}
Expand Down Expand Up @@ -178,7 +178,7 @@ public int Create()
var updateCmd = $"UPDATE {dialect.QuoteForTableName(table, session.Store.Configuration.Schema)} SET Content = REPLACE(content, '\"$type\":\"OrchardCore.Lucene.LuceneQuery, OrchardCore.Lucene\"', '\"$type\":\"OrchardCore.Search.Lucene.LuceneQuery, OrchardCore.Search.Lucene\"') WHERE [Type] = 'OrchardCore.Queries.Services.QueriesDocument, OrchardCore.Queries'";
await transaction.Connection.ExecuteAsync(updateCmd, null, transaction);
updateCmd = $"UPDATE {dialect.QuoteForTableName(table, session.Store.Configuration.Schema)} SET Content = REPLACE(content, '\"$type\":\"OrchardCore.Lucene.Deployment.LuceneIndexDeploymentStep, OrchardCore.Lucene\"', '\"$type\":\"OrchardCore.Search.Lucene.Deployment.LuceneIndexDeploymentStep, OrchardCore.Search.Lucene\"') WHERE [Type] = 'OrchardCore.Deployment.DeploymentPlan, OrchardCore.Deployment.Abstractions'";
await transaction.Connection.ExecuteAsync(updateCmd, null, transaction);
Expand Down

0 comments on commit 4d326e9

Please sign in to comment.