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

Conversation

scottmitchell
Copy link
Collaborator

@scottmitchell scottmitchell commented Nov 27, 2018

Purpose

This PR addresses jira task QNTM-5869: Search keywords split mechanism.

This PR does:

  • Creates a new menu item under Settings > Experimental that toggles Experimental Search
  • Adds the full, unsplit search query to the list of queries in the search algorithm (when Experimental Search is ON)

experimentalsearch

Declarations

Check these if you believe they are true

  • The code base is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning, and are documented in the API Changes document.

Reviewers

@mjkkirschner @ColinDayOrg @Racel

@@ -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

@@ -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

@@ -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.

@@ -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?

@@ -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.

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.

@mjkkirschner
Copy link
Member

mjkkirschner commented Nov 28, 2018

@scottmitchell some other thoughts -
have you looked at the debug menu?(debug menu only shows up in debug builds) This might actually be better than the experimental menu because it will not be discoverable to users... I don't know if that was @Racel 's intention or not.

You could also use an ifdef compile time flag using the debug config.

@Racel
Copy link
Contributor

Racel commented Nov 28, 2018

@mjkkirschner @scottmitchell Either menu works. Just need it in some menu for testing.... if it looks ok, we will probably just make it the standard.

@mjkkirschner
Copy link
Member

If thats the case and its not really for users, but for us, my feeling is that it should go into the debug menu - I would also like to hide the API since it doesn't seem like something we want people using from extensions or packages.

@Racel
Copy link
Contributor

Racel commented Nov 28, 2018

@mjkkirschner Sounds good to me. Let's put it in the debug menu and make the API private

@scottmitchell scottmitchell changed the title [WIP] QNTM-5869: Search keywords split mechanism QNTM-5869: Search keywords split mechanism Nov 28, 2018
@scottmitchell
Copy link
Collaborator Author

I think this is ready to go

@ColinDayOrg
Copy link
Contributor

LGTM :shipit:
Thanks for changing from Add to Insert(0) as well. I know it doesn't matter right now, but it may in the future.

@mjkkirschner
Copy link
Member

@scottmitchell is this waiting on something?

@QilongTang
Copy link
Contributor

@mjkkirschner This is waiting on @Racel 's review in R2020

@@ -310,6 +321,15 @@ 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

{
get { return experimentalSearch; }
set { experimentalSearch = value; }
}
Copy link
Contributor

Choose a reason for hiding this comment

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

When implementing my own debug mode VS suggested;
internal bool ExperimentalSearch { get; set; } = false;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ColinDayOrg Yep, that's cleaner. Fixed.

@mjkkirschner
Copy link
Member

@scottmitchell there's now conflicts on this branch from your other PR I think - might making @Racel 's review harder.

@scottmitchell
Copy link
Collaborator Author

@mjkkirschner Look's like it was caused by @ColinDayOrg 's PR. I'll fix.

@@ -785,10 +785,15 @@
Header="{x:Static p:Resources.DynamoViewDebugMenuShowDebugAST}"
IsChecked="{Binding ShowDebugASTs}"></MenuItem>
<MenuItem Focusable="False"
Name="ExperimentalSearch"
Name="TruncateSearchResults"
Copy link
Collaborator Author

@scottmitchell scottmitchell Dec 14, 2018

Choose a reason for hiding this comment

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

@ColinDayOrg FYI I renamed your menu item name

Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch, thanks. I am assuming that the "TruncateSearchResults" menu has been checked to test if it still works as expected after this change?

Copy link
Contributor

Choose a reason for hiding this comment

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

I just did a quick test to verify that the menu still works in the current master codebase after this specific change, so it seems ok to me.

@ColinDayOrg
Copy link
Contributor

Other than the one question, LGTM.

@scottmitchell scottmitchell merged commit 83f0600 into DynamoDS:master Dec 14, 2018
@Racel Racel mentioned this pull request Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants