Search in sources :

Example 6 with QrSearchersConfig

use of com.yahoo.container.QrSearchersConfig in project vespa by vespa-engine.

the class StemmingSearcherTestCase method testEmptyIndexInfo.

@Test
public void testEmptyIndexInfo() {
    String indexInfoConfigID = "file:src/test/java/com/yahoo/prelude/querytransform/test/emptyindexinfo.cfg";
    ConfigGetter<IndexInfoConfig> getter = new ConfigGetter<>(IndexInfoConfig.class);
    IndexInfoConfig config = getter.getConfig(indexInfoConfigID);
    IndexFacts indexFacts = new IndexFacts(new IndexModel(config, (QrSearchersConfig) null));
    Query q = new Query(QueryTestCase.httpEncode("?query=cars"));
    new Execution(new Chain<Searcher>(new StemmingSearcher(linguistics)), new Execution.Context(null, indexFacts, null, null, linguistics)).search(q);
    assertEquals("cars", q.getModel().getQueryTree().getRoot().toString());
}
Also used : Chain(com.yahoo.component.chain.Chain) 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) StemmingSearcher(com.yahoo.prelude.querytransform.StemmingSearcher) IndexInfoConfig(com.yahoo.search.config.IndexInfoConfig) IndexModel(com.yahoo.prelude.IndexModel) Test(org.junit.Test)

Example 7 with QrSearchersConfig

use of com.yahoo.container.QrSearchersConfig 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 QrSearchersConfig

use of com.yahoo.container.QrSearchersConfig in project vespa by vespa-engine.

the class GroupingValidatorTestCase method validateGrouping.

private static void validateGrouping(String clusterName, Collection<String> attributeNames, Query query) {
    QrSearchersConfig.Builder qrsConfig = new QrSearchersConfig.Builder().searchcluster(new QrSearchersConfig.Searchcluster.Builder().indexingmode(QrSearchersConfig.Searchcluster.Indexingmode.Enum.REALTIME).name(clusterName));
    ClusterConfig.Builder clusterConfig = new ClusterConfig.Builder().clusterId(0).clusterName("test");
    AttributesConfig.Builder attributesConfig = new AttributesConfig.Builder();
    for (String attributeName : attributeNames) {
        attributesConfig.attribute(new AttributesConfig.Attribute.Builder().name(attributeName));
    }
    new Execution(new GroupingValidator(new QrSearchersConfig(qrsConfig), new ClusterConfig(clusterConfig), new AttributesConfig(attributesConfig)), Execution.Context.createContextStub()).search(query);
}
Also used : Execution(com.yahoo.search.searchchain.Execution) QrSearchersConfig(com.yahoo.container.QrSearchersConfig) AttributesConfig(com.yahoo.vespa.config.search.AttributesConfig) ClusterConfig(com.yahoo.search.config.ClusterConfig)

Aggregations

QrSearchersConfig (com.yahoo.container.QrSearchersConfig)8 ConfigGetter (com.yahoo.config.subscription.ConfigGetter)3 IndexFacts (com.yahoo.prelude.IndexFacts)3 IndexModel (com.yahoo.prelude.IndexModel)3 Query (com.yahoo.search.Query)3 ClusterConfig (com.yahoo.search.config.ClusterConfig)3 IndexInfoConfig (com.yahoo.search.config.IndexInfoConfig)3 Execution (com.yahoo.search.searchchain.Execution)3 Test (org.junit.Test)3 ComponentId (com.yahoo.component.ComponentId)2 Chain (com.yahoo.component.chain.Chain)2 VipStatus (com.yahoo.container.handler.VipStatus)1 Fs4Config (com.yahoo.container.search.Fs4Config)1 LegacyEmulationConfig (com.yahoo.container.search.LegacyEmulationConfig)1 DocumentdbInfoConfig (com.yahoo.prelude.fastsearch.DocumentdbInfoConfig)1 FS4ResourcePool (com.yahoo.prelude.fastsearch.FS4ResourcePool)1 StemmingSearcher (com.yahoo.prelude.querytransform.StemmingSearcher)1 CachingSearcher (com.yahoo.prelude.searcher.CachingSearcher)1 DocumentSourceSearcher (com.yahoo.prelude.searcher.DocumentSourceSearcher)1 JuniperSearcher (com.yahoo.prelude.searcher.JuniperSearcher)1