Skip to content
Permalink
Browse files

QNTM-5869: Search keywords split mechanism (#9271)

* Added Experimental Search item to debug menu

* Added Experimental Search item to debug menu

* Adding mechanism to turn ExperimentalSearch on and off

* moved Experimental Search to Settings > Experimental

* Cleaned up Experimental Search

* Cleaned up Experimental Search

* Revert AssemblySharedInfo. Added summaries for public API

* Revert AssemblySharedInfo. Added summaries for public API

* Made ExperimentalSearch bool private

* Revert resources

* Added Experimental Search resource

* Insert full query at front of subpatterns list

* updating Experimental Search access

* Updated resources. Added comments.

* Removed unnecessary experimentalSearch backing field
  • Loading branch information...
scottmitchell committed Dec 14, 2018
1 parent 8589ac4 commit 83f06003afbf835668aab9fd5e5a1ef5d7562e5f
@@ -25,6 +25,11 @@ 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;

@@ -350,6 +355,15 @@ internal IEnumerable<V> Search(string query, int minResultsForTolerantSearch = 0
query = query.ToLower();

var subPatterns = SplitOnWhiteSpace(query);

// Experimental Search
if (ExperimentalSearch)
{
var subPatternsList = subPatterns.ToList();
subPatternsList.Insert(0, query);
subPatterns = (subPatternsList).ToArray();
}

foreach (var pair in tagDictionary.Where(x => MatchWithQueryString(x.Key, subPatterns)))
{
ComputeWeightAndAddToDictionary(query, pair, searchDict);

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

@@ -2192,4 +2192,8 @@ Do you want to install the latest Dynamo update?</value>
<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>
@@ -2192,4 +2192,8 @@ Want to publish a different package?</value>
<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,6 +291,19 @@ 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>
@@ -785,10 +785,15 @@
Header="{x:Static p:Resources.DynamoViewDebugMenuShowDebugAST}"
IsChecked="{Binding ShowDebugASTs}"></MenuItem>
<MenuItem Focusable="False"
Name="ExperimentalSearch"
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 83f0600

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