Skip to content

Feature: Updated search query to include unindexed items in results #14415

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

Merged
merged 2 commits into from
Jan 10, 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
43 changes: 0 additions & 43 deletions src/Files.App/Actions/Global/SearchUnindexedItemsAction.cs

This file was deleted.

1 change: 0 additions & 1 deletion src/Files.App/Data/Commands/CommandCodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public enum CommandCodes
ExitCompactOverlay,
ToggleCompactOverlay,
Search,
SearchUnindexedItems,
EditPath,
Redo,
Undo,
Expand Down
2 changes: 0 additions & 2 deletions src/Files.App/Data/Commands/Manager/CommandManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public IRichCommand this[HotKey hotKey]
public IRichCommand ExitCompactOverlay => commands[CommandCodes.ExitCompactOverlay];
public IRichCommand ToggleCompactOverlay => commands[CommandCodes.ToggleCompactOverlay];
public IRichCommand Search => commands[CommandCodes.Search];
public IRichCommand SearchUnindexedItems => commands[CommandCodes.SearchUnindexedItems];
public IRichCommand EditPath => commands[CommandCodes.EditPath];
public IRichCommand Redo => commands[CommandCodes.Redo];
public IRichCommand Undo => commands[CommandCodes.Undo];
Expand Down Expand Up @@ -214,7 +213,6 @@ public CommandManager()
[CommandCodes.ExitCompactOverlay] = new ExitCompactOverlayAction(),
[CommandCodes.ToggleCompactOverlay] = new ToggleCompactOverlayAction(),
[CommandCodes.Search] = new SearchAction(),
[CommandCodes.SearchUnindexedItems] = new SearchUnindexedItemsAction(),
[CommandCodes.EditPath] = new EditPathAction(),
[CommandCodes.Redo] = new RedoAction(),
[CommandCodes.Undo] = new UndoAction(),
Expand Down
1 change: 0 additions & 1 deletion src/Files.App/Data/Commands/Manager/ICommandManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public interface ICommandManager : IEnumerable<IRichCommand>
IRichCommand ExitCompactOverlay { get; }
IRichCommand ToggleCompactOverlay { get; }
IRichCommand Search { get; }
IRichCommand SearchUnindexedItems { get; }
IRichCommand EditPath { get; }
IRichCommand Redo { get; }
IRichCommand Undo { get; }
Expand Down
6 changes: 0 additions & 6 deletions src/Files.App/Data/Contexts/ContentPage/ContentPageContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ internal class ContentPageContext : ObservableObject, IContentPageContext

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

public bool ShowSearchUnindexedItemsMessage => ShellPage is not null && ShellPage.InstanceViewModel.ShowSearchUnindexedItemsMessage;

public bool IsGitRepository => ShellPage is not null && ShellPage.InstanceViewModel.IsGitRepository;

public bool CanExecuteGitAction => IsGitRepository && !GitHelpers.IsExecutingGitAction;
Expand Down Expand Up @@ -151,9 +149,6 @@ private void InstanceViewModel_PropertyChanged(object? sender, PropertyChangedEv
case nameof(CurrentInstanceViewModel.IsPageTypeSearchResults):
UpdatePageType();
break;
case nameof(CurrentInstanceViewModel.ShowSearchUnindexedItemsMessage):
OnPropertyChanged(nameof(ShowSearchUnindexedItemsMessage));
break;
case nameof(CurrentInstanceViewModel.IsGitRepository):
OnPropertyChanged(nameof(IsGitRepository));
OnPropertyChanged(nameof(CanExecuteGitAction));
Expand Down Expand Up @@ -205,7 +200,6 @@ private void Update()
OnPropertyChanged(nameof(CanCreateItem));
OnPropertyChanged(nameof(IsMultiPaneEnabled));
OnPropertyChanged(nameof(IsMultiPaneActive));
OnPropertyChanged(nameof(ShowSearchUnindexedItemsMessage));
OnPropertyChanged(nameof(IsGitRepository));
OnPropertyChanged(nameof(CanExecuteGitAction));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public interface IContentPageContext : INotifyPropertyChanged
bool IsMultiPaneEnabled { get; }
bool IsMultiPaneActive { get; }

bool ShowSearchUnindexedItemsMessage { get; }

bool IsGitRepository { get; }
bool CanExecuteGitAction { get; }

Expand Down
2 changes: 0 additions & 2 deletions src/Files.App/Data/EventArguments/NavigationArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ public class NavigationArguments

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

public bool SearchUnindexedItems { get; set; } = false;

public bool IsLayoutSwitch { get; set; } = false;

public IEnumerable<string>? SelectItems { get; set; }
Expand Down
19 changes: 0 additions & 19 deletions src/Files.App/Data/Models/CurrentInstanceViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public bool IsPageTypeSearchResults
SetProperty(ref isPageTypeSearchResults, value);
OnPropertyChanged(nameof(CanCreateFileInPage));
OnPropertyChanged(nameof(CanCopyPathInPage));
OnPropertyChanged(nameof(ShowSearchUnindexedItemsMessage));
}
}

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

