Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change Ignore Paths to Ignore Pages #4448

Merged
merged 1 commit into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Oqtane.Client/Modules/Admin/Search/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
</div>
</div>
<div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="ignorepaths" HelpText="Comma delimited list of page paths which should be ignored" ResourceKey="IgnorePaths">Ignore Paths: </Label>
<Label Class="col-sm-3" For="ignorepages" HelpText="Comma delimited list of pages which should be ignored (based on their path)" ResourceKey="IgnorePages">Ignore Pages: </Label>
<div class="col-sm-9">
<textarea id="ignorepaths" class="form-control" @bind="@_ignorePaths" rows="3"></textarea>
<textarea id="ignorepages" class="form-control" @bind="@_ignorePages" rows="3"></textarea>
</div>
</div>
<div class="row mb-1 align-items-center">
Expand Down Expand Up @@ -61,7 +61,7 @@
private string _searchProvider;
private string _enabled;
private string _lastIndexedOn;
private string _ignorePaths;
private string _ignorePages;
private string _ignoreEntities;
private string _minimumWordLength;
private string _ignoreWords;
Expand All @@ -72,7 +72,7 @@
_searchProvider = SettingService.GetSetting(settings, "Search_SearchProvider", Constants.DefaultSearchProviderName);
_enabled = SettingService.GetSetting(settings, "Search_Enabled", "True");
_lastIndexedOn = SettingService.GetSetting(settings, "Search_LastIndexedOn", "");
_ignorePaths = SettingService.GetSetting(settings, "Search_IgnorePaths", "");
_ignorePages = SettingService.GetSetting(settings, "Search_IgnorePages", "");
_ignoreEntities = SettingService.GetSetting(settings, "Search_IgnoreEntities", "");
_minimumWordLength = SettingService.GetSetting(settings, "Search_MininumWordLength", "3");
_ignoreWords = SettingService.GetSetting(settings, "Search_IgnoreWords", "");
Expand All @@ -86,7 +86,7 @@
settings = SettingService.SetSetting(settings, "Search_SearchProvider", _searchProvider);
settings = SettingService.SetSetting(settings, "Search_Enabled", _enabled, true);
settings = SettingService.SetSetting(settings, "Search_LastIndexedOn", _lastIndexedOn, true);
settings = SettingService.SetSetting(settings, "Search_IgnorePaths", _ignorePaths, true);
settings = SettingService.SetSetting(settings, "Search_IgnorePages", _ignorePages, true);
settings = SettingService.SetSetting(settings, "Search_IgnoreEntities", _ignoreEntities, true);
settings = SettingService.SetSetting(settings, "Search_MininumWordLength", _minimumWordLength, true);
settings = SettingService.SetSetting(settings, "Search_IgnoreWords", _ignoreWords, true);
Expand Down
8 changes: 4 additions & 4 deletions Oqtane.Client/Resources/Modules/Admin/Search/Index.resx
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@
<data name="LastIndexedOn.HelpText" xml:space="preserve">
<value>The date/time which the site was last indexed on</value>
</data>
<data name="IgnorePaths.Text" xml:space="preserve">
<value>Ignore Paths: </value>
<data name="IgnorePages.Text" xml:space="preserve">
<value>Ignore Pages: </value>
</data>
<data name="IgnorePaths.HelpText" xml:space="preserve">
<value>Comma delimited list of page paths which should be ignored</value>
<data name="IgnorePages.HelpText" xml:space="preserve">
<value>Comma delimited list of pages which should be ignored (based on page path)</value>
</data>
<data name="IgnoreEntities.Text" xml:space="preserve">
<value>Ignore Entities: </value>
Expand Down
6 changes: 3 additions & 3 deletions Oqtane.Server/Infrastructure/Jobs/SearchIndexJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class SearchIndexJob : HostedServiceBase
{
private const string SearchLastIndexedOnSetting = "Search_LastIndexedOn";
private const string SearchEnabledSetting = "Search_Enabled";
private const string SearchIgnorePathsSetting = "Search_IgnorePaths";
private const string SearchIgnorePagesSetting = "Search_IgnorePages";
private const string SearchIgnoreEntitiesSetting = "Search_IgnoreEntities";

public SearchIndexJob(IServiceScopeFactory serviceScopeFactory) : base(serviceScopeFactory)
Expand Down Expand Up @@ -59,7 +59,7 @@ public override async Task<string> ExecuteJobAsync(IServiceProvider provider)
var currentTime = DateTime.UtcNow;
var lastIndexedOn = Convert.ToDateTime(siteSettings.GetValue(SearchLastIndexedOnSetting, DateTime.MinValue.ToString()));

var ignorePaths = siteSettings.GetValue(SearchIgnorePathsSetting, "").Split(',');
var ignorePages = siteSettings.GetValue(SearchIgnorePagesSetting, "").Split(',');
var ignoreEntities = siteSettings.GetValue(SearchIgnoreEntitiesSetting, "").Split(',');

var pages = pageRepository.GetPages(site.SiteId);
Expand All @@ -69,7 +69,7 @@ public override async Task<string> ExecuteJobAsync(IServiceProvider provider)
// index pages
foreach (var page in pages)
{
if (!string.IsNullOrEmpty(page.Path) && (Constants.InternalPagePaths.Contains(page.Path) || ignorePaths.Contains(page.Path)))
if (!string.IsNullOrEmpty(page.Path) && (Constants.InternalPagePaths.Contains(page.Path) || ignorePages.Contains(page.Path)))
{
continue;
}
Expand Down