Skip to content
Permalink
Browse files

Bring search improvements out from behind debug menu (#9332)

* update

* Brought truncated search results and full query search out from behind debug menu. Deleted debug menu items.

* revert AssemblySharedInfo

* Updated search dicitonary to return top 30 results

* Revert search dicitonary to return top 20 results
  • Loading branch information...
scottmitchell committed Dec 19, 2018
1 parent 2f1a175 commit e57ca187836866b99e043650e63b0cf16f42f8a0
@@ -25,19 +25,9 @@ internal SearchDictionary(ILogger logger = null)

protected readonly Dictionary<V, Dictionary<string, double>> entryDictionary =
new Dictionary<V, Dictionary<string, double>>();

/// <summary>
/// Indicates whether experimental search mode is turned on.
/// </summary>
internal bool ExperimentalSearch { get; set; } = false;

private List<IGrouping<string, Tuple<V, double>>> tagDictionary;

/// <summary>
/// Indicates whether to truncate the search results (currently to 20 items).
/// </summary>
internal bool TruncateSearchResults { get; set; } = false;

/// <summary>
/// All the current entries in search.
/// </summary>
@@ -356,13 +346,10 @@ internal IEnumerable<V> Search(string query, int minResultsForTolerantSearch = 0

var subPatterns = SplitOnWhiteSpace(query);

// Experimental Search
if (ExperimentalSearch)
{
var subPatternsList = subPatterns.ToList();
subPatternsList.Insert(0, query);
subPatterns = (subPatternsList).ToArray();
}
// Add full (unsplit by whitespace) query to subpatterns
var subPatternsList = subPatterns.ToList();
subPatternsList.Insert(0, query);
subPatterns = (subPatternsList).ToArray();

foreach (var pair in tagDictionary.Where(x => MatchWithQueryString(x.Key, subPatterns)))
{
@@ -372,11 +359,10 @@ internal IEnumerable<V> Search(string query, int minResultsForTolerantSearch = 0
var orderedSearchDict = searchDict.OrderByDescending(x => x.Value);

var searchResults = orderedSearchDict.Select(x => x.Key);
if (TruncateSearchResults)
{
searchResults = searchResults.Take(20);
}

// return only the top 20 search results
searchResults = searchResults.Take(20);

#if DEBUG
if (this.logger != null)
{

Some generated files are not rendered by default. Learn more.

@@ -2188,12 +2188,4 @@ Do you want to install the latest Dynamo update?</value>
<data name="RerunButtonToolTip" xml:space="preserve">
<value>Rerun the graph.</value>
</data>
<data name="DynamoViewDebugMenuTruncateSearchResults" xml:space="preserve">
<value>Truncate Search Results</value>
<comment>Debug Menu | Truncate Search Results</comment>
</data>
<data name="DynamoViewDebugMenuExperimentalSearch" xml:space="preserve">
<value>Experimental Search</value>
<comment>Debug menu | Experimental Search</comment>
</data>
</root>
@@ -2188,12 +2188,4 @@ Want to publish a different package?</value>
<value>Custom Nodes will be placed in the Add-Ons section of the library.</value>
<comment>Note regarding Custom Node library location</comment>
</data>
<data name="DynamoViewDebugMenuTruncateSearchResults" xml:space="preserve">
<value>Truncate Search Results</value>
<comment>Debug menu | Truncate Search Results</comment>
</data>
<data name="DynamoViewDebugMenuExperimentalSearch" xml:space="preserve">
<value>Experimental Search</value>
<comment>Debug Menu | Experimental Search</comment>
</data>
</root>
@@ -291,31 +291,6 @@ public bool EnableTSpline
}
}

/// <summary>
/// Indicates whether experimental search mode is turned on.
/// For internal debug use only. Do not use!
/// </summary>
public bool ExperimentalSearch
{
get { return model.SearchModel.ExperimentalSearch; }
set
{
model.SearchModel.ExperimentalSearch = value;
}
}

/// <summary>
/// Indicates whether search results should be truncated (currently to 20 items).
/// </summary>
public bool TruncateSearchResults
{
get { return model.SearchModel.TruncateSearchResults; }
set
{
model.SearchModel.TruncateSearchResults = value;
}
}

public int LibraryWidth
{
get
@@ -784,16 +784,6 @@
IsCheckable="True"
Header="{x:Static p:Resources.DynamoViewDebugMenuShowDebugAST}"
IsChecked="{Binding ShowDebugASTs}"></MenuItem>
<MenuItem Focusable="False"
Name="TruncateSearchResults"
IsCheckable="True"
IsChecked="{Binding TruncateSearchResults}"
Header="{x:Static p:Resources.DynamoViewDebugMenuTruncateSearchResults}" />
<MenuItem Focusable="False"
Name="ExperimentalSearch"
IsCheckable="True"
IsChecked="{Binding ExperimentalSearch}"
Header="{x:Static p:Resources.DynamoViewDebugMenuExperimentalSearch}" />
<MenuItem Focusable="False"
Name="ForceReexec"
Header="{x:Static p:Resources.DynamoViewDebugMenuForceReExecute}"

0 comments on commit e57ca18

Please sign in to comment.
You can’t perform that action at this time.