Update API Usage

pull/403/head
Al Sutton 4 years ago
parent 9ba0fa1beb
commit 69014a701e

@ -39,6 +39,7 @@ import org.apache.lucene.document.Document;
import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.IndexableField;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.apache.lucene.search.TotalHits;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;
import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.SolrServerException;
@ -232,7 +233,7 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCo
SolrDocumentList sdl = new SolrDocumentList(); SolrDocumentList sdl = new SolrDocumentList();
NamedList<?> nl = rsp.getValues(); NamedList<?> nl = rsp.getValues();
ResultContext resultContext = (ResultContext) nl.get("response"); ResultContext resultContext = (ResultContext) nl.get("response");
DocList response = resultContext == null ? new DocSlice(0, 0, new int[0], new float[0], 0, 0.0f) : resultContext.getDocList(); DocList response = resultContext == null ? new DocSlice(0, 0, new int[0], new float[0], 0, 0.0f, TotalHits.Relation.EQUAL_TO) : resultContext.getDocList();
sdl.setNumFound(response == null ? 0 : response.matches()); sdl.setNumFound(response == null ? 0 : response.matches());
sdl.setStart(response == null ? 0 : response.offset()); sdl.setStart(response == null ? 0 : response.offset());
String originalName = Thread.currentThread().getName(); String originalName = Thread.currentThread().getName();
@ -383,7 +384,7 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCo
NamedList<?> nl = rsp.getValues(); NamedList<?> nl = rsp.getValues();
ResultContext resultContext = (ResultContext) nl.get("response"); ResultContext resultContext = (ResultContext) nl.get("response");
if (resultContext == null) log.warn("DocListSearcher: no response for query '" + querystring + "'"); if (resultContext == null) log.warn("DocListSearcher: no response for query '" + querystring + "'");
this.response = resultContext == null ? new DocSlice(0, 0, new int[0], new float[0], 0, 0.0f) : resultContext.getDocList(); this.response = resultContext == null ? new DocSlice(0, 0, new int[0], new float[0], 0, 0.0f, TotalHits.Relation.EQUAL_TO) : resultContext.getDocList();
} }
@Override @Override

@ -836,7 +836,7 @@ public class Domains {
final private static ExecutorService getByNameService = Executors final private static ExecutorService getByNameService = Executors
.newCachedThreadPool(new NamePrefixThreadFactory("InetAddress.getByName")); .newCachedThreadPool(new NamePrefixThreadFactory("InetAddress.getByName"));
final private static TimeLimiter timeLimiter = new SimpleTimeLimiter(getByNameService); final private static TimeLimiter timeLimiter = SimpleTimeLimiter.create(getByNameService);
/** /**
* strip off any parts of an url, address string (containing host/ip:port) or raw IPs/Hosts, * strip off any parts of an url, address string (containing host/ip:port) or raw IPs/Hosts,
@ -992,7 +992,7 @@ public class Domains {
public InetAddress call() throws Exception { public InetAddress call() throws Exception {
return InetAddress.getByName(host); return InetAddress.getByName(host);
} }
}, 3000L, TimeUnit.MILLISECONDS, false); }, 3000L, TimeUnit.MILLISECONDS);
//ip = TimeoutRequest.getByName(host, 1000); // this makes the DNS request to backbone //ip = TimeoutRequest.getByName(host, 1000); // this makes the DNS request to backbone
} catch (final UncheckedTimeoutException e) { } catch (final UncheckedTimeoutException e) {
// in case of a timeout - maybe cause of massive requests - do not fill NAME_CACHE_MISS // in case of a timeout - maybe cause of massive requests - do not fill NAME_CACHE_MISS

@ -85,6 +85,8 @@ import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrInputDocument; import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.SolrException.ErrorCode; import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.lucene.util.Version; import org.apache.lucene.util.Version;
import org.apache.solr.core.SolrConfig;
import org.apache.solr.schema.IndexSchema;
public final class Fulltext { public final class Fulltext {
@ -150,7 +152,9 @@ public final class Fulltext {
} }
EmbeddedInstance localCollectionInstance = new EmbeddedInstance(new File(new File(Switchboard.getSwitchboard().appPath, "defaults"), "solr"), solrLocation, CollectionSchema.CORE_NAME, new String[]{CollectionSchema.CORE_NAME, WebgraphSchema.CORE_NAME}); EmbeddedInstance localCollectionInstance = new EmbeddedInstance(new File(new File(Switchboard.getSwitchboard().appPath, "defaults"), "solr"), solrLocation, CollectionSchema.CORE_NAME, new String[]{CollectionSchema.CORE_NAME, WebgraphSchema.CORE_NAME});
Version luceneVersion = localCollectionInstance.getDefaultCore().getSolrConfig().getLuceneVersion("luceneMatchVersion"); SolrConfig config = localCollectionInstance.getDefaultCore().getSolrConfig();
String versionValue = config.getVal(IndexSchema.LUCENE_MATCH_VERSION_PARAM, true);
Version luceneVersion = SolrConfig.parseLuceneVersionString(versionValue);
String lvn = luceneVersion.major + "_" + luceneVersion.minor; String lvn = luceneVersion.major + "_" + luceneVersion.minor;
ConcurrentLog.info("Fulltext", "using lucene version " + lvn); ConcurrentLog.info("Fulltext", "using lucene version " + lvn);
assert SOLR_PATH.endsWith(lvn) : "luceneVersion = " + lvn + ", solrPath = " + SOLR_PATH + ", check defaults/solr/solrconfig.xml"; assert SOLR_PATH.endsWith(lvn) : "luceneVersion = " + lvn + ", solrPath = " + SOLR_PATH + ", check defaults/solr/solrconfig.xml";

Loading…
Cancel
Save