querqy.elasticsearch.infologging.SingleSinkInfoLogging Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of querqy-elasticsearch Show documentation
Show all versions of querqy-elasticsearch Show documentation
Querqy library for query rewriting: Querqy for Elasticsearch
package querqy.elasticsearch.infologging;
import querqy.infologging.InfoLogging;
import querqy.infologging.Sink;
import querqy.rewrite.SearchEngineRequestAdapter;
import java.util.Collections;
import java.util.Set;
public class SingleSinkInfoLogging implements InfoLogging {
private final Sink sink;
private final Set enabledRewriterIds;
public SingleSinkInfoLogging(final Sink sink, final Set enabledRewriterIds) {
this.sink = sink;
this.enabledRewriterIds = enabledRewriterIds == null
? Collections.emptySet()
: Collections.unmodifiableSet(enabledRewriterIds);
}
@Override
public void log(final Object message, final String rewriterId,
final SearchEngineRequestAdapter searchEngineRequestAdapter) {
if (enabledRewriterIds.contains(rewriterId)) {
sink.log(message, rewriterId, searchEngineRequestAdapter);
}
}
@Override
public void endOfRequest(final SearchEngineRequestAdapter searchEngineRequestAdapter) {
sink.endOfRequest(searchEngineRequestAdapter);
}
@Override
public boolean isLoggingEnabledForRewriter(final String rewriterId) {
return enabledRewriterIds.contains(rewriterId);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy