Skip to content

Commit 2022300

Browse files
authored
Feature: Updated query to include unindexed items in results (#14415)
1 parent 4e6cf66 commit 2022300

File tree

22 files changed

+8
-179
lines changed

22 files changed

+8
-179
lines changed

src/Files.App/Actions/Global/SearchUnindexedItemsAction.cs

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/Files.App/Data/Commands/CommandCodes.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public enum CommandCodes
1414
ExitCompactOverlay,
1515
ToggleCompactOverlay,
1616
Search,
17-
SearchUnindexedItems,
1817
EditPath,
1918
Redo,
2019
Undo,

src/Files.App/Data/Commands/Manager/CommandManager.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public IRichCommand this[HotKey hotKey]
4444
public IRichCommand ExitCompactOverlay => commands[CommandCodes.ExitCompactOverlay];
4545
public IRichCommand ToggleCompactOverlay => commands[CommandCodes.ToggleCompactOverlay];
4646
public IRichCommand Search => commands[CommandCodes.Search];
47-
public IRichCommand SearchUnindexedItems => commands[CommandCodes.SearchUnindexedItems];
4847
public IRichCommand EditPath => commands[CommandCodes.EditPath];
4948
public IRichCommand Redo => commands[CommandCodes.Redo];
5049
public IRichCommand Undo => commands[CommandCodes.Undo];
@@ -214,7 +213,6 @@ public CommandManager()
214213
[CommandCodes.ExitCompactOverlay] = new ExitCompactOverlayAction(),
215214
[CommandCodes.ToggleCompactOverlay] = new ToggleCompactOverlayAction(),
216215
[CommandCodes.Search] = new SearchAction(),
217-
[CommandCodes.SearchUnindexedItems] = new SearchUnindexedItemsAction(),
218216
[CommandCodes.EditPath] = new EditPathAction(),
219217
[CommandCodes.Redo] = new RedoAction(),
220218
[CommandCodes.Undo] = new UndoAction(),

src/Files.App/Data/Commands/Manager/ICommandManager.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public interface ICommandManager : IEnumerable<IRichCommand>
1717
IRichCommand ExitCompactOverlay { get; }
1818
IRichCommand ToggleCompactOverlay { get; }
1919
IRichCommand Search { get; }
20-
IRichCommand SearchUnindexedItems { get; }
2120
IRichCommand EditPath { get; }
2221
IRichCommand Redo { get; }
2322
IRichCommand Undo { get; }

src/Files.App/Data/Contexts/ContentPage/ContentPageContext.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ internal class ContentPageContext : ObservableObject, IContentPageContext
4747

4848
public bool IsMultiPaneActive => ShellPage is not null && ShellPage.PaneHolder is not null && ShellPage.PaneHolder.IsMultiPaneActive;
4949

50-
public bool ShowSearchUnindexedItemsMessage => ShellPage is not null && ShellPage.InstanceViewModel.ShowSearchUnindexedItemsMessage;
51-
5250
public bool IsGitRepository => ShellPage is not null && ShellPage.InstanceViewModel.IsGitRepository;
5351

5452
public bool CanExecuteGitAction => IsGitRepository && !GitHelpers.IsExecutingGitAction;
@@ -151,9 +149,6 @@ private void InstanceViewModel_PropertyChanged(object? sender, PropertyChangedEv
151149
case nameof(CurrentInstanceViewModel.IsPageTypeSearchResults):
152150
UpdatePageType();
153151
break;
154-
case nameof(CurrentInstanceViewModel.ShowSearchUnindexedItemsMessage):
155-
OnPropertyChanged(nameof(ShowSearchUnindexedItemsMessage));
156-
break;
157152
case nameof(CurrentInstanceViewModel.IsGitRepository):
158153
OnPropertyChanged(nameof(IsGitRepository));
159154
OnPropertyChanged(nameof(CanExecuteGitAction));
@@ -205,7 +200,6 @@ private void Update()
205200
OnPropertyChanged(nameof(CanCreateItem));
206201
OnPropertyChanged(nameof(IsMultiPaneEnabled));
207202
OnPropertyChanged(nameof(IsMultiPaneActive));
208-
OnPropertyChanged(nameof(ShowSearchUnindexedItemsMessage));
209203
OnPropertyChanged(nameof(IsGitRepository));
210204
OnPropertyChanged(nameof(CanExecuteGitAction));
211205
}

src/Files.App/Data/Contexts/ContentPage/IContentPageContext.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ public interface IContentPageContext : INotifyPropertyChanged
3030
bool IsMultiPaneEnabled { get; }
3131
bool IsMultiPaneActive { get; }
3232

33-
bool ShowSearchUnindexedItemsMessage { get; }
34-
3533
bool IsGitRepository { get; }
3634
bool CanExecuteGitAction { get; }
3735

src/Files.App/Data/EventArguments/NavigationArguments.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ public class NavigationArguments
1717

1818
public string? SearchQuery { get; set; } = null;
1919

20-
public bool SearchUnindexedItems { get; set; } = false;
21-
2220
public bool IsLayoutSwitch { get; set; } = false;
2321

2422
public IEnumerable<string>? SelectItems { get; set; }

src/Files.App/Data/Models/CurrentInstanceViewModel.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public bool IsPageTypeSearchResults
3131
SetProperty(ref isPageTypeSearchResults, value);
3232
OnPropertyChanged(nameof(CanCreateFileInPage));
3333
OnPropertyChanged(nameof(CanCopyPathInPage));
34-
OnPropertyChanged(nameof(ShowSearchUnindexedItemsMessage));
3534
}
3635
}
3736

