Skip to content

Commit

Permalink
20420: Fixes bug where SDM caches would not always be properly cleare…
Browse files Browse the repository at this point in the history
…d between queries (#142)
  • Loading branch information
howsohazard authored May 29, 2024
1 parent ea94c07 commit 3672a26
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/Amalgam/GeneralizedDistance.h
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,18 @@ class RepeatedGeneralizedDistanceEvaluator
internedNumberIndexToNumberValue(nullptr)
{ }

//clears all the feature data
void Clear()
{
effectiveFeatureType = EFDT_CONTINUOUS_NUMERIC;
precomputedRemainingIdenticalDistanceTerm = 0.0;
internedNumberIndexToNumberValue = nullptr;
internedDistanceTerms.clear();
nominalStringDistanceTerms.clear();
nominalNumberDistanceTerms.clear();
precomputedNominalDistanceTermsHighAccuracy = false;
}

//sets the value for a precomputed distance term that will apply to the rest of the distance
//evaluations and changes the feature type appropriately
inline void SetPrecomputedRemainingIdenticalDistanceTerm(double dist_term)
Expand Down
3 changes: 1 addition & 2 deletions src/Amalgam/SeparableBoxFilterDataStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1440,8 +1440,7 @@ void SeparableBoxFilterDataStore::PopulateTargetValueAndLabelIndex(RepeatedGener
auto &feature_data = r_dist_eval.featureData[query_feature_index];
auto &effective_feature_type = r_dist_eval.featureData[query_feature_index].effectiveFeatureType;

feature_data.internedNumberIndexToNumberValue = nullptr;
feature_data.internedDistanceTerms.clear();
feature_data.Clear();

if(feature_attribs.IsFeatureNominal()
|| feature_type == GeneralizedDistanceEvaluator::FDT_CONTINUOUS_STRING
Expand Down

0 comments on commit 3672a26

Please sign in to comment.