From b718ef3e73d2df5ba353fafa0005e97e229e9587 Mon Sep 17 00:00:00 2001 From: austin007008 Date: Tue, 9 Jul 2024 17:20:34 +0000 Subject: [PATCH] return null when score is above 90000000 --- .../query/iterator/logic/WordsAndScores.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/warehouse/query-core/src/main/java/datawave/query/iterator/logic/WordsAndScores.java b/warehouse/query-core/src/main/java/datawave/query/iterator/logic/WordsAndScores.java index 00d4eac928a..59fa6da2aaf 100644 --- a/warehouse/query-core/src/main/java/datawave/query/iterator/logic/WordsAndScores.java +++ b/warehouse/query-core/src/main/java/datawave/query/iterator/logic/WordsAndScores.java @@ -139,7 +139,7 @@ public boolean addTerm(String word, List hitTermsList) { scores.add(-1); // add the default score to its array if (arrSize > 1) { // if this is at least the second word we are adding... if ((hitTermsList != null) && hitTermsList.contains(word)) { // if this word is a hit term... - if (hitTermIndex == -1) { // if we don't have a hit term at this offset yet.. + if (hitTermIndex == -1) { // if we don't have a hit term at this offset yet... hitTermIndex = arrSize - 1; // set this index as the one with a hit term hasHitTerm = true; } else { @@ -172,6 +172,9 @@ public String getWordToOutput() { return "REPORTMETODATAWAVE"; } else { if (oneBestExcerpt) { + if (scores.get(smallestScoreIndex) > 90000000) { + return null; + } if (STOP_WORD_LIST.contains(words.get(smallestScoreIndex))) { // if the selected term is in the stop list... return null; } @@ -182,6 +185,9 @@ public String getWordToOutput() { } } if (overrideIndex >= 0 && overrideIndex < arrSize) { + if (scores.get(overrideIndex) > 90000000) { + return null; + } if (STOP_WORD_LIST.contains(words.get(overrideIndex))) { // if the hit term is on the stop list for some reason... return null; } @@ -210,6 +216,9 @@ public String getWordToOutput() { } } if (hasHitTerm) { // if we have a hit term... + if (scores.get(hitTermIndex) > 90000000) { + return null; + } if (STOP_WORD_LIST.contains(words.get(hitTermIndex))) { // if the hit term is on the stop list for some reason... return null; } @@ -220,6 +229,9 @@ public String getWordToOutput() { } } if (useScores) { // if we have added at least one score, and it is a valid score... + if (scores.get(smallestScoreIndex) > 90000000) { + return null; + } if (STOP_WORD_LIST.contains(words.get(smallestScoreIndex))) { // if the selected term is in the stop list... return null; }