diff --git a/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java b/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java index d19c88a91..308525964 100644 --- a/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java +++ b/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java @@ -27,6 +27,7 @@ import net.yacy.cora.federate.solr.instance.EmbeddedInstance; import net.yacy.cora.federate.solr.instance.SolrInstance; import net.yacy.cora.util.ConcurrentLog; +import org.apache.lucene.index.DirectoryReader; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.SolrException; @@ -41,6 +42,8 @@ import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.request.SolrQueryRequestBase; import org.apache.solr.request.SolrRequestInfo; import org.apache.solr.response.SolrQueryResponse; +import org.apache.solr.search.SolrIndexSearcher; +import org.apache.solr.util.RefCounted; public class EmbeddedSolrConnector extends SolrServerConnector implements SolrConnector { @@ -90,6 +93,21 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCo try {this.core.close();} catch (final Throwable e) {ConcurrentLog.logException(e);} } + @Override + public long getSize() { + RefCounted refCountedIndexSearcher = this.core.getSearcher(); + SolrIndexSearcher searcher = refCountedIndexSearcher.get(); + DirectoryReader reader = searcher.getIndexReader(); + long numDocs = reader.numDocs(); + refCountedIndexSearcher.decref(); + return numDocs; + } + + /** + * get a new query request. MUST be closed after usage using close() + * @param params + * @return + */ public SolrQueryRequest request(final SolrParams params) { SolrQueryRequest req = null; req = new SolrQueryRequestBase(this.core, params){}; diff --git a/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.java b/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.java index 879b035e5..f12d43950 100644 --- a/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.java +++ b/source/net/yacy/cora/federate/solr/connector/SolrServerConnector.java @@ -295,7 +295,7 @@ public abstract class SolrServerConnector extends AbstractSolrConnector implemen // get all fields contained in index final LukeRequest lukeRequest = new LukeRequest(); lukeRequest.setResponseParser(new XMLResponseParser()); - lukeRequest.setNumTerms(1); + lukeRequest.setNumTerms(0); lukeRequest.setShowSchema(showSchema); /* final SolrRequest lukeRequest = new SolrRequest(METHOD.GET, "/admin/luke") {