Skip to content
Snippets Groups Projects
Commit 524bbf96 authored by Thorsten Vitt's avatar Thorsten Vitt
Browse files

Don't forget to pass through filter to search

Refs #22310
parent 63d46181
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@
import info.textgrid.namespaces.middleware.tgsearch.Response;
import info.textgrid.namespaces.middleware.tgsearch.ResultType;
import com.google.common.base.Joiner;
import com.google.common.collect.ForwardingCollection;
import com.google.common.collect.Lists;
import com.google.common.collect.UnmodifiableIterator;
......@@ -58,11 +59,12 @@ public boolean hasNext() {
private int hits = -1; // # of hits, -1 if we don't know yet
private int nextStart = 0; //
private int stop = Integer.MAX_VALUE;
private SearchClient searchClient;
private final SearchClient searchClient;
protected SearchResultList(final SearchClient client, final String query, final String target, List<String> filter, boolean sandbox) {
this.searchClient = client;
this.query = query;
this.filter = filter;
client.setTarget(target);
client.setSandbox(sandbox);
}
......@@ -103,9 +105,9 @@ public int size() {
private Logger logger = Logger.getLogger(getClass().getCanonicalName());
private String query;
private final String query;
private List<String> filter;
private final List<String> filter;
@Override
......@@ -139,10 +141,13 @@ protected Collection<ObjectType> delegate() {
protected void fetchNextChunk() {
if (finished)
return;
Response response = searchClient.query(query, null, "", nextStart,
Math.min(stop - nextStart, chunkSize), filter);
hits = Integer.parseInt(response.getHits());
logger.info(MessageFormat.format("Next query for {0}, filters {3}, sandbox {1}, {2} hits", query, searchClient.getSandbox(), hits,
Joiner.on("; ").join(filter)));
if (!started) {
availableResults = Lists.newArrayListWithExpectedSize(hits);
started = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment