Adding AdvancedSearchManager to support Search API Integration#59
Adding AdvancedSearchManager to support Search API Integration#59afoote-mitre wants to merge 12 commits intodevfrom
Conversation
| } | ||
|
|
||
| //support for date ranges | ||
| export class rangeObject { |
There was a problem hiding this comment.
In the future, we should consider standardizing on the IsoDate classes (/src/common/IsoDate), specifically in this case, the IsoDatetimeRange for the rangeStart and rangeEnd fields. It's very robust for what the end user may type in
| * @param options options to specify how to search, with well-defined defaults | ||
| * @param queryString query strings for each filter on the search request | ||
| */ | ||
| async apiSearch(searchText: string, options: Partial<SearchAPIOptions> = undefined, queryStrings?: Array<object>): Promise<CveResult> { |
There was a problem hiding this comment.
based on how it's used in the e2e test, searchText and options should all use the "?:" style in queryStrings for consistency, succinctness, and to avoid eslint errors, since all of them can be optional (though not all).
It's a little strange to have 3 optional and orthogonal params in the parameter list, and 2 parameters that look very similar. I'm going to approve this, but I think it should be refactored later to a more standard style.
| const queryStrings = [ | ||
| { | ||
| query_string: { | ||
| query: 'data', | ||
| fields: ['containers.cna.descriptions.value'], | ||
| default_operator: 'AND' | ||
| } | ||
| }, | ||
| ]; |
Note: Please format the pull request title like:
"Resolves issue #58 , High level description of pull request."
Closes Issue #58
Summary
Adds an AdvancedSearchManager class to facilitate filtered searching by the Search API
Important Changes
src/search/AdvancedSearchManager.tssrc/search/AdvancedSearchManager.test.e2e.ts