Search in sources :

Example 21 with MessagePropertyProcessor

use of com.yahoo.feedapi.MessagePropertyProcessor in project vespa by vespa-engine.

the class GetSearcherTestCase method testResultWithNullDocument.

@Test
public void testResultWithNullDocument() throws Exception {
    DocumentSessionFactory factory = new DocumentSessionFactory(docType, null, true);
    factory.setNullReply(true);
    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:55:bad_document_id"));
    // Document not found does not produce any hit at all, error or otherwise
    assertNull(result.hits().getErrorHit());
    assertRendered("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<result>\n" + "</result>\n", result);
}
Also used : Chain(com.yahoo.component.chain.Chain) ClusterList(com.yahoo.vespaclient.ClusterList) Execution(com.yahoo.search.searchchain.Execution) FeedContext(com.yahoo.feedapi.FeedContext) Searcher(com.yahoo.search.Searcher) MessagePropertyProcessor(com.yahoo.feedapi.MessagePropertyProcessor) NullFeedMetric(com.yahoo.feedhandler.NullFeedMetric) Result(com.yahoo.search.Result) Test(org.junit.Test)

Example 22 with MessagePropertyProcessor

use of com.yahoo.feedapi.MessagePropertyProcessor in project vespa by vespa-engine.

the class GetSearcherTestCase method testBadPriorityValue.

@Test
public void testBadPriorityValue() 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=userdoc:kittens:1:2&priority=onkel_jubalon"));
    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: No enum const" + (Util.isJava7Compatible() ? "ant " : " class ") + "com.yahoo.documentapi.messagebus.protocol.DocumentProtocol" + (Util.isJava7Compatible() ? "." : "$") + "Priority.onkel_jubalon\"/>\n" + "</errors>\n" + "</result>\n", result);
}
Also used : Chain(com.yahoo.component.chain.Chain) ClusterList(com.yahoo.vespaclient.ClusterList) Execution(com.yahoo.search.searchchain.Execution) FeedContext(com.yahoo.feedapi.FeedContext) Searcher(com.yahoo.search.Searcher) MessagePropertyProcessor(com.yahoo.feedapi.MessagePropertyProcessor) NullFeedMetric(com.yahoo.feedhandler.NullFeedMetric) Result(com.yahoo.search.Result) Test(org.junit.Test)

Example 23 with MessagePropertyProcessor

use of com.yahoo.feedapi.MessagePropertyProcessor in project vespa by vespa-engine.

the class GetSearcherTestCase method testJsonRendererSetting.

@Test
public void testJsonRendererSetting() throws Exception {
    // Needs auto-reply
    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);
    Query query = newQuery("?id=userdoc:kittens:1:2&format=json");
    Result result = new Execution(searchChain, Execution.Context.createContextStub()).search(query);
    assertFalse(result.getTemplating().getTemplates() instanceof DocumentXMLTemplate);
}
Also used : Chain(com.yahoo.component.chain.Chain) ClusterList(com.yahoo.vespaclient.ClusterList) Query(com.yahoo.search.Query) Searcher(com.yahoo.search.Searcher) Result(com.yahoo.search.Result) Execution(com.yahoo.search.searchchain.Execution) FeedContext(com.yahoo.feedapi.FeedContext) MessagePropertyProcessor(com.yahoo.feedapi.MessagePropertyProcessor) NullFeedMetric(com.yahoo.feedhandler.NullFeedMetric) Test(org.junit.Test)

Example 24 with MessagePropertyProcessor

use of com.yahoo.feedapi.MessagePropertyProcessor in project vespa by vespa-engine.

the class VisitorSearcherTestCase method create.

public VisitSearcher create() throws Exception {
    ClusterListConfig.Storage.Builder storageCluster = new ClusterListConfig.Storage.Builder().configid("storage/cluster.foobar").name("foobar");
    ClusterListConfig clusterListCfg = new ClusterListConfig(new ClusterListConfig.Builder().storage(storageCluster));
    ClusterList clusterList = new ClusterList(clusterListCfg);
    return new VisitSearcher(new FeedContext(new MessagePropertyProcessor(new FeederConfig(new FeederConfig.Builder().timeout(458).route("riksveg18").retryenabled(true)), new LoadTypeConfig(new LoadTypeConfig.Builder())), factory, docMan, clusterList, new NullFeedMetric()));
}
Also used : ClusterList(com.yahoo.vespaclient.ClusterList) FeedContext(com.yahoo.feedapi.FeedContext) ClusterListConfig(com.yahoo.cloud.config.ClusterListConfig) FeederConfig(com.yahoo.vespaclient.config.FeederConfig) MessagePropertyProcessor(com.yahoo.feedapi.MessagePropertyProcessor) NullFeedMetric(com.yahoo.feedhandler.NullFeedMetric) LoadTypeConfig(com.yahoo.vespa.config.content.LoadTypeConfig)

