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

QNTM-5869: Search keywords split mechanism #9271

Merged
merged 18 commits into from
Dec 14, 2018
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
4 changes: 2 additions & 2 deletions src/AssemblySharedInfoGenerator/AssemblySharedInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
// to distinguish one build from another. AssemblyFileVersion is specified
// in AssemblyVersionInfo.cs so that it can be easily incremented by the
// automated build process.
[assembly: AssemblyVersion("2.1.0.4395")]
[assembly: AssemblyVersion("2.1.0.6957")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should usually not commit this file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, reverting this



// By default, the "Product version" shown in the file properties window is
Expand All @@ -64,4 +64,4 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("2.1.0.4395")]
[assembly: AssemblyFileVersion("2.1.0.6957")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that this file is usually included in PRs.

12 changes: 12 additions & 0 deletions src/DynamoCore/Search/SearchDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class SearchDictionary<V>
protected readonly Dictionary<V, Dictionary<string, double>> entryDictionary =
new Dictionary<V, Dictionary<string, double>>();

public bool experimentalSearch = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be made private?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I can make it private here because I need to be able to access it from the DynamoViewModel. Maybe I'm missing something?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one option because this is an internal API is mark this internal and use [internalsVisibleAttribute] to make this property accessible from DynamoCoreWPF assembly.


/// <summary>
/// All the current entries in search.
/// </summary>
Expand Down Expand Up @@ -310,6 +312,16 @@ internal IEnumerable<V> Search(string query, int minResultsForTolerantSearch = 0
query = query.ToLower();

var subPatterns = SplitOnWhiteSpace(query);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as a question; should this code be wrapped in #if DEBUG statements? Probably not necessary, but I am doing the same type of code and wanted to get the group thought about if it is needed/wanted or not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think because this code is already in the debug only menu it's fine not to use a compiler flag. On the other hand, for performance impacting code - like Console.WriteLine I would use a debug flag:
https://stackoverflow.com/questions/18464833/console-writeline-effect-on-performance

// Experimental Search
if (experimentalSearch)
{
var subPatternsList = subPatterns.ToList();
subPatternsList.Add(query);
subPatterns = (subPatternsList).ToArray();
subPatterns = new string[] { "test" };
}

foreach (var pair in tagDictionary.Where(x => MatchWithQueryString(x.Key, subPatterns)))
{
ComputeWeightAndAddToDictionary(query, pair, searchDict);
Expand Down
9 changes: 9 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ It does not contain your graph or any personal data</value>
<comment>Settings menu | Geometry Scaling</comment>
</data>
<data name="DynamoViewSettingsMenuIsolationMode" xml:space="preserve">
<value>Isolate Selected Geometries</value>
<value>Isolate Selected Geometry</value>
</data>
<data name="DynamoViewSettingsMenuShowEdges" xml:space="preserve">
<value>Show Edges</value>
Expand Down Expand Up @@ -1619,10 +1619,10 @@ Next assemblies were loaded several times:
<value>Package Path Added</value>
</data>
<data name="PackagePathAutoAddNotificationShortDescription" xml:space="preserve">
<value>A library (*.dll, *.ds) was recently imported into Dynamo. Its path was automatically added to "Settings > Manage Node and Package Paths..."</value>
<value>A library (*.dll, *.ds) was recently imported into Dynamo. Its path was automatically added to "Settings &gt; Manage Node and Package Paths..."</value>
</data>
<data name="PackagePathAutoAddNotificationDetailedDescription" xml:space="preserve">
<value>The import path "{0}" was added to "Manage Node and Package Paths". If you want to update or remove this path, please open "Settings > Manage Node and Package Paths..."</value>
<value>The import path "{0}" was added to "Manage Node and Package Paths". If you want to update or remove this path, please open "Settings &gt; Manage Node and Package Paths..."</value>
</data>
<data name="PackageSearchStateNoResult" xml:space="preserve">
<value>Search returned no results!</value>
Expand Down Expand Up @@ -1855,9 +1855,6 @@ Want to publish a different package?</value>
<data name="PublishPackageViewPackageVersion" xml:space="preserve">
<value>Version (major minor build)</value>
</data>
<data name="DynamoViewSettingsMenuIsolationMode" xml:space="preserve">
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure where these resource changes are coming from

<value>Isolate Selected Geometry</value>
</data>
<data name="PublishPackageViewPackageVersionTooltip" xml:space="preserve">
<value>A version name helps a submitter keep track of updates to the package. A new version of a package will be REJECTED if this is not incremeneted.</value>
</data>
Expand Down Expand Up @@ -2199,4 +2196,8 @@ Do you want to install the latest Dynamo update?</value>
<data name="RerunButtonToolTip" xml:space="preserve">
<value>Rerun the graph.</value>
</data>
<data name="DynamoViewDebugMenuExperimentalSearch" xml:space="preserve">
<value>Experimental Search</value>
<comment>Debug menu | Experimental Search</comment>
</data>
</root>
8 changes: 6 additions & 2 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1961,10 +1961,10 @@ Do you want to install the latest Dynamo update?</value>
<value>Package Path Added</value>
</data>
<data name="PackagePathAutoAddNotificationShortDescription" xml:space="preserve">
<value>A library (*.dll, *.ds) was recently imported into Dynamo. Its path was automatically added to "Settings > Manage Node and Package Paths..."</value>
<value>A library (*.dll, *.ds) was recently imported into Dynamo. Its path was automatically added to "Settings &gt; Manage Node and Package Paths..."</value>
</data>
<data name="PackagePathAutoAddNotificationDetailedDescription" xml:space="preserve">
<value>The import path "{0}" was added to "Manage Node and Package Paths". If you want to update or remove this path, please open "Settings > Manage Node and Package Paths..."</value>
<value>The import path "{0}" was added to "Manage Node and Package Paths". If you want to update or remove this path, please open "Settings &gt; Manage Node and Package Paths..."</value>
</data>
<data name="NodeContextMenuIsInput" xml:space="preserve">
<value>Is Input</value>
Expand Down Expand Up @@ -2196,4 +2196,8 @@ 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="DynamoViewDebugMenuExperimentalSearch" xml:space="preserve">
<value>Experimental Search</value>
<comment>Debug menu | Experimental Search</comment>
</data>
</root>
9 changes: 9 additions & 0 deletions src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,15 @@ public bool EnableTSpline
}
}

public bool ExperimentalSearch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should have a summary /// tag if this a public API - does it need to be public?

{
get { return model.SearchModel.experimentalSearch; }
set
{
model.SearchModel.experimentalSearch = value;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess in this case it's not such a big deal, but you usually would not modify a field from another object - I think instead we usually use a property, in this case I think it makes sense to try and hide this field from external consumers - we don't want anyone to use it - in an extension for example.

}
}

public int LibraryWidth
{
get
Expand Down
5 changes: 5 additions & 0 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,11 @@
IsCheckable="True"
IsChecked="{Binding EnableTSpline}"
Header="{x:Static p:Resources.DynamoViewSettingEnableTSplineNodes}" />
<MenuItem Focusable="False"
Name="ExperimentalSearch"
IsCheckable="True"
IsChecked="{Binding ExperimentalSearch}"
Header="{x:Static p:Resources.DynamoViewDebugMenuExperimentalSearch}" />
</MenuItem>
</MenuItem>

Expand Down