Search in sources :

Example 1 with ComponentId

use of com.yahoo.component.ComponentId in project vespa by vespa-engine.

the class JDiscContainerDocprocTest method requireThatLaterDocumentProcessingWorks.

@Test
public void requireThatLaterDocumentProcessingWorks() throws Exception {
    try (Application app = new ApplicationBuilder().servicesXml(getXML(CHAIN_NAME, Rot13DocumentProcessor.class.getCanonicalName())).networking(Networking.disable).documentType("music", DOCUMENT).build()) {
        JDisc container = app.getJDisc("container");
        DocumentProcessing docProc = container.documentProcessing();
        DocumentType type = docProc.getDocumentTypes().get("music");
        ChainRegistry<DocumentProcessor> chains = docProc.getChains();
        assertTrue(chains.allComponentsById().containsKey(new ComponentId(CHAIN_NAME)));
        Document doc = new Document(type, "doc:this:is:a:great:album");
        doc.setFieldValue("title", "Great Album!");
        com.yahoo.docproc.Processing processing;
        DocumentProcessor.Progress progress;
        DocumentPut put = new DocumentPut(doc);
        processing = com.yahoo.docproc.Processing.of(put);
        progress = docProc.processOnce(ComponentSpecification.fromString(CHAIN_NAME), processing);
        assertThat(progress, instanceOf(DocumentProcessor.LaterProgress.class));
        assertThat(doc.getFieldValue("title").toString(), equalTo("Great Album!"));
        progress = docProc.processOnce(ComponentSpecification.fromString(CHAIN_NAME), processing);
        assertThat(progress, instanceOf(DocumentProcessor.LaterProgress.class));
        assertThat(doc.getFieldValue("title").toString(), equalTo("Great Album!"));
        progress = docProc.processOnce(ComponentSpecification.fromString(CHAIN_NAME), processing);
        assertThat(progress, sameInstance(DocumentProcessor.Progress.DONE));
        assertThat(doc.getFieldValue("title").toString(), equalTo("Terng Nyohz!"));
    }
}
Also used : Rot13DocumentProcessor(com.yahoo.application.container.docprocs.Rot13DocumentProcessor) Rot13DocumentProcessor(com.yahoo.application.container.docprocs.Rot13DocumentProcessor) DocumentProcessor(com.yahoo.docproc.DocumentProcessor) DocumentPut(com.yahoo.document.DocumentPut) DocumentType(com.yahoo.document.DocumentType) Document(com.yahoo.document.Document) ApplicationBuilder(com.yahoo.application.ApplicationBuilder) Application(com.yahoo.application.Application) ComponentId(com.yahoo.component.ComponentId) Test(org.junit.Test)

Example 2 with ComponentId

use of com.yahoo.component.ComponentId in project vespa by vespa-engine.

the class ContainerCluster method addMbusServer.

public void addMbusServer(ComponentId chainId) {
    ComponentId serviceId = chainId.nestInNamespace(ComponentId.fromString("MbusServer"));
    addComponent(new Component<>(new ComponentModel(new BundleInstantiationSpecification(serviceId, ComponentSpecification.fromString(MbusServerProvider.class.getName()), null))));
}
Also used : MbusServerProvider(com.yahoo.container.jdisc.messagebus.MbusServerProvider) ComponentModel(com.yahoo.osgi.provider.model.ComponentModel) BundleInstantiationSpecification(com.yahoo.container.bundle.BundleInstantiationSpecification) ComponentId(com.yahoo.component.ComponentId)

Example 3 with ComponentId

use of com.yahoo.component.ComponentId in project vespa by vespa-engine.

the class ContainerDocumentApi method setupLegacySearchers.

