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());
}
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());
}
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);
}
Aggregations