From bdfc429cda06bb6f285e94f9ac5752bc86b7df57 Mon Sep 17 00:00:00 2001 From: gjoranv Date: Tue, 19 May 2020 21:02:34 +0200 Subject: Allow creating a CompiledQueryProfileRegistry from config. --- container-search/abi-spec.json | 3 ++- .../compiled/CompiledQueryProfileRegistry.java | 18 ++++++++++++-- .../compiled/CompiledQueryProfileRegistryTest.java | 28 ++++++++++++++++++++++ .../test/QueryProfileConfigurationTestCase.java | 14 +++++------ 4 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 container-search/src/test/java/com/yahoo/search/query/profile/compiled/CompiledQueryProfileRegistryTest.java (limited to 'container-search') diff --git a/container-search/abi-spec.json b/container-search/abi-spec.json index 51fee99a743..03ddf488b16 100644 --- a/container-search/abi-spec.json +++ b/container-search/abi-spec.json @@ -6063,8 +6063,9 @@ ], "methods": [ "public void ()", + "public void (com.yahoo.search.query.profile.config.QueryProfilesConfig)", "public void (com.yahoo.search.query.profile.types.QueryProfileTypeRegistry)", - "public void register(com.yahoo.search.query.profile.compiled.CompiledQueryProfile)", + "public final void register(com.yahoo.search.query.profile.compiled.CompiledQueryProfile)", "public com.yahoo.search.query.profile.types.QueryProfileTypeRegistry getTypeRegistry()", "public com.yahoo.search.query.profile.compiled.CompiledQueryProfile findQueryProfile(java.lang.String)" ], diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/compiled/CompiledQueryProfileRegistry.java b/container-search/src/main/java/com/yahoo/search/query/profile/compiled/CompiledQueryProfileRegistry.java index 7ab05d0cd1e..744c6eb6933 100644 --- a/container-search/src/main/java/com/yahoo/search/query/profile/compiled/CompiledQueryProfileRegistry.java +++ b/container-search/src/main/java/com/yahoo/search/query/profile/compiled/CompiledQueryProfileRegistry.java @@ -1,9 +1,14 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.search.query.profile.compiled; +import com.google.inject.Inject; import com.yahoo.component.ComponentSpecification; import com.yahoo.component.provider.ComponentRegistry; -import com.yahoo.search.query.profile.types.QueryProfileType; +import com.yahoo.search.query.profile.QueryProfile; +import com.yahoo.search.query.profile.QueryProfileCompiler; +import com.yahoo.search.query.profile.QueryProfileRegistry; +import com.yahoo.search.query.profile.config.QueryProfileConfigurer; +import com.yahoo.search.query.profile.config.QueryProfilesConfig; import com.yahoo.search.query.profile.types.QueryProfileTypeRegistry; /** @@ -18,6 +23,15 @@ public class CompiledQueryProfileRegistry extends ComponentRegistry