1
0
mirror of https://github.com/yacy/yacy_search_server.git synced 2025-07-18 08:36:07 -04:00

fix for solr/gsa result logging

This commit is contained in:
Michael Peter Christen
2013-09-02 08:05:42 +02:00
parent 29967102a2
commit 6184fd9d9a
2 changed files with 15 additions and 4 deletions

@ -41,6 +41,7 @@ import net.yacy.search.schema.CollectionSchema;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.request.SolrQueryRequest;
@ -220,9 +221,15 @@ public class searchresult {
// log result
Object rv = response.getValues().get("response");
int matches = 0;
if (rv != null && rv instanceof ResultContext) {
AccessTracker.addToDump(originalQuery, Integer.toString(((ResultContext) rv).docs.matches()));
matches = ((ResultContext) rv).docs.matches();
} else if (rv != null && rv instanceof SolrDocumentList) {
matches = (int) ((SolrDocumentList) rv).getNumFound();
}
AccessTracker.addToDump(originalQuery, Integer.toString(matches));
ConcurrentLog.info("GSA Query", "results: " + matches + ", for query:" + post.toString());
return null;
}
}

@ -51,6 +51,7 @@ import net.yacy.search.schema.WebgraphSchema;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.SolrParams;
@ -252,11 +253,14 @@ public class select {
// log result
Object rv = response.getValues().get("response");
int matches = 0;
if (rv != null && rv instanceof ResultContext) {
int matches = ((ResultContext) rv).docs.matches();
AccessTracker.addToDump(q, Integer.toString(matches));
ConcurrentLog.info("SOLR Query", "results: " + matches + ", for query:" + post.toString());
matches = ((ResultContext) rv).docs.matches();
} else if (rv != null && rv instanceof SolrDocumentList) {
matches = (int) ((SolrDocumentList) rv).getNumFound();
}
AccessTracker.addToDump(q, Integer.toString(matches));
ConcurrentLog.info("SOLR Query", "results: " + matches + ", for query:" + post.toString());
return null;
}