private void setupLegacySearchers(ContainerCluster cluster) {
    Set<ComponentSpecification> inherited = new TreeSet<>();
    SearchChain vespaGetChain = new SearchChain(new ChainSpecification(new ComponentId("vespaget"), new ChainSpecification.Inheritance(inherited, null), new ArrayList<>(), new TreeSet<>()));
    vespaGetChain.addInnerComponent(newVespaClientSearcher("com.yahoo.storage.searcher.GetSearcher"));
    SearchChain vespaVisitChain = new SearchChain(new ChainSpecification(new ComponentId("vespavisit"), new ChainSpecification.Inheritance(inherited, null), new ArrayList<>(), new TreeSet<>()));
    vespaVisitChain.addInnerComponent(newVespaClientSearcher("com.yahoo.storage.searcher.VisitSearcher"));
    SearchChains chains;
    if (cluster.getSearch() != null) {
        chains = cluster.getSearchChains();
    } else {
        chains = new SearchChains(cluster, "searchchain");
    }
    chains.add(vespaGetChain);
    chains.add(vespaVisitChain);
    if (cluster.getSearch() == null) {
        ContainerSearch containerSearch = new ContainerSearch(cluster, chains, new ContainerSearch.Options());
        cluster.setSearch(containerSearch);
        ProcessingHandler<SearchChains> searchHandler = new ProcessingHandler<>(chains, "com.yahoo.search.handler.SearchHandler");
        searchHandler.addServerBindings("http://*/search/*", "https://*/search/*");
        cluster.addComponent(searchHandler);
    }
}
Also used : SearchChains(com.yahoo.vespa.model.container.search.searchchain.SearchChains) ComponentSpecification(com.yahoo.component.ComponentSpecification) ProcessingHandler(com.yahoo.vespa.model.container.component.chain.ProcessingHandler) ContainerSearch(com.yahoo.vespa.model.container.search.ContainerSearch) ChainSpecification(com.yahoo.component.chain.model.ChainSpecification) ArrayList(java.util.ArrayList) SearchChain(com.yahoo.vespa.model.container.search.searchchain.SearchChain) TreeSet(java.util.TreeSet) ComponentId(com.yahoo.component.ComponentId)

Example 4 with ComponentId

use of com.yahoo.component.ComponentId in project vespa by vespa-engine.

the class LocalProvider method disableStemmingIfStreaming.

// TODO: ugly, restructure this
private Set<ComponentSpecification> disableStemmingIfStreaming(Set<ComponentSpecification> searcherReferences) {
    if (!searchCluster.isStreaming()) {
        return searcherReferences;
    } else {
        Set<ComponentSpecification> filteredSearcherReferences = new LinkedHashSet<>(searcherReferences);
        filteredSearcherReferences.remove(toGlobalComponentId(new ComponentId("com.yahoo.prelude.querytransform.StemmingSearcher")).toSpecification());
        return filteredSearcherReferences;
    }
}
Also used : ComponentSpecification(com.yahoo.component.ComponentSpecification) ComponentId(com.yahoo.component.ComponentId)

Example 5 with ComponentId

use of com.yahoo.component.ComponentId in project vespa by vespa-engine.

the class RankProfileTestCase method setupQueryProfileTypes.

private static QueryProfileRegistry setupQueryProfileTypes() {
    QueryProfileRegistry registry = new QueryProfileRegistry();
    QueryProfileTypeRegistry typeRegistry = registry.getTypeRegistry();
    QueryProfileType type = new QueryProfileType(new ComponentId("testtype"));
    type.addField(new FieldDescription("ranking.features.query(tensor1)", FieldType.fromString("tensor(x[10])", typeRegistry)), typeRegistry);
    type.addField(new FieldDescription("ranking.features.query(tensor2)", FieldType.fromString("tensor(y{})", typeRegistry)), typeRegistry);
    type.addField(new FieldDescription("ranking.features.invalid(tensor3)", FieldType.fromString("tensor(x{})", typeRegistry)), typeRegistry);
    type.addField(new FieldDescription("ranking.features.query(numeric)", FieldType.fromString("integer", typeRegistry)), typeRegistry);
    typeRegistry.register(type);
    return registry;
}
Also used : QueryProfileTypeRegistry(com.yahoo.search.query.profile.types.QueryProfileTypeRegistry) QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) QueryProfileType(com.yahoo.search.query.profile.types.QueryProfileType) ComponentId(com.yahoo.component.ComponentId) FieldDescription(com.yahoo.search.query.profile.types.FieldDescription)

Aggregations

ComponentId (com.yahoo.component.ComponentId)68 Test (org.junit.Test)25 Result (com.yahoo.search.Result)14 Query (com.yahoo.search.Query)13 Execution (com.yahoo.search.searchchain.Execution)13 ArrayList (java.util.ArrayList)10 Chain (com.yahoo.component.chain.Chain)8 Searcher (com.yahoo.search.Searcher)8 ComponentRegistry (com.yahoo.component.provider.ComponentRegistry)7 QueryProfileType (com.yahoo.search.query.profile.types.QueryProfileType)7 FederationSearcher (com.yahoo.search.federation.FederationSearcher)6 Hit (com.yahoo.search.result.Hit)6 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)6 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)4 ChainsConfig (com.yahoo.container.core.ChainsConfig)4 FilterChainRepository (com.yahoo.container.http.filter.FilterChainRepository)4 FieldDescription (com.yahoo.search.query.profile.types.FieldDescription)4 QueryProfileTypeRegistry (com.yahoo.search.query.profile.types.QueryProfileTypeRegistry)4 Component (com.yahoo.vespa.model.container.component.Component)4 HashMap (java.util.HashMap)4