use of com.yahoo.search.Searcher in project vespa by vespa-engine.
the class GetSearcherTestCase method testDocumentFieldWithMultipleIDs.
@Test
public void testDocumentFieldWithMultipleIDs() throws Exception {
DocumentSessionFactory factory = new DocumentSessionFactory(docType);
GetSearcher searcher = new GetSearcher(new FeedContext(new MessagePropertyProcessor(defFeedCfg, defLoadTypeCfg), factory, docMan, new ClusterList(), new NullFeedMetric()));
Chain<Searcher> searchChain = new Chain<>(searcher);
Result result = new Execution(searchChain, Execution.Context.createContextStub()).search(newQuery("?id[0]=userdoc:kittens:1:2&id[1]=userdoc:kittens:3:4&field=name"));
assertNotNull(result.hits().getErrorHit());
assertRendered("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<result>\n" + "<errors>\n" + "<error type=\"searcher\" code=\"3\" message=\"Illegal query: " + "java.lang.IllegalArgumentException: Field only valid for single document id query\"/>\n" + "</errors>\n" + "</result>\n", result);
}
use of com.yahoo.search.Searcher in project vespa by vespa-engine.
the class VisitorSearcherTestCase method testSimple.
@Test
public void testSimple() throws Exception {
Chain<Searcher> searchChain = new Chain<>(create());
Result result = new Execution(searchChain, Execution.Context.createContextStub()).search(newQuery("visit?visit.selection=id.user=1234&hits=100"));
assertEquals(1, result.hits().size());
assertRendered("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<result>\n" + "<document documenttype=\"kittens\" documentid=\"userdoc:foo:1234:bar\"/>\n" + "</result>\n", result);
}
use of com.yahoo.search.Searcher in project vespa by vespa-engine.
the class SearchChainRegistry method setupSearcherRegistry.
private SearcherRegistry setupSearcherRegistry(ComponentRegistry<? extends AbstractComponent> allComponents) {
SearcherRegistry registry = new SearcherRegistry();
for (AbstractComponent component : allComponents.allComponents()) {
if (component instanceof Searcher) {
registry.register((Searcher) component);
}
}
// just freeze this right away
registry.freeze();
return registry;
}
use of com.yahoo.search.Searcher in project vespa by vespa-engine.
the class AsyncExecutionTestCase method testSync.
public void testSync() {
Query query = new Query("?query=test");
Searcher searcher = new ResultProducingSearcher();
Result result = new Execution(searcher, Execution.Context.createContextStub()).search(query);
assertEquals(1, result.hits().size());
assertEquals("hello", result.hits().get(0).getField("test"));
}
use of com.yahoo.search.Searcher in project vespa by vespa-engine.
the class AsyncExecutionTestCase method testSyncThroughSync.
public void testSyncThroughSync() {
Query query = new Query("?query=test");
Searcher searcher = new ResultProducingSearcher();
Result result = new Execution(new Execution(searcher, Execution.Context.createContextStub())).search(query);
assertEquals(1, result.hits().size());
assertEquals("hello", result.hits().get(0).getField("test"));
}
Aggregations