Skip to content

Commit

Permalink
Merge branch 'advana-release/v1.33' into 'main'
Browse files Browse the repository at this point in the history
Advana release/v1.33 into main

See merge request advana/gamechanger/gamechanger-web-source!969
  • Loading branch information
melodie-bah committed Feb 24, 2023
2 parents be0c46d + bd10781 commit 5c820cb
Show file tree
Hide file tree
Showing 39 changed files with 788 additions and 797 deletions.
23 changes: 12 additions & 11 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,10 @@ dev-overrides:
VALUES_FILE: "dev.values.yaml"
extends:
- ".helm-overrides"
# TODO: temporarily pull values from library branch for refactored chart's values
script:
- |
git clone https://dev:${GITLAB_TOKEN}@gitlab.advana.boozallencsn.com/advana/gamechanger/gamechanger-ci-cd.git
git clone -b library https://dev:${GITLAB_TOKEN}@gitlab.advana.boozallencsn.com/advana/gamechanger/gamechanger-ci-cd.git
mv gamechanger-ci-cd/${VALUES_FILE} "${HELM_UPGRADE_VALUES_FILE}"
rm -rf gamechanger-ci-cd
Expand Down Expand Up @@ -242,11 +243,11 @@ trigger:
--set image.tag=${CI_COMMIT_SHA}-oci
--set appVersion=${BUILD_VERSION}
--set ingress.enabled=true
--set ingress.web.hostname=${HELM_RELEASE_NAME}
--set env.REACT_APP_BACKEND_URL=${DEV_URL}
--set env.REACT_APP_USER_TOKEN_ENDPOINT=${DEV_URL}/api/auth/token
--set env.REACT_APP_LOGIN_ROUTE=${DEV_URL}/login
--set env.APPROVED_API_CALLERS=${DEV_URL}
--set global.appName=${HELM_RELEASE_NAME}
--set deployment.web.container.gamechanger-web.env.REACT_APP_BACKEND_URL=${DEV_URL}
--set deployment.web.container.gamechanger-web.env.REACT_APP_USER_TOKEN_ENDPOINT=${DEV_URL}/api/auth/token
--set deployment.web.container.gamechanger-web.env.REACT_APP_LOGIN_ROUTE=${DEV_URL}/login
--set deployment.web.container.gamechanger-web.env.APPROVED_API_CALLERS=${DEV_URL}
- if: $DEPLOY_TO_PERSONAL != "false"
variables:
UPSTREAM_COMMIT_BRANCH: ${CI_COMMIT_BRANCH}
Expand All @@ -260,11 +261,11 @@ trigger:
--set image.tag=${CI_COMMIT_SHA}-oci
--set appVersion=${BUILD_VERSION}
--set ingress.enabled=true
--set ingress.web.hostname=${HELM_RELEASE_NAME}
--set env.REACT_APP_BACKEND_URL=${DEV_URL}
--set env.REACT_APP_USER_TOKEN_ENDPOINT=${DEV_URL}/api/auth/token
--set env.REACT_APP_LOGIN_ROUTE=${DEV_URL}/login
--set env.APPROVED_API_CALLERS=${DEV_URL}
--set global.appName=${HELM_RELEASE_NAME}
--set deployment.web.container.gamechanger-web.env.REACT_APP_BACKEND_URL=${DEV_URL}
--set deployment.web.container.gamechanger-web.env.REACT_APP_USER_TOKEN_ENDPOINT=${DEV_URL}/api/auth/token
--set deployment.web.container.gamechanger-web.env.REACT_APP_LOGIN_ROUTE=${DEV_URL}/login
--set deployment.web.container.gamechanger-web.env.APPROVED_API_CALLERS=${DEV_URL}
- if: $CI_COMMIT_BRANCH == "main"
# trigger:
# strategy: "depend"
Expand Down
6 changes: 4 additions & 2 deletions .gitlab/issue_templates/bugfix.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<!--- Describe the bug you're noticing -->


## Steps to Reproduce the Bug

<!--- Give instructions as to how the bug can be reproduced -->
Expand All @@ -11,5 +10,8 @@

<!--- Give a screenshot of what and where you're noticing the bug -->

## Initial thoughts / Potential relevant files

<!--- Provide any additional information or theories you may have regarding the cause or affected areas in the codebase -->

<!-- Remember to add labels (which clone, what priority--high/low) -->
<!-- Remember to add labels (which clone, what priority--high/low) -->
13 changes: 13 additions & 0 deletions .gitlab/issue_templates/cosmetic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Description

<!--- Describe what cosmetic changes you want implemented -->

## Mockups (if applicable)

<!--- Attach mockups/wireframes -->

## Initial thoughts / Potential relevant files

<!--- Provide any additional information you may have regarding relevant areas of the codebase -->

<!-- Remember to add labels (which clone, what priority--high/low) -->
8 changes: 5 additions & 3 deletions .gitlab/issue_templates/feature.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
## Description

<!--- Describe what new feature/modifications you want implemented -->

<!--- Describe what new feature you want implemented -->

## Mockups (if applicable)

<!--- Attach mockups/wireframes -->

