Skip to content

Commit

Permalink
Refactoring: Move the trailing space check into IsValidEntryIgnoringR…
Browse files Browse the repository at this point in the history
…emovedField().

PiperOrigin-RevId: 598727235
  • Loading branch information
Toshiyuki Hanaoka authored and hiroyuki-komatsu committed Jan 16, 2024
1 parent 75f747f commit ed19ccb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/prediction/user_history_predictor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1381,10 +1381,6 @@ bool UserHistoryPredictor::InsertCandidates(RequestType request_type,
// Pop() returns nullptr when no more valid entry exists.
break;
}
if (absl::EndsWith(result_entry->key(), " ")) {
// Invalid user history entry from alphanumeric input.
continue;
}
bool is_valid_candidate = false;
if (request.request_type() == ConversionRequest::PREDICTION) {
is_valid_candidate = true;
Expand Down Expand Up @@ -1518,6 +1514,11 @@ bool UserHistoryPredictor::IsValidEntryIgnoringRemovedField(
return false;
}

if (absl::EndsWith(entry.key(), " ")) {
// Invalid user history entry from alphanumeric input.
return false;
}

return true;
}

Expand Down

0 comments on commit ed19ccb

Please sign in to comment.