-
Notifications
You must be signed in to change notification settings - Fork 635
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
DYN-5787 LuceneNET in the InCanvasSearch functionality #14013
DYN-5787 LuceneNET in the InCanvasSearch functionality #14013
Conversation
…earch feat: Implementation of the Search functionality in the InCanvasSearch popup using Lucene.NE. Most of the code is coming from the next Dynamo branch: https://github.com/DynamoDS/Dynamo/tree/AlternativeSearch I added code for indexing information for the code block (I had to add a default constructor for CodeBlockNodeModel), input and output nodes and also I didn't include the code related to indexing/search info related to packages or node documentation.
var fullDoc = new TextField("Documentation", "", Field.Store.YES); | ||
|
||
var pkgName = new TextField("PackageName", "", Field.Store.YES); | ||
var pkgVer = new TextField("PackageVersion", "", Field.Store.YES); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a TODO comment to move these hard coded string to a different class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added comment, see commit: 9af2277
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can later maintain a key/value data structure, such as a Dictionary, to store field name with their value type, so that we won't have to worry about what type we used for each field.
Added several comments and removed unused fields.
I see lots of regressions in the PR check
Looks like the tests are running in parallel to try to index nodes and write to the same location, we might want to disable this function when under test mode and write dedicated test for index if needed. FYI: @mjkkirschner |
|
||
private void InitializeLuceneConfig() | ||
{ | ||
addedFields = new List<string>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skip these during TestMode I guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we skip indexing during tests, how do we want to handle the search tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking creating dedicated tests for index and search in a single test or try to make it work when running in parallel? The current setup will not work for sure, unfortunately..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zeusongit There should be new dlls from this PR, how should dev be notified? If there are new files, should we mark a different state for the PR check? |
@RobertGlobant20 I also tested some edge cases in this fork but seems some regular nodes are not indexed correctly. |
But failing the check won't make sense if those changes are expected, but we also don't have any other option. |
@zeusongit There are ways to introduce warning, we dont have to fail the check but the current way is not informative enough IMHO. See something like https://stackoverflow.com/questions/74907704/is-there-a-github-actions-warning-state |
This looks good, will try to implement this! |
Fix for adding missing nodes Added some validation for preventing null values Adding comments in the SetDocumentFieldValue
…m/RobertGlobant20/Dynamo into DYN-5787-LuceneNET-InCanvasSearch
Fixed, please double check |
Not sure if the PR check would pass now, I think the lock issue would still happen with all of the test initializing DynamoModel and indexing at the same time |
Fix for checking If app is in TestMode then we don't initialize LuceneNET. Added the previous Search method due that is used by Unit Tests ( previously when running the parallel job that execute the tests in Jenkins is failing due that several processes are trying to create files in AppData folder), so now we will have the previous Search method and the Search method for Lucene.NET.
@RobertGlobant20 I gave some updates to the PR and also trying to re-trigger the PR checks because the earlier build failed |
@RobertGlobant20 There are 4068 regressions reported still |
@reddyashish @zeusongit @RobertGlobant20 I think I figured it out, we are trying to initialize Lucene index writer every time as part of Dynamo initialization, and this causes a lock issue when running tests in parallel. We can do some search to optimize that process specifically after this PR but for now I added code to skip the writer initialization in TestMode, which would also mean Lucene search is disabled in Unit tests for now. We can off course write tests including Lucene initialization and test only within the Unit test. Let's look at best approach after this PR. I would like to get this in so we can unblock follow up work. |
// TODO: make Lucene writer a singleton | ||
if (!IsTestMode) | ||
{ | ||
writer = new IndexWriter(indexDir, indexConfig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reddyashish @RobertGlobant20 @zeusongit This line cant be run in parallel as unit tests
Fixing regressions due that some test are failing.
…m/RobertGlobant20/Dynamo into DYN-5787-LuceneNET-InCanvasSearch
Adding the Input and Output nodes are breaking the tests (due that we have two input and two output nodes), then removing the indexing of this nodes. Other tests were failing due that writer?.Dispose() disposed the object but later (when opening the dyn file) is trying to index again the nodes and the writer instance was already disposed.
@RobertGlobant20 This should be finalized, PTAL From debugging, a majority of the dlls added are also loaded when Dynamo opened. |
Purpose
feat: Implementation of the Search functionality in the InCanvasSearch popup using Lucene.NET.
Most of the code is coming from the next Dynamo branch: https://github.com/DynamoDS/Dynamo/tree/AlternativeSearch I added code for indexing information for the code block (I had to add a default constructor for CodeBlockNodeModel), input and output nodes and also I didn't include the code related to indexing/search info related to packages or node documentation.
Declarations
Check these if you believe they are true
*.resx
filesRelease Notes
Implementation of the Search functionality in the InCanvasSearch popup using Lucene.NET.
Reviewers
@QilongTang
FYIs
@reddyashish