fix(search) Add facets list to our cache key to avoid cache collisions (#8327)

This commit is contained in:
Chris Collins 2023-06-28 17:05:12 -04:00 committed by GitHub
parent 2d6c235d1e
commit 96dd91e994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,7 @@ import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import lombok.RequiredArgsConstructor;
import org.javatuples.Quintet;
import org.javatuples.Sextet;
import org.springframework.cache.CacheManager;
import static com.datahub.util.RecordUtils.*;
@ -29,8 +29,8 @@ public class CachingAllEntitiesSearchAggregator {
return new CacheableSearcher<>(cacheManager.getCache(ALL_ENTITIES_SEARCH_AGGREGATOR_CACHE_NAME), batchSize,
querySize -> aggregator.search(entities, input, postFilters, sortCriterion, querySize.getFrom(),
querySize.getSize(), searchFlags, facets),
querySize -> Quintet.with(entities, input, postFilters != null ? toJsonString(postFilters) : null,
sortCriterion != null ? toJsonString(sortCriterion) : null, querySize), searchFlags, enableCache)
querySize -> Sextet.with(entities, input, postFilters != null ? toJsonString(postFilters) : null,
sortCriterion != null ? toJsonString(sortCriterion) : null, facets, querySize), searchFlags, enableCache)
.getSearchResults(from, size);
}
}