Skip to content

Commit a353f6f

Browse files
committed
Merge pull request umbraco#135 from Myster/master
Fix multiple words in search U4-2509
2 parents 2fb55cb + a64efb9 commit a353f6f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Umbraco.Web/umbraco.presentation/umbraco/Search/QuickSearchHandler.ashx.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ public void ProcessRequest(HttpContext context)
6060
}
6161
else
6262
{
63-
var operation = criteria.Field("__nodeName", txt.MultipleCharacterWildcard());
63+
var words = txt.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(w => w.ToLower().MultipleCharacterWildcard()).ToList();
64+
var operation = criteria.GroupedOr(new[] { "__nodeName" }, new[] { words[0] });
65+
words.RemoveAt(0);
66+
foreach (var word in words)
67+
operation = operation.And().GroupedOr(new[] { "__nodeName" }, new[] { word });
6468

6569
// ensure the user can only find nodes they are allowed to see
6670
if (UmbracoContext.Current.UmbracoUser.StartNodeId > 0)

0 commit comments

Comments
 (0)