Skip to content

Commit

Permalink
Remove 'Target' from LinkFieldIndex (#16397)
Browse files Browse the repository at this point in the history
Fix #16378
  • Loading branch information
MikeAlhayek authored Jul 3, 2024
1 parent 1524e0f commit 94d7fbf
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ public class LinkFieldIndex : ContentFieldIndex
{
// Maximum length that MySql can support in an index under utf8 collation is 768,
// minus 1 for the `DocumentId` integer (character size = integer size = 4 bytes).
// minus 1 (freeing 4 bytes) for the additional 'Published' and 'Latest' booleans.
// minus 1 (freeing 4 bytes) for the additional 'Published' and 'Latest' boolean.
public const int MaxUrlSize = 766;
public const int MaxTextSize = 766;

public string Url { get; set; }
public string BigUrl { get; set; }
public string Text { get; set; }
public string BigText { get; set; }
public string Target { get; set; }
}

public class LinkFieldIndexProvider : ContentFieldIndexProvider
Expand Down Expand Up @@ -63,17 +62,19 @@ public override void Describe(DescribeContext<ContentItem> context)
if (contentTypeDefinition == null)
{
_ignoredTypes.Add(contentItem.ContentType);

return null;
}

var fieldDefinitions = contentTypeDefinition
.Parts.SelectMany(x => x.PartDefinition.Fields.Where(f => f.FieldDefinition.Name == nameof(LinkField)))
.ToArray();

// This type doesn't have any LinkField, ignore it
// This type doesn't have any LinkField, ignore it.
if (fieldDefinitions.Length == 0)
{
_ignoredTypes.Add(contentItem.ContentType);

return null;
}

Expand All @@ -93,7 +94,6 @@ public override void Describe(DescribeContext<ContentItem> context)
BigUrl = pair.Field.Url,
Text = pair.Field.Text?[..Math.Min(pair.Field.Text.Length, LinkFieldIndex.MaxTextSize)],
BigText = pair.Field.Text,
Target = pair.Field.Target,
});
});
}
Expand Down

0 comments on commit 94d7fbf

Please sign in to comment.