Skip to content

Commit b393092

Browse files
author
Binon
committed
Merge branch 'Develop/Features/TD-6467-implement-new-search-ui' into Develop/Features/TD-6212-azure-ai-search-implementation
2 parents 7090e75 + 646f2d6 commit b393092

File tree

7 files changed

+165
-100
lines changed

7 files changed

+165
-100
lines changed

AdminUI/LearningHub.Nhs.AdminUI/Helpers/FeatureFlags.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,10 @@ public static class FeatureFlags
1414
/// The DisplayAudioVideo.
1515
/// </summary>
1616
public const string DisplayAudioVideo = "DisplayAudioVideo";
17+
18+
/// <summary>
19+
/// The AzureSearch.
20+
/// </summary>
21+
public const string AzureSearch = "AzureSearch";
1722
}
1823
}

AdminUI/LearningHub.Nhs.AdminUI/Views/Shared/_NavPartial.cshtml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
@using Microsoft.Extensions.Options;
1+
@using Microsoft.Extensions.Options;
22
@using LearningHub.Nhs.AdminUI.Configuration;
3+
@using LearningHub.Nhs.AdminUI.Helpers;
4+
@using Microsoft.FeatureManagement;
35
@inject IOptions<WebSettings> webSettings
6+
@inject IFeatureManager featureManager
47

58
@{
69
var mainMenu = "Home";
@@ -13,7 +16,7 @@
1316
case "externalsystem":
1417
case "log":
1518
case "roadmap":
16-
case "cms":
19+
case "cms":
1720
case "release":
1821
case "cache":
1922
mainMenu = "Settings";
@@ -44,7 +47,6 @@
4447
</div>
4548
<div class="d-none d-lg-block align-self-center">
4649
<div class="mx-auto">
47-
4850
</div>
4951
</div>
5052
<div class="align-self-start">
@@ -81,9 +83,12 @@
8183
<li class="nav-item @IsActive("Settings")">
8284
<a class="nav-link" href="/externalsystem"><i class="fa-solid fa-gear fa-lg" title="System"></i>System</a>
8385
</li>
84-
<li class="nav-item" @IsActive("ResourceSync")>
85-
<a class="nav-link" href="/ResourceSync/Resources"><i class="fa-solid fa-gear fa-lg" title="Sync"></i>Sync</a>
86-
</li>
86+
@if (!await featureManager.IsEnabledAsync(FeatureFlags.AzureSearch))
87+
{
88+
<li class="nav-item" @IsActive("ResourceSync")>
89+
<a class="nav-link" href="/ResourceSync/Resources"><i class="fa-solid fa-gear fa-lg" title="Sync"></i>Sync</a>
90+
</li>
91+
}
8792
}
8893
</ul>
8994
<ul class="navbar-nav ml-auto">
@@ -101,5 +106,4 @@
101106
}
102107
</ul>
103108
</div>
104-
</nav>
105-
109+
</nav>

AdminUI/LearningHub.Nhs.AdminUI/appsettings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"APPINSIGHTS_INSTRUMENTATIONKEY": "",
7474
"FeatureManagement": {
7575
"AddAudioVideo": true,
76-
"DisplayAudioVideo": true
76+
"DisplayAudioVideo": true,
77+
"AzureSearch": false
7778
}
7879
}

OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/AzureSearchConfig.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,10 @@ public class AzureSearchConfig
4444
/// Gets or sets the suggester name for auto-complete and suggestions.
4545
/// </summary>
4646
public string SuggesterName { get; set; } = "test-search-suggester";
47+
48+
/// <summary>
49+
/// Gets or sets the search query type (semantic, full, or simple).
50+
/// </summary>
51+
public string SearchQueryType { get; set; } = "Semantic";
4752
}
4853
}

OpenAPI/LearningHub.Nhs.OpenApi.Services/Helpers/Search/SearchOptionsBuilder.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,26 @@ private static string GetSortOption(Dictionary<string, string>? sortBy)
123123
return $"{sortColumn} {sortDirection}";
124124
}
125125

126+
/// <summary>
127+
/// Parses the search query type from configuration string.
128+
/// Parsing is case-insensitive. If the value is null, empty, or invalid, defaults to Semantic.
129+
/// </summary>
130+
/// <param name="searchQueryTypeString">The search query type string (semantic, full, or simple).</param>
131+
/// <returns>The parsed SearchQueryType enum value.</returns>
132+
public static SearchQueryType ParseSearchQueryType(string searchQueryTypeString)
133+
{
134+
if (string.IsNullOrWhiteSpace(searchQueryTypeString))
135+
{
136+
return SearchQueryType.Semantic;
137+
}
138+
139+
if (Enum.TryParse<SearchQueryType>(searchQueryTypeString, ignoreCase: true, out var queryType) &&
140+
(queryType == SearchQueryType.Semantic || queryType == SearchQueryType.Full || queryType == SearchQueryType.Simple))
141+
{
142+
return queryType;
143+
}
144+
145+
return SearchQueryType.Semantic;
146+
}
126147
}
127148
}

0 commit comments

Comments
 (0)