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

Add search functionality to Node Autocomplete window. #11192

Merged
merged 8 commits into from
Nov 5, 2020

Conversation

reddyashish
Copy link
Contributor

@reddyashish reddyashish commented Oct 20, 2020

Purpose

This PR adds the search functionality to the Node Autocomplete window.
Task: https://jira.autodesk.com/browse/DYN-3136

TODO:

  1. Working on the tests.

search node autocompletion

We are caching the list of matching nodes after they are calculated for the first time and re-use them.

As of now, we are just matching the node name with the user input. If we want to match for any other node property, we can add the necessary condition.

Declarations

Check these if you believe they are true

  • The codebase 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.
  • This PR modifies some build requirements and the readme is updated

Reviewers

@DynamoDS/dynamo

@mjkkirschner
Copy link
Member

@reddyashish could you add info to this PR about how this works?

@reddyashish reddyashish changed the title [WIP] Add search functionality to Node Autocomplete window. Add search functionality to Node Autocomplete window. Nov 2, 2020
Copy link
Contributor

@QilongTang QilongTang left a comment

Choose a reason for hiding this comment

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

Looking solid, would love to see some clean up and a unit test to cover the search function

@QilongTang
Copy link
Contributor

One last comment

if (PortViewModel == null) return;

FilteredResults = searchElementsCache.Where(e =>
QuerySearchElements(e, input)).Select(e =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we not use the same search algorithm as the one used for in-canvas search?

Copy link
Contributor Author

@reddyashish reddyashish Nov 4, 2020

Choose a reason for hiding this comment

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

For the incanvas search we use the search command on the model and search for all the nodes in the library. It doesn't search in a specific list of nodes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I got that but can we not use the same algorithm/methods, refactor some code, etc?

Copy link
Contributor

Choose a reason for hiding this comment

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

@aparajit-pratap Can you be more specific? We are not using the same algorithm here right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, Aparajit is asking if we could use the same algorithm to search. https://github.com/DynamoDS/Dynamo/blob/master/src/DynamoCore/Search/SearchDictionary.cs#L327

We can use it with some changes but since the list of search elements won't be that long and we are checking just the name, I kept it simple without using the weights and time. What do you guys think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this looks good for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should keep the search algorithm consistent irrespective of how many search elements there might be. I think one of @Amoursol's points of emphasis was that search is key for the node autocomplete feature. We should at least create an improvement task for this to address in the near future.

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed @aparajit-pratap - now that I'm back we will spin up a conversation around Search :) For Node Autocomplete to be as successful as we want it to be, Search also needs to be robust.

@reddyashish
Copy link
Contributor Author

@QilongTang Refactored the code and fixed the tests.

Copy link
Contributor

@QilongTang QilongTang left a comment

Choose a reason for hiding this comment

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

LGTM

@QilongTang QilongTang added this to the 2.9.0 milestone Nov 5, 2020
@QilongTang
Copy link
Contributor

@reddyashish Can we merge and cherry-pick to RC2.9.0?

@reddyashish reddyashish merged commit f00b2f7 into DynamoDS:master Nov 5, 2020
reddyashish added a commit to reddyashish/Dynamo that referenced this pull request Nov 5, 2020
* First commit

* Cache the seeach elements after the matching nodes have been calculated.

* Add comments

* some comments.

* Adding a test

* Addressing some comments.

* Some refactoring.

(cherry picked from commit f00b2f7)
QilongTang pushed a commit that referenced this pull request Nov 5, 2020
* First commit

* Cache the seeach elements after the matching nodes have been calculated.

* Add comments

* some comments.

* Adding a test

* Addressing some comments.

* Some refactoring.

(cherry picked from commit f00b2f7)
@reddyashish reddyashish deleted the Node-autocomplete branch November 23, 2022 07:34
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.

5 participants