[MNT-24778] Limit Increased for facet solr query to max transaction id

This commit is contained in:
Vedant Mehra
2025-02-07 16:02:17 +05:30
parent 48f3ace274
commit 2540eff4d7

View File

@@ -3747,7 +3747,7 @@ public class SolrInformationServer implements InformationServer
long iterationStart = batchStartId;
NamedList<Integer> idCounts = this.getFacets(request,
field + ":[" + batchStartId + " TO " + batchEndId + "]",
field, 1); // Min count of 1 ensures that the id returned is in the index
field, 1, maxId); // Min count of 1 ensures that the id returned is in the index
for (Map.Entry<String, Integer> idCount : idCounts)
{
idInIndex = Long.parseLong(idCount.getKey());
@@ -3848,6 +3848,24 @@ public class SolrInformationServer implements InformationServer
return (NamedList) facetFields.get(field);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
private NamedList<Integer> getFacets(SolrQueryRequest request, String query, String field, int minCount, long maxCount)
{
ModifiableSolrParams params =
new ModifiableSolrParams(request.getParams())
.set(CommonParams.Q, query)
.set(CommonParams.ROWS, 0)
.set(FacetParams.FACET, true)
.set(FacetParams.FACET_FIELD, field)
.set(FacetParams.FACET_LIMIT, (int)maxCount)
.set(FacetParams.FACET_MINCOUNT, minCount);
SolrQueryResponse response = cloud.getResponse(nativeRequestHandler, request, params);
NamedList facetCounts = (NamedList) response.getValues().get("facet_counts");
NamedList facetFields = (NamedList) facetCounts.get("facet_fields");
return (NamedList) facetFields.get(field);
}
public int getDocListSize(String query)
{
try (SolrQueryRequest request = this.newSolrQueryRequest())