Skip to content

Commit

Permalink
Merge pull request #3185 from atlanhq/DG-1442
Browse files Browse the repository at this point in the history
fixed the caching logic, by adding the bifurcation for terms and cate…
  • Loading branch information
hr2904 authored Jun 4, 2024
2 parents 62c163f + bd12a97 commit 0e6e734
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,15 @@ public static void assignNewLexicographicalSortOrder(AtlasEntity entity, String
}
String lexoRank = "";
String lastLexoRank = "";
boolean isTerm = entity.getTypeName().equals(ATLAS_GLOSSARY_TERM_TYPENAME) ? true : false;

if(lexoRankCache.containsKey(glossaryQualifiedName + "-" + parentQualifiedName)) {
lastLexoRank = lexoRankCache.get(glossaryQualifiedName + "-" + parentQualifiedName);
if(lexoRankCache.containsKey(entity.getTypeName() + "-" + glossaryQualifiedName + "-" + parentQualifiedName)) {
lastLexoRank = lexoRankCache.get(entity.getTypeName() + "-" + glossaryQualifiedName + "-" + parentQualifiedName);

} else {
Set<String> attributes = new HashSet<>();
attributes.add(LEXICOGRAPHICAL_SORT_ORDER);
List<AtlasEntityHeader> categories = null;
boolean isTerm = entity.getTypeName().equals(ATLAS_GLOSSARY_TERM_TYPENAME) ? true : false;
Map<String, Object> dslQuery = generateDSLQueryForLastCategory(glossaryQualifiedName, parentQualifiedName, isTerm);
try {
IndexSearchParams searchParams = new IndexSearchParams();
Expand Down Expand Up @@ -295,7 +295,7 @@ public static void assignNewLexicographicalSortOrder(AtlasEntity entity, String
lexoRank = nextLexoRank.toString();

entity.setAttribute(LEXICOGRAPHICAL_SORT_ORDER, lexoRank);
lexoRankCache.put(glossaryQualifiedName + "-" + parentQualifiedName, lexoRank);
lexoRankCache.put(entity.getTypeName() + "-" + glossaryQualifiedName + "-" + parentQualifiedName, lexoRank);
RequestContext.get().setLexoRankCache(lexoRankCache);
}

Expand Down

0 comments on commit 0e6e734

Please sign in to comment.