private bool searchedUnindexedItems;
public bool SearchedUnindexedItems
{
get => searchedUnindexedItems;
set
{
if (SetProperty(ref searchedUnindexedItems, value))
{
OnPropertyChanged(nameof(ShowSearchUnindexedItemsMessage));
}
}
}

public bool ShowSearchUnindexedItemsMessage
{
get => !SearchedUnindexedItems && IsPageTypeSearchResults;
}

private bool isPageTypeNotHome = false;
public bool IsPageTypeNotHome
{
Expand Down
7 changes: 0 additions & 7 deletions src/Files.App/Services/Settings/GeneralSettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ public GeneralSettingsService(ISettingsSharingContext settingsSharingContext)
RegisterSettingsContext(settingsSharingContext);
}

public bool SearchUnindexedItems
{
get => Get(false);
set => Set(value);
}

public bool OpenSpecificPageOnStartup
{
get => Get(false);
Expand Down Expand Up @@ -267,7 +261,6 @@ protected override void RaiseOnSettingChangedEvent(object sender, SettingChanged
{
switch (e.SettingName)
{
case nameof(SearchUnindexedItems):
case nameof(OpenSpecificPageOnStartup):
case nameof(ContinueLastSessionOnStartUp):
case nameof(OpenNewTabOnStartup):
Expand Down
12 changes: 0 additions & 12 deletions src/Files.App/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,6 @@
<data name="ShowProtectedSystemFiles" xml:space="preserve">
<value>Show protected system files</value>
</data>
<data name="SettingsSearchUnindexedItems" xml:space="preserve">
<value>Include unindexed items in search results</value>
</data>
<data name="SyncFolderPreferencesAcrossDirectories" xml:space="preserve">
<value>Sync layout and sorting preferences across directories</value>
</data>
Expand Down Expand Up @@ -1281,12 +1278,6 @@
<data name="PropertyISO" xml:space="preserve">
<value>ISO speed</value>
</data>
<data name="SearchUnindexedItemsLabel.Text" xml:space="preserve">
<value>Didn't find what you're looking for?</value>
</data>
<data name="SearchUnindexedItemsButton.Content" xml:space="preserve">
<value>Search unindexed items</value>
</data>
<data name="ReplaceExisting" xml:space="preserve">
<value>Replace existing</value>
</data>
Expand Down Expand Up @@ -2968,9 +2959,6 @@
<data name="ShowCheckboxesWhenSelectingItems" xml:space="preserve">
<value>Show checkboxes when selecting items</value>
</data>
<data name="SearchUnindexedItemsDescription" xml:space="preserve">
<value>Search for unindexed items</value>
</data>
<data name="EditPathDescription" xml:space="preserve">
<value>Focus path bar</value>
</data>
Expand Down
5 changes: 1 addition & 4 deletions src/Files.App/Utils/Storage/Search/FolderSearch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public class FolderSearch

public uint MaxItemCount { get; set; } = 0; // 0: no limit
public uint ThumbnailSize { get; set; } = 24;
public bool SearchUnindexedItems { get; set; } = false;

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

Expand Down Expand Up @@ -515,9 +514,7 @@ private QueryOptions ToQueryOptions()
UserSearchFilter = AQSQuery ?? string.Empty,
};

query.IndexerOption = SearchUnindexedItems
? IndexerOption.DoNotUseIndexer
: IndexerOption.OnlyUseIndexerAndOptimizeForIndexedProperties;
query.IndexerOption = IndexerOption.UseIndexerWhenAvailable;

query.SortOrder.Clear();
query.SortOrder.Add(new SortEntry { PropertyName = "System.Search.Rank", AscendingOrder = false });
Expand Down
19 changes: 2 additions & 17 deletions src/Files.App/ViewModels/Settings/GeneralViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using Microsoft.Extensions.Logging;
using System.Collections.Specialized;
using System.Globalization;
using Windows.Globalization;
Expand Down Expand Up @@ -159,7 +158,7 @@ private void InitStartupSettingsRecentFoldersFlyout()
CommandParameter = "Home",
Tooltip = "Home".GetLocalizedResource()
});
recentsItem.Items.Add(new MenuFlyoutItemViewModel("Browse".GetLocalizedResource()) { Command = AddPageCommand });
recentsItem.Items.Add(new MenuFlyoutItemViewModel("Browse".GetLocalizedResource()) { Command = AddPageCommand });
}

