`search` feature revamp
- Dominant language
- JavaScript
- Stars
- 171
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
## Bugs
* [x] result counts in SearchBar remains `(N/A)` even there are some results
* [x] Test with express#1, `searchTerm='get,put,get'`
## search functions
* [x] implement multiple search modes
* [x] contexts
* [x] traces
* [ ] primtive values (matching only number and string values via `val.includes(searchTerm)`)
* Make sure that primitives that are nested inside of other values are also searched.
* e.g.: we should find 5 `hi`s inside: `var s = 'hi'; var a = [[[['hi']], { x: 'hi' } ]].concat(s, s)`
* make unique by `valueId` so that `var s = 'hi'` only generates 1 (and not 2 or 3) match(es).
* -> maybe add duplicate occurrences of same `valueId` as children to the "first found node"?
* [ ] modules
* [ ] object keys
* e.g., there should be 3 `x`'s inside: `var b = { x: { x: { ['a'] }, x: 'b' }`
* [ ] if search targets elements of smaller size than context (i.e. trace):
* [ ] show separate count and next/previous buttons for traces
* [ ] select relevant traces when going through search results
* [ ] allow mixture of different search options, with parentheses and `AND` and `OR` relationships
* [ ] e.g. `(context(a) && context(b)) || module(c) || (context(d) && trace(e))`
* -> consider using a parser library for this, e.g.
* https://stackoverflow.com/questions/23325832/parse-arithmetic-expression-with-javascript
* https://stackoverflow.com/questions/2276021/evaluating-a-string-as-a-mathematical-expression-in-javascript
## UI
* [ ] add one command per search mode. When executed:
* [x] the command takes you to the Call Graph (if not open)
* [ ] sets the search mode to enabled and focuses the text `input` box.
## Tests
* [x] check express#1: can we quickly find the bug by searching for `GET,PUT,GET`?
## Done
* [x] when clicking on a `value`, it goes to the context, not the trace.
* [x] remove the second search button
* [x] replace the first button with a drop down to select the search mode
* [x] new component `Search Manager`(or `Search Bar`) which acts like common search bar in Chrome, including
* [x] show match counts
* [x] previous/next button
* [x] clear search button
* [x] able to toggle the search bar through original search buttons
* [x] show all results in a new `SearchResultsNode` [in the new `GlobalAnalysisView` using a `TraceContainerNode`](https://github.com/Domiii/dbux/issues/618), and focus and expand that node
* [x] when exiting search mode, make sure to reset highlights/focus
* [x] stop searching when pressing `Esc`
* probably want to add a listener to `document` in `GraphDocument.setupEl`
* see https://stackoverflow.com/a/64446856
* [x] make sure, search feature searches all active applications
* see https://github.com/Domiii/dbux/pull/628/files#r771931771
* [x] move search features to `SearchController` class, similar to the controllers we use for TreeViews.
Contributor guide
Assessment
This issue has not been assessed yet.