## Initial thoughts / Potential relevant files

<!--- Provide any additional information or suggestions you may have regarding implementation or affected areas of the codebase -->

<!-- Remember to add labels (which clone, what priority--high/low) -->
<!-- Remember to add labels (which clone, what priority--high/low) -->
6 changes: 5 additions & 1 deletion .gitlab/merge_request_templates/default_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<!--- Please link to the issue/ticket here: -->

## Types of changes

- [ ] User interface improvement (non-breaking change that that improves the UI cosmetically)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Optimization (provides speedup with no functional changes)
Expand All @@ -23,6 +25,7 @@
<!--- If there are multiple test cases, please list the expected input and output for each. -->

## Requester Checklist:

<!--- Not all of these are required, but it servers as a reminder for the pull requester and helps the reviewer know what is covered-->

- [ ] Documentation updated
Expand All @@ -33,7 +36,8 @@
- [ ] Dev tools or other infrastructure changed

## Reviewer Checklist:
<!--- Not all of these may be required/applicable -->

Not all of these may be required/applicable.

- [ ] Review the Changelog/Code
- [ ] Test locally and aggressively
Expand Down
8 changes: 7 additions & 1 deletion Dockerfile.prod
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,13 @@ RUN cd "${APP_BACKEND_DIR}" && \
echo "//${_registry_fqdn}/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc && \
echo "@${NPM_PROFILE}:registry=${NPM_REGISTRY}" >> .npmrc \
)) && \
npm install --production
npm install --production

USER root

RUN yum remove git -y

USER "${APP_UID}":"${APP_GID}"

USER root

Expand Down
18 changes: 9 additions & 9 deletions backend/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ GAMECHANGER_ELASTICSEARCH_SUGGEST_INDEX=
GAMECHANGER_ELASTICSEARCH_ENTITIES_INDEX=
GAMECHANGER_ELASTICSEARCH_HISTORY_INDEX=

EDA_ELASTICSEARCH_HOST=
EDA_ELASTICSEARCH_PORT=
EDA_ELASTICSEARCH_USER=
EDA_ELASTICSEARCH_PASSWORD=
EDA_ELASTICSEARCH_CA=
EDA_ELASTICSEARCH_CA_FILEPATH=
EDA_ELASTICSEARCH_INDEX=
EDA_ELASTICSEARCH_FILTER_PICKLIST_INDEX=
EDA_ELASTICSEARCH_PROTOCOL=
EDA_OPENSEARCH_HOST=
EDA_OPENSEARCH_PORT=
EDA_OPENSEARCH_USER=
EDA_OPENSEARCH_PASSWORD=
EDA_OPENSEARCH_CA=
EDA_OPENSEARCH_CA_FILEPATH=
EDA_OPENSEARCH_INDEX=
EDA_OPENSEARCH_FILTER_PICKLIST_INDEX=
EDA_OPENSEARCH_PROTOCOL=
EDA_DATA_HOST=

