fix for solr query size; too many documents had been retrieved in case

that less than _pagesize_ had been requested.
pull/1/head
Michael Peter Christen 11 years ago
parent c64c10ef00
commit 74ab094587

@ -160,7 +160,7 @@ public abstract class AbstractSolrConnector implements SolrConnector {
int count = 0; int count = 0;
while (System.currentTimeMillis() < endtime && count < maxcount) { while (System.currentTimeMillis() < endtime && count < maxcount) {
try { try {
SolrDocumentList sdl = getDocumentListByQuery(querystring, o, pagesize, fields); SolrDocumentList sdl = getDocumentListByQuery(querystring, o, Math.min(maxcount, pagesize), fields);
for (SolrDocument d: sdl) { for (SolrDocument d: sdl) {
try {queue.put(d);} catch (final InterruptedException e) {break;} try {queue.put(d);} catch (final InterruptedException e) {break;}
count++; count++;
@ -199,7 +199,7 @@ public abstract class AbstractSolrConnector implements SolrConnector {
int o = offset; int o = offset;
while (System.currentTimeMillis() < endtime) { while (System.currentTimeMillis() < endtime) {
try { try {
SolrDocumentList sdl = getDocumentListByQuery(querystring, o, pagesize, CollectionSchema.id.getSolrFieldName()); SolrDocumentList sdl = getDocumentListByQuery(querystring, o, Math.min(maxcount, pagesize), CollectionSchema.id.getSolrFieldName());
for (SolrDocument d: sdl) { for (SolrDocument d: sdl) {
try {queue.put((String) d.getFieldValue(CollectionSchema.id.getSolrFieldName()));} catch (final InterruptedException e) {break;} try {queue.put((String) d.getFieldValue(CollectionSchema.id.getSolrFieldName()));} catch (final InterruptedException e) {break;}
} }

Loading…
Cancel
Save