Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
bad hack to prevent a bug appearing in solr
Michael Peter Christen3ce04cecf329
diff --git a/defaults/solr/solrconfig.xml b/defaults/solr/solrconfig.xmlindex 5f50ab580..fad3cc757 100755--- a/defaults/solr/solrconfig.xml+++ b/defaults/solr/solrconfig.xml@@ -125,8 +125,9 @@solr.RAMDirectoryFactory is memory based, notpersistent, and doesn't work with replication.-->- <directoryFactory name="DirectoryFactory"- class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>+ <!-- <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/> -->+ <!-- for solr.MMapDirectoryFactory see: https://issues.apache.org/jira/browse/SOLR-2247 -->+ <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.MMapDirectoryFactory}"/><!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Index Config - These settings control low-level behavior of indexingdiff --git a/source/net/yacy/cora/services/federated/solr/AbstractSolrConnector.java b/source/net/yacy/cora/services/federated/solr/AbstractSolrConnector.javaindex ef634298b..779a7864a 100644--- a/source/net/yacy/cora/services/federated/solr/AbstractSolrConnector.java+++ b/source/net/yacy/cora/services/federated/solr/AbstractSolrConnector.java@@ -198,19 +198,22 @@ public class AbstractSolrConnector implements SolrConnector {// query the server//SearchResult result = new SearchResult(count);- try {- final QueryResponse rsp = this.server.query( query );- final SolrDocumentList docs = rsp.getResults();- return docs;- // add the docs into the YaCy search result container- /*- for (SolrDocument doc: docs) {- result.put(element)+ Throwable error = null; // well this is a bad hack; see https://issues.apache.org/jira/browse/LUCENE-2239+ // also: https://issues.apache.org/jira/browse/SOLR-2247+ // we might try also: $JAVA_OPTS -Dsolr.directoryFactory=solr.MMapDirectoryFactory+ for (int retry = 30; retry > 0; retry--) {+ try {+ final QueryResponse rsp = this.server.query(query);+ final SolrDocumentList docs = rsp.getResults();+ if (error != null) Log.logWarning("AbstractSolrConnector", "produced search result by silently ignoring an error before, message = " + error.getMessage());+ return docs;+ } catch (final Throwable e) {+ Log.logWarning("AbstractSolrConnection", "problem with query=" + querystring, e);+ error = e;+ continue;}- */- } catch (final Throwable e) {- throw new IOException(e);}+ throw new IOException(error.getMessage(), error);}/**@@ -230,15 +233,23 @@ public class AbstractSolrConnector implements SolrConnector {query.setStart(0);// query the server- try {- final QueryResponse rsp = this.server.query( query );- final SolrDocumentList docs = rsp.getResults();- if (docs.isEmpty()) return null;- return docs.get(0);- } catch (final Throwable e) {- Log.logWarning("AbstractSolrConnection", "problem with id=" + id, e);- throw new IOException(e);+ Throwable error = null; // well this is a bad hack; see https://issues.apache.org/jira/browse/LUCENE-2239+ // also: https://issues.apache.org/jira/browse/SOLR-2247+ // we might try also: $JAVA_OPTS -Dsolr.directoryFactory=solr.MMapDirectoryFactory+ for (int retry = 30; retry > 0; retry--) {+ try {+ final QueryResponse rsp = this.server.query(query);+ final SolrDocumentList docs = rsp.getResults();+ if (docs.isEmpty()) return null;+ if (error != null) Log.logWarning("AbstractSolrConnector", "produced search result by silently ignoring an error before, message = " + error.getMessage());+ return docs.get(0);+ } catch (final Throwable e) {+ Log.logWarning("AbstractSolrConnection", "problem with id=" + id, e);+ error = e;+ continue;+ }}+ throw new IOException(error.getMessage(), error);}}diff --git a/source/net/yacy/search/solr/EmbeddedSolrConnector.java b/source/net/yacy/search/solr/EmbeddedSolrConnector.javaindex c46e66473..d17e4c9c4 100644--- a/source/net/yacy/search/solr/EmbeddedSolrConnector.java+++ b/source/net/yacy/search/solr/EmbeddedSolrConnector.java@@ -84,6 +84,13 @@ public class EmbeddedSolrConnector extends AbstractSolrConnector implements SolrFiles.copy(source, target);}}+ /*+ try {+ CheckIndex.main(new String[]{new File(new File(storagePath, "data"), "index").getAbsolutePath(), "-fix"});+ } catch (InterruptedException e1) {+ Log.logException(e1);+ }+ */try {this.cores = new CoreContainer(storagePath.getAbsolutePath(), new File(solr_config, "solr.xml"));} catch (ParserConfigurationException e) {