use of com.yahoo.prelude.ConfigurationException in project vespa by vespa-engine.
the class VespaBackEndSearcher method addUnfilledHits.
/**
* Creates unfilled hits from a List of DocumentInfo instances. Do note
* cacheKey should be available if a cache is active, even if the hit is not
* created from a cache in the current call path.
*
* @param queryPacketData binary data from first phase of search, or null
* @param cacheKey the key this hit should match in the packet cache, or null
*/
protected boolean addUnfilledHits(Result result, List<DocumentInfo> documents, boolean fromCache, QueryPacketData queryPacketData, CacheKey cacheKey) {
boolean allHitsOK = true;
Query myQuery = result.getQuery();
for (DocumentInfo document : documents) {
try {
FastHit hit = new FastHit();
hit.setQuery(myQuery);
if (queryPacketData != null)
hit.setQueryPacketData(queryPacketData);
hit.setCacheKey(cacheKey);
hit.setUseRowInIndexUri(useRowInIndexUri(result));
hit.setFillable();
hit.setCached(fromCache);
extractDocumentInfo(hit, document);
result.hits().add(hit);
} catch (ConfigurationException e) {
allHitsOK = false;
getLogger().log(LogLevel.WARNING, "Skipping hit", e);
} catch (Exception e) {
allHitsOK = false;
getLogger().log(LogLevel.ERROR, "Skipping malformed hit", e);
}
}
return allHitsOK;
}
use of com.yahoo.prelude.ConfigurationException in project vespa by vespa-engine.
the class MockFDispatch method run.
public void run() {
try {
ServerSocketChannel channel = createServerSocket(listenPort);
channel.socket().setReuseAddress(true);
while (!Thread.currentThread().isInterrupted()) {
try {
// can now proceed and talk to us
synchronized (barrier) {
if (barrier != null) {
barrier.notify();
}
}
SocketChannel socketChannel = channel.accept();
connectionThreads.add(new ConnectionThread(socketChannel));
} catch (ClosedByInterruptException e) {
// We'll exit
} catch (ClosedChannelException e) {
return;
} catch (Exception e) {
log.log(Level.WARNING, "Unexpected error reading request", e);
}
}
channel.close();
} catch (IOException e) {
throw new ConfigurationException("Socket channel failure", e);
}
}
use of com.yahoo.prelude.ConfigurationException in project vespa by vespa-engine.
the class SemanticSearcher method toList.
private static List<RuleBase> toList(SemanticRulesConfig config) {
try {
RuleImporter ruleImporter = new RuleImporter(config);
List<RuleBase> ruleBaseList = new java.util.ArrayList<>();
for (SemanticRulesConfig.Rulebase ruleBaseConfig : config.rulebase()) {
RuleBase ruleBase = ruleImporter.importConfig(ruleBaseConfig);
if (ruleBaseConfig.isdefault())
ruleBase.setDefault(true);
ruleBaseList.add(ruleBase);
}
return ruleBaseList;
} catch (Exception e) {
throw new ConfigurationException("Failed configuring semantic rules", e);
}
}
Aggregations