Search in sources :

Example 6 with ConfigGetter

use of com.yahoo.config.subscription.ConfigGetter in project vespa by vespa-engine.

the class QueryRewriteSearcherTestUtils method createConfigObj.

/**
 * Create config object based on config path
 *
 * @param configPath path for the searcher config
 */
public static RewritesConfig createConfigObj(String configPath) {
    ConfigGetter<RewritesConfig> getter = new ConfigGetter<>(RewritesConfig.class);
    RewritesConfig config = getter.getConfig(configPath);
    return config;
}
Also used : RewritesConfig(com.yahoo.search.query.rewrite.RewritesConfig) ConfigGetter(com.yahoo.config.subscription.ConfigGetter)

Example 7 with ConfigGetter

use of com.yahoo.config.subscription.ConfigGetter in project vespa by vespa-engine.

the class IndexCombinatorTestCase method testMixedIndicesAndAttributes.

@Test
public void testMixedIndicesAndAttributes() {
    String indexInfoConfigID = "file:src/test/java/com/yahoo/prelude/querytransform/test/indexcombinator.cfg";
    ConfigGetter<IndexInfoConfig> getter = new ConfigGetter<>(IndexInfoConfig.class);
    IndexInfoConfig config = getter.getConfig(indexInfoConfigID);
    IndexFacts facts = new IndexFacts(new IndexModel(config, (QrSearchersConfig) null));
    Result r = new Execution(transformer, Execution.Context.createContextStub(facts)).search(new Query(QueryTestCase.httpEncode("?query=\"a b\"")));
    assertEquals("OR default:\"a b\" attribute1:a b attribute2:a b", r.getQuery().getModel().getQueryTree().getRoot().toString());
    r = new Execution(transformer, Execution.Context.createContextStub(facts)).search(new Query(QueryTestCase.httpEncode("?query=\"a b\" \"c d\"")));
    assertEquals("OR (AND default:\"a b\" default:\"c d\")" + " (AND default:\"a b\" attribute1:c d)" + " (AND default:\"a b\" attribute2:c d)" + " (AND attribute1:a b default:\"c d\")" + " (AND attribute1:a b attribute1:c d)" + " (AND attribute1:a b attribute2:c d)" + " (AND attribute2:a b default:\"c d\")" + " (AND attribute2:a b attribute1:c d)" + " (AND attribute2:a b attribute2:c d)", r.getQuery().getModel().getQueryTree().getRoot().toString());
}
Also used : Execution(com.yahoo.search.searchchain.Execution) IndexFacts(com.yahoo.prelude.IndexFacts) Query(com.yahoo.search.Query) ConfigGetter(com.yahoo.config.subscription.ConfigGetter) QrSearchersConfig(com.yahoo.container.QrSearchersConfig) IndexInfoConfig(com.yahoo.search.config.IndexInfoConfig) IndexModel(com.yahoo.prelude.IndexModel) Result(com.yahoo.search.Result) Test(org.junit.Test)

Example 8 with ConfigGetter

use of com.yahoo.config.subscription.ConfigGetter in project vespa by vespa-engine.

the class IndexFactsTestCase method createIndexFacts.

private IndexFacts createIndexFacts() {
    ConfigGetter<IndexInfoConfig> getter = new ConfigGetter<>(IndexInfoConfig.class);
    IndexInfoConfig config = getter.getConfig(INDEXFACTS_TESTING);
    List<String> clusterOne = new ArrayList<>();
    List<String> clusterTwo = new ArrayList<>();
    clusterOne.addAll(Arrays.asList("one", "two"));
    clusterTwo.addAll(Arrays.asList("one", "three"));
    Map<String, List<String>> clusters = new HashMap<>();
    clusters.put("clusterOne", clusterOne);
    clusters.put("clusterTwo", clusterTwo);
    IndexFacts indexFacts = new IndexFacts(new IndexModel(config, clusters));
    return indexFacts;
}
Also used : IndexFacts(com.yahoo.prelude.IndexFacts) HashMap(java.util.HashMap) ConfigGetter(com.yahoo.config.subscription.ConfigGetter) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) IndexInfoConfig(com.yahoo.search.config.IndexInfoConfig) IndexModel(com.yahoo.prelude.IndexModel)

Aggregations

ConfigGetter (com.yahoo.config.subscription.ConfigGetter)8 IndexFacts (com.yahoo.prelude.IndexFacts)4 IndexModel (com.yahoo.prelude.IndexModel)4 IndexInfoConfig (com.yahoo.search.config.IndexInfoConfig)4 Test (org.junit.Test)4 QrSearchersConfig (com.yahoo.container.QrSearchersConfig)3 DocumentdbInfoConfig (com.yahoo.prelude.fastsearch.DocumentdbInfoConfig)2 Query (com.yahoo.search.Query)2 Execution (com.yahoo.search.searchchain.Execution)2 Chain (com.yahoo.component.chain.Chain)1 SplitterJoinerDocumentProcessorConfig (com.yahoo.config.docproc.SplitterJoinerDocumentProcessorConfig)1 Processing (com.yahoo.docproc.Processing)1 Document (com.yahoo.document.Document)1 DocumentPut (com.yahoo.document.DocumentPut)1 DocumentTypeManager (com.yahoo.document.DocumentTypeManager)1 DocumentmanagerConfig (com.yahoo.document.config.DocumentmanagerConfig)1 Array (com.yahoo.document.datatypes.Array)1 StringFieldValue (com.yahoo.document.datatypes.StringFieldValue)1 MockBackend (com.yahoo.prelude.fastsearch.test.fs4mock.MockBackend)1 StemmingSearcher (com.yahoo.prelude.querytransform.StemmingSearcher)1