private void PagesOnStartupList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
Expand Down Expand Up @@ -332,7 +331,7 @@ private FolderPicker InitializeWithWindow(FolderPicker obj)

private void RemovePage(PageOnStartupViewModel page)
{
PagesOnStartupList.Remove(page);
PagesOnStartupList.Remove(page);
}

private async Task AddPageAsync(string path = null)
Expand Down Expand Up @@ -369,20 +368,6 @@ public DateTimeFormats DateTimeFormat
}
}

public bool SearchUnindexedItems
{
get => UserSettingsService.GeneralSettingsService.SearchUnindexedItems;
set
{
if (value != UserSettingsService.GeneralSettingsService.SearchUnindexedItems)
{
UserSettingsService.GeneralSettingsService.SearchUnindexedItems = value;

OnPropertyChanged();
}
}
}

public bool ShowQuickAccessWidget
{
get => UserSettingsService.GeneralSettingsService.ShowQuickAccessWidget;
Expand Down
2 changes: 0 additions & 2 deletions src/Files.App/Views/Layouts/BaseLayoutPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,6 @@ protected virtual void BaseFolderSettings_LayoutModeChangeRequested(object? send
IsSearchResultPage = navigationArguments.IsSearchResultPage,
SearchPathParam = navigationArguments.SearchPathParam,
SearchQuery = navigationArguments.SearchQuery,
SearchUnindexedItems = navigationArguments.SearchUnindexedItems,
IsLayoutSwitch = true,
AssociatedTabInstance = ParentShellPageInstance
});
Expand Down Expand Up @@ -469,7 +468,6 @@ protected override async void OnNavigatedTo(NavigationEventArgs e)
Query = navigationArguments.SearchQuery,
Folder = navigationArguments.SearchPathParam,
ThumbnailSize = InstanceViewModel!.FolderSettings.GetIconSize(),
SearchUnindexedItems = navigationArguments.SearchUnindexedItems
};