HERMES_ELASTICSEARCH_INDEX=
Expand Down
16 changes: 8 additions & 8 deletions backend/node_app/config/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ module.exports = Object.freeze({
requestTimeout: 60000,
},
EDA_ELASTIC_SEARCH_OPTS: {
protocol: process.env.EDA_ELASTICSEARCH_PROTOCOL || 'https',
host: process.env.EDA_ELASTICSEARCH_HOST || 'loclhost',
port: process.env.EDA_ELASTICSEARCH_PORT || '443',
user: process.env.EDA_ELASTICSEARCH_USER ? process.env.EDA_ELASTICSEARCH_USER : '',
password: process.env.EDA_ELASTICSEARCH_PASSWORD || 'password',
ca: process.env.EDA_ELASTICSEARCH_CA ? process.env.EDA_ELASTICSEARCH_CA.replace(/\\n/g, '\n') : '',
index: process.env.EDA_ELASTICSEARCH_INDEX || 'eda',
filterPicklistIndex: process.env.EDA_ELASTICSEARCH_FILTER_PICKLIST_INDEX || 'gc_eda_picklist',
protocol: process.env.EDA_OPENSEARCH_PROTOCOL || 'https',
host: process.env.EDA_OPENSEARCH_HOST || 'loclhost',
port: process.env.EDA_OPENSEARCH_PORT || '443',
user: process.env.EDA_OPENSEARCH_USER ? process.env.EDA_OPENSEARCH_USER : '',
password: process.env.EDA_OPENSEARCH_PASSWORD || 'password',
ca: process.env.EDA_OPENSEARCH_CA ? process.env.EDA_OPENSEARCH_CA.replace(/\\n/g, '\n') : '',
index: process.env.EDA_OPENSEARCH_INDEX || 'eda',
filterPicklistIndex: process.env.EDA_OPENSEARCH_FILTER_PICKLIST_INDEX || 'gc_eda_picklist',
extSearchFields: ['*_eda_ext'], //['acomod_eda_ext','product_or_service_line_item_eda_ext'],
extRetrieveFields: ['*_eda_ext'],
// index: 'eda'
Expand Down
26 changes: 14 additions & 12 deletions backend/node_app/controllers/appStatsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,18 +288,20 @@ class AppStatsController {
connection.query(
`
select
b.name as document,
CONVERT_TZ(a.server_time,'UTC','EST') as documenttime
from
matomo_log_link_visit_action a,
matomo_log_action b
where
a.idaction_name = b.idaction
and b.name like 'PDFViewer%gamechanger'
and hex(a.idvisitor) in (?)
order by
documenttime desc
limit 10`,
b.name as document,
max(CONVERT_TZ(a.server_time,'UTC','EST')) as documenttime
from
matomo_log_link_visit_action a,
matomo_log_action b
where
a.idaction_name = b.idaction
and b.name like 'PDFViewer%gamechanger'
and hex(a.idvisitor) in (?)
group by
document
order by
documenttime desc
limit 10`,
[userId],
(error, results) => {
if (error) {
Expand Down
12 changes: 12 additions & 0 deletions backend/node_app/controllers/textSuggestionController.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,19 @@ class TextSuggestionController {
this.logger.error(message, 'JBVZKTP', userId);
}
if (corrected.length > 0 && esClientName !== 'eda') {
const clientObj = {
esClientName: esClientName,
esIndex: index,
};
const originalText = req.body.searchText;
req.body.searchText = corrected;
// If the auto-corrected text doesn't return any results, don't suggest it to the user.
const correctedResults = await this.searchUtility.documentSearch(null, req.body, clientObj, userId);

if (!correctedResults.totalCount) {
req.body.searchText = originalText;
corrected = '';
}
}
if (suggestionsFlag === true) {
const data_presearch = await this.getPresearchSuggestion({
Expand Down
2 changes: 1 addition & 1 deletion backend/node_app/modules/eda/edaSearchUtility.js
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,7 @@ class EDASearchUtility {
});

return {
track_total_hits: true,
track_total_hits: 10000,
size: 10,
_source: {
includes: ['pagerank_r', 'kw_doc_score_r', 'orgs_rs', 'file_location_eda_ext'],
Expand Down
116 changes: 70 additions & 46 deletions backend/node_app/utils/searchUtility.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ class SearchUtility {
: 'paragraphs.par_raw_text_t.gc_english';
const analyzer = this.isVerbatim(searchText) ? 'standard' : 'gc_english';
const plainQuery = this.isVerbatim(searchText) ? parsedQuery.replace(/["']/g, '') : parsedQuery;
const plainQueryTrimmed = plainQuery.trim();
let mainKeywords = this.remove_stopwords(plainQuery)
.replace(/["']/gi, '')
.replace(/ OR | AND /gi, ' ')
Expand Down Expand Up @@ -715,7 +716,7 @@ class SearchUtility {
fuzzy_max_expansions: 100,
fuzziness: 'AUTO',
analyzer,
boost: 0.5,
boost: 0.05,
},
},
],
Expand All @@ -725,62 +726,85 @@ class SearchUtility {
},
},
{
wildcard: {
keyw_5: {
value: `*${plainQuery}*`,
boost: 5,
},
},
},
{
wildcard: {
'display_title_s.search': {
value: `*${plainQuery}*`,
boost: 15,
case_insensitive: true,
},
},
},
{
fuzzy: {
'display_title_s.search': {
value: `${plainQuery.trim()}`,
fuzziness: 'AUTO', // https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#fuzziness
transpositions: false, // do not allow edits to include transpositions of adjacent characters (e.g., ba -> ab)
boost: 15,
},
dis_max: {
queries: [
{
wildcard: {
'display_title_s.search': {
value: `*${plainQueryTrimmed}*`,
case_insensitive: true,
},
},
},
{
fuzzy: {
'display_title_s.search': {
value: `${plainQueryTrimmed}`,
fuzziness: 'AUTO',
transpositions: false,
},
},
},
{
match_phrase: {
'display_title_s.search': plainQueryTrimmed,
},
},
{
wildcard: {
'filename.search': {
value: `*${plainQueryTrimmed}*`,
case_insensitive: true,
},
},
},
{
wildcard: {
doc_num: {
value: `*${plainQueryTrimmed}*`,
},
},
},
{
term: {
doc_num: {
value: plainQueryTrimmed,
},
},
},
],
boost: 150,
},
},
{
wildcard: {
'filename.search': {
value: `*${plainQuery}*`,
boost: 10,
case_insensitive: true,
},
dis_max: {
queries: [
{
wildcard: {
'top_entities_t.search': {
value: `*${plainQueryTrimmed}*`,
},
},
},
{
wildcard: {
keyw_5: {
value: `*${plainQueryTrimmed}*`,
},
},
},
],
boost: 5,
},
},
{
wildcard: {
'display_source_s.search': {
value: `*${plainQuery}*`,
boost: 4,
},
},
},
{
wildcard: {
'top_entities_t.search': {
value: `*${plainQuery}*`,
boost: 5,
value: `*${plainQueryTrimmed}*`,
boost: 10,
},
},
},
{
match_phrase: {
'display_title_s.search': plainQuery,
},
},
],
minimum_should_match: 1,

Expand Down
Loading

0 comments on commit 5c820cb

Please sign in to comment.