Search in sources :

Example 1 with ComponentSpecification

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

the class ApplicationTest method container_and_referenced_content.

/**
 * Tests that an application with search chains referencing a content cluster can be constructed.
 */
@Test
public void container_and_referenced_content() throws Exception {
    try (Application application = Application.fromApplicationPackage(new File("src/test/app-packages/withcontent"), Networking.disable)) {
        Result result = application.getJDisc("default").search().process(new ComponentSpecification("default"), new Query("?query=substring:foobar&tracelevel=3"));
        assertEquals("AND substring:fo substring:oo substring:ob substring:ba substring:ar", result.hits().get("hasQuery").getQuery().getModel().getQueryTree().toString());
    }
}
Also used : Query(com.yahoo.search.Query) ComponentSpecification(com.yahoo.component.ComponentSpecification) File(java.io.File) Result(com.yahoo.search.Result) Test(org.junit.Test)

Example 2 with ComponentSpecification

use of com.yahoo.component.ComponentSpecification 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 3 with ComponentSpecification

use of com.yahoo.component.ComponentSpecification 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 4 with ComponentSpecification

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

the class QueryProfileXMLReader method fillQueryProfileTypes.

public void fillQueryProfileTypes(List<Element> queryProfileTypeElements, QueryProfileTypeRegistry registry) {
    for (Element element : queryProfileTypeElements) {
        QueryProfileType type = registry.getComponent(new ComponentSpecification(element.getAttribute("id")).toId());
        try {
            readInheritedTypes(element, type, registry);
            readFieldDefinitions(element, type, registry);
        } catch (RuntimeException e) {
            throw new IllegalArgumentException("Error reading " + type, e);
        }
    }
}
Also used : ComponentSpecification(com.yahoo.component.ComponentSpecification) Element(org.w3c.dom.Element) QueryProfileType(com.yahoo.search.query.profile.types.QueryProfileType)

Example 5 with ComponentSpecification

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

the class QueryProfileXMLReader method fillQueryProfiles.

public void fillQueryProfiles(List<Element> queryProfileElements, QueryProfileRegistry registry) {
    for (Element element : queryProfileElements) {
        // Lookup by exact id
        QueryProfile profile = registry.getComponent(new ComponentSpecification(element.getAttribute("id")).toId());
        try {
            readInherited(element, profile, registry, null, profile.toString());
            readFields(element, profile, registry, null, profile.toString());
            readVariants(element, profile, registry);
        } catch (RuntimeException e) {
            throw new IllegalArgumentException("Error reading " + profile, e);
        }
    }
}
Also used : QueryProfile(com.yahoo.search.query.profile.QueryProfile) ComponentSpecification(com.yahoo.component.ComponentSpecification) Element(org.w3c.dom.Element)

Aggregations

ComponentSpecification (com.yahoo.component.ComponentSpecification)17 ArrayList (java.util.ArrayList)4 Element (org.w3c.dom.Element)4 ComponentId (com.yahoo.component.ComponentId)2 BundleInstantiationSpecification (com.yahoo.container.bundle.BundleInstantiationSpecification)2 QueryProfile (com.yahoo.search.query.profile.QueryProfile)2 Phase (com.yahoo.component.chain.Phase)1 ChainSpecification (com.yahoo.component.chain.model.ChainSpecification)1 FileReference (com.yahoo.config.FileReference)1 CloudSubscriberFactory (com.yahoo.container.di.CloudSubscriberFactory)1 Container (com.yahoo.container.di.Container)1 ContainerTest (com.yahoo.container.di.ContainerTest)1 Osgi (com.yahoo.container.di.Osgi)1 Query (com.yahoo.search.Query)1 Result (com.yahoo.search.Result)1 DimensionValues (com.yahoo.search.query.profile.DimensionValues)1 QueryProfileType (com.yahoo.search.query.profile.types.QueryProfileType)1 FederationOptions (com.yahoo.search.searchchain.model.federation.FederationOptions)1 TargetSpec (com.yahoo.search.searchchain.model.federation.FederationSearcherModel.TargetSpec)1 Container (com.yahoo.vespa.model.container.Container)1