Example 25 with MessagePropertyProcessor

use of com.yahoo.feedapi.MessagePropertyProcessor in project vespa by vespa-engine.

the class Arguments method parse.

void parse(String[] argList) throws HelpShownException {
    List<String> args = new LinkedList<String>();
    args.addAll(Arrays.asList(argList));
    while (!args.isEmpty()) {
        String arg = args.remove(0);
        if (arg.equals("-h") || arg.equals("--help")) {
            help();
            throw new HelpShownException();
        } else if ("--abortondataerror".equals(arg)) {
            feederConfigBuilder.abortondocumenterror(getBoolean(getParam(args, arg)));
        } else if ("--abortonsenderror".equals(arg)) {
            feederConfigBuilder.abortonsenderror(getBoolean(getParam(args, arg)));
        } else if ("--file".equals(arg)) {
            files.add(getParam(args, arg));
        } else if ("--maxpending".equals(arg)) {
            feederConfigBuilder.maxpendingdocs(Integer.parseInt(getParam(args, arg)));
        } else if ("--maxpendingsize".equals(arg)) {
            feederConfigBuilder.maxpendingbytes(Integer.parseInt(getParam(args, arg)));
        } else if ("--mode".equals(arg)) {
            mode = getParam(args, arg);
        } else if ("--noretry".equals(arg)) {
            feederConfigBuilder.retryenabled(false);
        } else if ("--retrydelay".equals(arg)) {
            feederConfigBuilder.retrydelay(Integer.parseInt(getParam(args, arg)));
        } else if ("--route".equals(arg)) {
            feederConfigBuilder.route(getParam(args, arg));
        } else if ("--timeout".equals(arg)) {
            feederConfigBuilder.timeout(Double.parseDouble(getParam(args, arg)));
        } else if ("--trace".equals(arg)) {
            feederConfigBuilder.tracelevel(Integer.parseInt(getParam(args, arg)));
        } else if ("--validate".equals(arg)) {
            validateOnly = true;
        } else if ("--dumpDocuments".equals(arg)) {
            dumpDocumentsFile = getParam(args, arg);
        } else if ("--maxfeedrate".equals(arg)) {
            feederConfigBuilder.maxfeedrate(Double.parseDouble(getParam(args, arg)));
        } else if ("--create-if-non-existent".equals(arg)) {
            feederConfigBuilder.createifnonexistent(true);
        } else if ("-v".equals(arg) || "--verbose".equals(arg)) {
            verbose = true;
        } else if ("--priority".equals(arg)) {
            priority = getParam(args, arg);
        } else {
            files.add(arg);
        }
    }
    propertyProcessor = new MessagePropertyProcessor(getFeederConfig(), new LoadTypeConfig(new LoadTypeConfig.Builder()));
}
Also used : MessagePropertyProcessor(com.yahoo.feedapi.MessagePropertyProcessor) LinkedList(java.util.LinkedList) LoadTypeConfig(com.yahoo.vespa.config.content.LoadTypeConfig)

Aggregations

MessagePropertyProcessor (com.yahoo.feedapi.MessagePropertyProcessor)25 FeedContext (com.yahoo.feedapi.FeedContext)24 ClusterList (com.yahoo.vespaclient.ClusterList)24 NullFeedMetric (com.yahoo.feedhandler.NullFeedMetric)23 Chain (com.yahoo.component.chain.Chain)21 Test (org.junit.Test)21 Searcher (com.yahoo.search.Searcher)20 Execution (com.yahoo.search.searchchain.Execution)20 Result (com.yahoo.search.Result)19 GetDocumentMessage (com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage)7 Message (com.yahoo.messagebus.Message)7 FeederConfig (com.yahoo.vespaclient.config.FeederConfig)5 Query (com.yahoo.search.Query)4 LoadTypeConfig (com.yahoo.vespa.config.content.LoadTypeConfig)3 ClusterListConfig (com.yahoo.cloud.config.ClusterListConfig)2 GetDocumentReply (com.yahoo.documentapi.messagebus.protocol.GetDocumentReply)2 Hit (com.yahoo.search.result.Hit)2 HitGroup (com.yahoo.search.result.HitGroup)2 ComponentId (com.yahoo.component.ComponentId)1 ComponentRegistry (com.yahoo.component.provider.ComponentRegistry)1