diff --git a/catalog/solr/catalog-solr-core/src/main/java/ddf/catalog/source/solr/SolrMetacardClientImpl.java b/catalog/solr/catalog-solr-core/src/main/java/ddf/catalog/source/solr/SolrMetacardClientImpl.java index ea18fe468fa0..3de7093459aa 100644 --- a/catalog/solr/catalog-solr-core/src/main/java/ddf/catalog/source/solr/SolrMetacardClientImpl.java +++ b/catalog/solr/catalog-solr-core/src/main/java/ddf/catalog/source/solr/SolrMetacardClientImpl.java @@ -42,6 +42,7 @@ import ddf.catalog.data.impl.ResultImpl; import ddf.catalog.filter.FilterAdapter; import ddf.catalog.operation.FacetAttributeResult; +import ddf.catalog.operation.Query; import ddf.catalog.operation.QueryRequest; import ddf.catalog.operation.SourceResponse; import ddf.catalog.operation.TermFacetProperties; @@ -196,13 +197,9 @@ public SourceResponse query(QueryRequest request) throws UnsupportedQueryExcepti try { QueryResponse solrResponse; - boolean doRealTimeGet = - (boolean) request.getProperties().getOrDefault(DO_REALTIME_GET, false) - || BooleanUtils.toBoolean( - filterAdapter.adapt(request.getQuery(), new RealTimeGetDelegate())); LOGGER.trace("Begin executing solr query: query request {}", request); - if (doRealTimeGet) { + if (shouldDoRealTimeGet(request)) { LOGGER.debug("Performing real time query"); SolrQuery realTimeQuery = getRealTimeQuery(query, solrFilterDelegate.getIds()); solrResponse = client.query(realTimeQuery, METHOD.POST); @@ -237,6 +234,18 @@ public SourceResponse query(QueryRequest request) throws UnsupportedQueryExcepti return new SourceResponseImpl(request, responseProps, results, totalHits); } + private boolean shouldDoRealTimeGet(QueryRequest request) throws UnsupportedQueryException { + Query query = request.getQuery(); + if (query.getStartIndex() > 1) { + // solr doesn't support paging of real time get requests so if a paging request is received + // here, it is safe to assume that we should not be doing a real time get to solr + return false; + } + + return (boolean) request.getProperties().getOrDefault(DO_REALTIME_GET, false) + || BooleanUtils.toBoolean(filterAdapter.adapt(query, new RealTimeGetDelegate())); + } + private List getSolrDocs(Set ids) throws UnsupportedQueryException { List solrDocs = new ArrayList<>(ids.size()); List> partitions = Lists.partition(new ArrayList<>(ids), GET_BY_ID_LIMIT);