Skip to content

Commit 53060e1

Browse files
mcl-szMatthew-Wise
authored andcommitted
Remove __Key field from Backoffice Search if query is not a Guid
When a short search query is used, irrelevant results may arise because the query appears in the Key guide.
1 parent fd9c1a0 commit 53060e1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Umbraco.Examine.Lucene/BackOfficeExamineSearcher.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ public IEnumerable<ISearchResult> Search(
8181
{
8282
query = "\"" + g + "\"";
8383
}
84+
else
85+
{
86+
// No Guid so no need to search the __Key field to prevent irrelevant results
87+
fields.Remove(UmbracoExamineFieldNames.NodeKeyFieldName);
88+
}
8489

8590
IUser? currentUser = _backOfficeSecurityAccessor?.BackOfficeSecurity?.CurrentUser;
8691

0 commit comments

Comments
 (0)