_ = ParentShellPageInstance.FilesystemViewModel.SearchAsync(searchInstance);
Expand Down
2 changes: 0 additions & 2 deletions src/Files.App/Views/Layouts/ColumnsLayoutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
Column = 0,
IsSearchResultPage = navigationArguments.IsSearchResultPage,
SearchQuery = navigationArguments.SearchQuery,
SearchUnindexedItems = navigationArguments.SearchUnindexedItems,
SearchPathParam = navigationArguments.SearchPathParam,
NavPathParam = path,
SelectItems = path == navigationArguments.NavPathParam ? navigationArguments.SelectItems : null
Expand Down Expand Up @@ -392,7 +391,6 @@ public void SetSelectedPathOrNavigate(string navigationPath, Type sourcePageType
{
columnParam.IsSearchResultPage = navArgs.IsSearchResultPage;
columnParam.SearchQuery = navArgs.SearchQuery;
columnParam.SearchUnindexedItems = navArgs.SearchUnindexedItems;
columnParam.SearchPathParam = navArgs.SearchPathParam;
}

Expand Down
15 changes: 0 additions & 15 deletions src/Files.App/Views/Layouts/DetailsLayoutPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1509,21 +1509,6 @@

</SemanticZoom>

<!-- Search Unindexed Items -->
<StackPanel
x:Name="SearchUnindexedItemsPanel"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
x:Load="{x:Bind Commands.SearchUnindexedItems.IsExecutable, Mode=OneWay}"
Orientation="Vertical">
<TextBlock Text="{helpers:ResourceString Name=SearchUnindexedItemsLabel/Text}" />
<HyperlinkButton
x:Name="SearchUnindexedItemsButton"
HorizontalAlignment="Center"
Command="{x:Bind Commands.SearchUnindexedItems}"
Content="{x:Bind Commands.SearchUnindexedItems.Label}" />
</StackPanel>

<!-- Selector -->
<Canvas HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Rectangle
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ private void TagItem_Tapped(object sender, TappedRoutedEventArgs e)
if (tagName is null)
return;

ParentShellPageInstance?.SubmitSearch($"tag:{tagName}", false);
ParentShellPageInstance?.SubmitSearch($"tag:{tagName}");
}

private void FileTag_PointerEntered(object sender, PointerRoutedEventArgs e)
Expand Down
16 changes: 0 additions & 16 deletions src/Files.App/Views/Layouts/GridLayoutPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -654,22 +654,6 @@
</GroupStyle>
</toolkit:AdaptiveGridView.GroupStyle>

<!-- Search Unindexed Items -->
<toolkit:AdaptiveGridView.Footer>
<StackPanel
x:Name="SearchUnindexedItemsPanel"
HorizontalAlignment="Stretch"
x:Load="{x:Bind Commands.SearchUnindexedItems.IsExecutable, Mode=OneWay}"
Orientation="Vertical">
<TextBlock HorizontalTextAlignment="Center" Text="{helpers:ResourceString Name=SearchUnindexedItemsLabel/Text}" />
<HyperlinkButton
x:Name="SearchUnindexedItemsButton"
HorizontalAlignment="Center"
Command="{x:Bind Commands.SearchUnindexedItems}"
Content="{x:Bind Commands.SearchUnindexedItems.Label}" />
</StackPanel>
</toolkit:AdaptiveGridView.Footer>

<toolkit:AdaptiveGridView.ItemContainerStyle>
<Style BasedOn="{StaticResource DefaultGridViewItemStyle}" TargetType="GridViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
Expand Down
11 changes: 0 additions & 11 deletions src/Files.App/Views/Settings/GeneralPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,6 @@
</ComboBox>
</local:SettingsBlockControl>

<!-- Search settings -->
<local:SettingsBlockControl Title="{helpers:ResourceString Name=SettingsSearchUnindexedItems}" HorizontalAlignment="Stretch">
<local:SettingsBlockControl.Icon>
<FontIcon Glyph="&#xE721;" />
</local:SettingsBlockControl.Icon>
<ToggleSwitch
AutomationProperties.Name="{helpers:ResourceString Name=SettingsSearchUnindexedItems}"
IsOn="{x:Bind ViewModel.SearchUnindexedItems, Mode=TwoWay}"
Style="{StaticResource RightAlignedToggleSwitchStyle}" />
</local:SettingsBlockControl>

<!-- Startup settings -->
<local:SettingsBlockControl Title="{helpers:ResourceString Name=StartupSettings}" HorizontalAlignment="Stretch">
<local:SettingsBlockControl.Icon>
Expand Down
Loading