bad hack to prevent a bug appearing in solr

pull/1/head
Michael Peter Christen 13 years ago
parent bbd242afb4
commit 3ce04cecf3

@ -125,8 +125,9 @@
solr.RAMDirectoryFactory is memory based, not solr.RAMDirectoryFactory is memory based, not
persistent, and doesn't work with replication. persistent, and doesn't work with replication.
--> -->
<directoryFactory name="DirectoryFactory" <!-- <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/> -->
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 indexing Index Config - These settings control low-level behavior of indexing

@ -198,19 +198,22 @@ public class AbstractSolrConnector implements SolrConnector {
// query the server // query the server
//SearchResult result = new SearchResult(count); //SearchResult result = new SearchResult(count);
try { Throwable error = null; // well this is a bad hack; see https://issues.apache.org/jira/browse/LUCENE-2239
final QueryResponse rsp = this.server.query( query ); // also: https://issues.apache.org/jira/browse/SOLR-2247
final SolrDocumentList docs = rsp.getResults(); // we might try also: $JAVA_OPTS -Dsolr.directoryFactory=solr.MMapDirectoryFactory
return docs; for (int retry = 30; retry > 0; retry--) {
// add the docs into the YaCy search result container try {
/* final QueryResponse rsp = this.server.query(query);
for (SolrDocument doc: docs) { final SolrDocumentList docs = rsp.getResults();
result.put(element) 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.setStart(0);
// query the server // query the server
try { Throwable error = null; // well this is a bad hack; see https://issues.apache.org/jira/browse/LUCENE-2239
final QueryResponse rsp = this.server.query( query ); // also: https://issues.apache.org/jira/browse/SOLR-2247
final SolrDocumentList docs = rsp.getResults(); // we might try also: $JAVA_OPTS -Dsolr.directoryFactory=solr.MMapDirectoryFactory
if (docs.isEmpty()) return null; for (int retry = 30; retry > 0; retry--) {
return docs.get(0); try {
} catch (final Throwable e) { final QueryResponse rsp = this.server.query(query);
Log.logWarning("AbstractSolrConnection", "problem with id=" + id, e); final SolrDocumentList docs = rsp.getResults();
throw new IOException(e); 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);
} }
} }

@ -84,6 +84,13 @@ public class EmbeddedSolrConnector extends AbstractSolrConnector implements Solr
Files.copy(source, target); Files.copy(source, target);
} }
} }
/*
try {
CheckIndex.main(new String[]{new File(new File(storagePath, "data"), "index").getAbsolutePath(), "-fix"});
} catch (InterruptedException e1) {
Log.logException(e1);
}
*/
try { try {
this.cores = new CoreContainer(storagePath.getAbsolutePath(), new File(solr_config, "solr.xml")); this.cores = new CoreContainer(storagePath.getAbsolutePath(), new File(solr_config, "solr.xml"));
} catch (ParserConfigurationException e) { } catch (ParserConfigurationException e) {

Loading…
Cancel
Save