@@ -42,24 +41,6 @@ public string CurrentSearchQuery
4241
set => SetProperty(ref currentSearchQuery, value);
4342
}
4443

45-
private bool searchedUnindexedItems;
46-
public bool SearchedUnindexedItems
47-
{
48-
get => searchedUnindexedItems;
49-
set
50-
{
51-
if (SetProperty(ref searchedUnindexedItems, value))
52-
{
53-
OnPropertyChanged(nameof(ShowSearchUnindexedItemsMessage));
54-
}
55-
}
56-
}
57-
58-
public bool ShowSearchUnindexedItemsMessage
59-
{
60-
get => !SearchedUnindexedItems && IsPageTypeSearchResults;
61-
}
62-
6344
private bool isPageTypeNotHome = false;
6445
public bool IsPageTypeNotHome
6546
{

src/Files.App/Services/Settings/GeneralSettingsService.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ public GeneralSettingsService(ISettingsSharingContext settingsSharingContext)
1313
RegisterSettingsContext(settingsSharingContext);
1414
}
1515

16-
public bool SearchUnindexedItems
17-
{
18-
get => Get(false);
19-
set => Set(value);
20-
}
21-
2216
public bool OpenSpecificPageOnStartup
2317
{
2418
get => Get(false);
@@ -267,7 +261,6 @@ protected override void RaiseOnSettingChangedEvent(object sender, SettingChanged
267261
{
268262
switch (e.SettingName)
269263
{
270-
case nameof(SearchUnindexedItems):
271264
case nameof(OpenSpecificPageOnStartup):
272265
case nameof(ContinueLastSessionOnStartUp):
273266
case nameof(OpenNewTabOnStartup):

src/Files.App/Strings/en-US/Resources.resw

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -987,9 +987,6 @@
987987
<data name="ShowProtectedSystemFiles" xml:space="preserve">
988988
<value>Show protected system files</value>
989989
</data>
990-
<data name="SettingsSearchUnindexedItems" xml:space="preserve">
991-
<value>Include unindexed items in search results</value>
992-
</data>
993990
<data name="SyncFolderPreferencesAcrossDirectories" xml:space="preserve">
994991
<value>Sync layout and sorting preferences across directories</value>
995992
</data>
@@ -1281,12 +1278,6 @@
12811278
<data name="PropertyISO" xml:space="preserve">
12821279
<value>ISO speed</value>
12831280
</data>
1284-
<data name="SearchUnindexedItemsLabel.Text" xml:space="preserve">
1285-
<value>Didn't find what you're looking for?</value>
1286-
</data>
1287-
<data name="SearchUnindexedItemsButton.Content" xml:space="preserve">
1288-
<value>Search unindexed items</value>
1289-
</data>
12901281
<data name="ReplaceExisting" xml:space="preserve">
12911282
<value>Replace existing</value>
12921283
</data>
@@ -2968,9 +2959,6 @@
29682959
<data name="ShowCheckboxesWhenSelectingItems" xml:space="preserve">
29692960
<value>Show checkboxes when selecting items</value>
29702961
</data>
2971-
<data name="SearchUnindexedItemsDescription" xml:space="preserve">
2972-
<value>Search for unindexed items</value>
2973-
</data>
29742962
<data name="EditPathDescription" xml:space="preserve">
29752963
<value>Focus path bar</value>
29762964
</data>

src/Files.App/Utils/Storage/Search/FolderSearch.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public class FolderSearch
2626

2727
public uint MaxItemCount { get; set; } = 0; // 0: no limit
2828
public uint ThumbnailSize { get; set; } = 24;
29-
public bool SearchUnindexedItems { get; set; } = false;
3029

3130
private uint UsedMaxItemCount => MaxItemCount > 0 ? MaxItemCount : uint.MaxValue;
3231

@@ -515,9 +514,7 @@ private QueryOptions ToQueryOptions()
515514
UserSearchFilter = AQSQuery ?? string.Empty,
516515
};
517516

518-
query.IndexerOption = SearchUnindexedItems
519-
? IndexerOption.DoNotUseIndexer
520-
: IndexerOption.OnlyUseIndexerAndOptimizeForIndexedProperties;
517+
query.IndexerOption = IndexerOption.UseIndexerWhenAvailable;
521518

522519
query.SortOrder.Clear();
523520
query.SortOrder.Add(new SortEntry { PropertyName = "System.Search.Rank", AscendingOrder = false });

src/Files.App/ViewModels/Settings/GeneralViewModel.cs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using Microsoft.Extensions.Logging;
54
using System.Collections.Specialized;
65
using System.Globalization;
76
using Windows.Globalization;
@@ -159,7 +158,7 @@ private void InitStartupSettingsRecentFoldersFlyout()
159158
CommandParameter = "Home",
160159
Tooltip = "Home".GetLocalizedResource()
161160
});
162-
recentsItem.Items.Add(new MenuFlyoutItemViewModel("Browse".GetLocalizedResource()) { Command = AddPageCommand });
161+
recentsItem.Items.Add(new MenuFlyoutItemViewModel("Browse".GetLocalizedResource()) { Command = AddPageCommand });
163162
}
164163

