Skip to content

Adding AdvancedSearchManager to support Search API Integration#59

Open
afoote-mitre wants to merge 12 commits intodevfrom
dev-package-test
Open

Adding AdvancedSearchManager to support Search API Integration#59
afoote-mitre wants to merge 12 commits intodevfrom
dev-package-test

Conversation

@afoote-mitre
Copy link
Collaborator

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

  • New search manager extended from the BasicSearchManager
    src/search/AdvancedSearchManager.test.e2e.ts
  • e2e testing for the new search manager

@afoote-mitre afoote-mitre requested a review from hkong-mitre March 5, 2026 15:33
@afoote-mitre afoote-mitre self-assigned this Mar 5, 2026
}

//support for date ranges
export class rangeObject {
Copy link
Contributor

Choose a reason for hiding this comment

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

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> {
Copy link
Contributor

@hkong-mitre hkong-mitre Mar 6, 2026

Choose a reason for hiding this comment

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

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.

Comment on lines +39 to +47
const queryStrings = [
{
query_string: {
query: 'data',
fields: ['containers.cna.descriptions.value'],
default_operator: 'AND'
}
},
];
Copy link
Contributor

Choose a reason for hiding this comment

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

reformat this block

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.

4 participants