Search in sources :

Example 1 with ConfigurationException

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;
}
Also used : Query(com.yahoo.search.Query) ConfigurationException(com.yahoo.prelude.ConfigurationException) ConfigurationException(com.yahoo.prelude.ConfigurationException) IOException(java.io.IOException) DocumentInfo(com.yahoo.fs4.DocumentInfo)

Example 2 with ConfigurationException

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);
    }
}
Also used : ClosedByInterruptException(java.nio.channels.ClosedByInterruptException) ServerSocketChannel(java.nio.channels.ServerSocketChannel) SocketChannel(java.nio.channels.SocketChannel) ClosedChannelException(java.nio.channels.ClosedChannelException) ConfigurationException(com.yahoo.prelude.ConfigurationException) IOException(java.io.IOException) ServerSocketChannel(java.nio.channels.ServerSocketChannel) ConfigurationException(com.yahoo.prelude.ConfigurationException) ClosedChannelException(java.nio.channels.ClosedChannelException) IOException(java.io.IOException) ClosedByInterruptException(java.nio.channels.ClosedByInterruptException)

Example 3 with ConfigurationException

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);
    }
}
Also used : ConfigurationException(com.yahoo.prelude.ConfigurationException) ConfigurationException(com.yahoo.prelude.ConfigurationException)

Aggregations

ConfigurationException (com.yahoo.prelude.ConfigurationException)3 IOException (java.io.IOException)2 DocumentInfo (com.yahoo.fs4.DocumentInfo)1 Query (com.yahoo.search.Query)1 ClosedByInterruptException (java.nio.channels.ClosedByInterruptException)1 ClosedChannelException (java.nio.channels.ClosedChannelException)1 ServerSocketChannel (java.nio.channels.ServerSocketChannel)1 SocketChannel (java.nio.channels.SocketChannel)1