165164
private void PagesOnStartupList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
@@ -332,7 +331,7 @@ private FolderPicker InitializeWithWindow(FolderPicker obj)
332331

333332
private void RemovePage(PageOnStartupViewModel page)
334333
{
335-
PagesOnStartupList.Remove(page);
334+
PagesOnStartupList.Remove(page);
336335
}
337336

338337
private async Task AddPageAsync(string path = null)
@@ -369,20 +368,6 @@ public DateTimeFormats DateTimeFormat
369368
}
370369
}
371370

372-
public bool SearchUnindexedItems
373-
{
374-
get => UserSettingsService.GeneralSettingsService.SearchUnindexedItems;
375-
set
376-
{
377-
if (value != UserSettingsService.GeneralSettingsService.SearchUnindexedItems)
378-
{
379-
UserSettingsService.GeneralSettingsService.SearchUnindexedItems = value;
380-
381-
OnPropertyChanged();
382-
}
383-
}
384-
}
385-
386371
public bool ShowQuickAccessWidget
387372
{
388373
get => UserSettingsService.GeneralSettingsService.ShowQuickAccessWidget;

src/Files.App/Views/Layouts/BaseLayoutPage.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ protected virtual void BaseFolderSettings_LayoutModeChangeRequested(object? send
362362
IsSearchResultPage = navigationArguments.IsSearchResultPage,
363363
SearchPathParam = navigationArguments.SearchPathParam,
364364
SearchQuery = navigationArguments.SearchQuery,
365-
SearchUnindexedItems = navigationArguments.SearchUnindexedItems,
366365
IsLayoutSwitch = true,
367366
AssociatedTabInstance = ParentShellPageInstance
368367
});
@@ -469,7 +468,6 @@ protected override async void OnNavigatedTo(NavigationEventArgs e)
469468
Query = navigationArguments.SearchQuery,
470469
Folder = navigationArguments.SearchPathParam,
471470
ThumbnailSize = InstanceViewModel!.FolderSettings.GetIconSize(),
472-
SearchUnindexedItems = navigationArguments.SearchUnindexedItems
473471
};
474472

475473
_ = ParentShellPageInstance.FilesystemViewModel.SearchAsync(searchInstance);

src/Files.App/Views/Layouts/ColumnsLayoutPage.xaml.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
119119
Column = 0,
120120
IsSearchResultPage = navigationArguments.IsSearchResultPage,
121121
SearchQuery = navigationArguments.SearchQuery,
122-
SearchUnindexedItems = navigationArguments.SearchUnindexedItems,
123122
SearchPathParam = navigationArguments.SearchPathParam,
124123
NavPathParam = path,
125124
SelectItems = path == navigationArguments.NavPathParam ? navigationArguments.SelectItems : null
@@ -392,7 +391,6 @@ public void SetSelectedPathOrNavigate(string navigationPath, Type sourcePageType
392391
{
393392
columnParam.IsSearchResultPage = navArgs.IsSearchResultPage;
394393
columnParam.SearchQuery = navArgs.SearchQuery;
395-
columnParam.SearchUnindexedItems = navArgs.SearchUnindexedItems;
396394
columnParam.SearchPathParam = navArgs.SearchPathParam;
397395
}
398396

src/Files.App/Views/Layouts/DetailsLayoutPage.xaml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,21 +1509,6 @@
15091509

15101510
</SemanticZoom>
15111511

1512-
<!-- Search Unindexed Items -->
1513-
<StackPanel
1514-
x:Name="SearchUnindexedItemsPanel"
1515-
HorizontalAlignment="Center"
1516-
VerticalAlignment="Bottom"
1517-
x:Load="{x:Bind Commands.SearchUnindexedItems.IsExecutable, Mode=OneWay}"
1518-
Orientation="Vertical">
1519-
<TextBlock Text="{helpers:ResourceString Name=SearchUnindexedItemsLabel/Text}" />
1520-
<HyperlinkButton
1521-
x:Name="SearchUnindexedItemsButton"
1522-
HorizontalAlignment="Center"
1523-
Command="{x:Bind Commands.SearchUnindexedItems}"
1524-
Content="{x:Bind Commands.SearchUnindexedItems.Label}" />
1525-
</StackPanel>
1526-
15271512
<!-- Selector -->
15281513
<Canvas HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
15291514
<Rectangle

src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ private void TagItem_Tapped(object sender, TappedRoutedEventArgs e)
843843
if (tagName is null)
844844
return;
845845

846-
ParentShellPageInstance?.SubmitSearch($"tag:{tagName}", false);
846+
ParentShellPageInstance?.SubmitSearch($"tag:{tagName}");
847847
}
848848

849849
private void FileTag_PointerEntered(object sender, PointerRoutedEventArgs e)

src/Files.App/Views/Layouts/GridLayoutPage.xaml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -654,22 +654,6 @@
654654
</GroupStyle>
655655
</toolkit:AdaptiveGridView.GroupStyle>
656656

657-
<!-- Search Unindexed Items -->
658-
<toolkit:AdaptiveGridView.Footer>
659-
<StackPanel
660-
x:Name="SearchUnindexedItemsPanel"
661-
HorizontalAlignment="Stretch"
662-
x:Load="{x:Bind Commands.SearchUnindexedItems.IsExecutable, Mode=OneWay}"
663-
Orientation="Vertical">
664-
<TextBlock HorizontalTextAlignment="Center" Text="{helpers:ResourceString Name=SearchUnindexedItemsLabel/Text}" />
665-
<HyperlinkButton
666-
x:Name="SearchUnindexedItemsButton"
667-
HorizontalAlignment="Center"
668-
Command="{x:Bind Commands.SearchUnindexedItems}"
669-
Content="{x:Bind Commands.SearchUnindexedItems.Label}" />
670-
</StackPanel>
671-
</toolkit:AdaptiveGridView.Footer>
672-
673657
<toolkit:AdaptiveGridView.ItemContainerStyle>
674658
<Style BasedOn="{StaticResource DefaultGridViewItemStyle}" TargetType="GridViewItem">
675659
<Setter Property="HorizontalContentAlignment" Value="Stretch" />

src/Files.App/Views/Settings/GeneralPage.xaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,6 @@
9292
</ComboBox>
9393
</local:SettingsBlockControl>
9494

95-
<!-- Search settings -->
96-
<local:SettingsBlockControl Title="{helpers:ResourceString Name=SettingsSearchUnindexedItems}" HorizontalAlignment="Stretch">
97-
<local:SettingsBlockControl.Icon>
98-
<FontIcon Glyph="&#xE721;" />
99-
</local:SettingsBlockControl.Icon>
100-
<ToggleSwitch
101-
AutomationProperties.Name="{helpers:ResourceString Name=SettingsSearchUnindexedItems}"
102-
IsOn="{x:Bind ViewModel.SearchUnindexedItems, Mode=TwoWay}"
103-
Style="{StaticResource RightAlignedToggleSwitchStyle}" />
104-
</local:SettingsBlockControl>
105-
10695
<!-- Startup settings -->
10796
<local:SettingsBlockControl Title="{helpers:ResourceString Name=StartupSettings}" HorizontalAlignment="Stretch">
10897
<local:SettingsBlockControl.Icon>

0 commit comments

Comments
 (0)