aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/searchdefinition/UnprocessingSearchBuilder.java
blob: 1201de86d8d1c3a683751422eb23be1f2a17a33a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchdefinition;

import com.yahoo.search.query.profile.QueryProfileRegistry;
import com.yahoo.searchdefinition.parser.ParseException;
import com.yahoo.config.application.api.ApplicationPackage;
import com.yahoo.config.application.api.DeployLogger;
import com.yahoo.vespa.model.container.search.QueryProfiles;

import java.io.IOException;

/**
 * A SearchBuilder that does not run the processing chain for searches
 */
public class UnprocessingSearchBuilder extends SearchBuilder {

    public UnprocessingSearchBuilder(ApplicationPackage app,
                                     RankProfileRegistry rankProfileRegistry,
                                     QueryProfileRegistry queryProfileRegistry) {
        super(app, rankProfileRegistry, queryProfileRegistry);
    }

    public UnprocessingSearchBuilder() {
        super();
    }

    public UnprocessingSearchBuilder(RankProfileRegistry rankProfileRegistry,
                                     QueryProfileRegistry queryProfileRegistry) {
        super(rankProfileRegistry, queryProfileRegistry);
    }

    @Override
    public void process(Search search, DeployLogger deployLogger, QueryProfiles queryProfiles) {
        // empty
    }

    public static Search buildUnprocessedFromFile(String fileName) throws IOException, ParseException {
        SearchBuilder builder = new UnprocessingSearchBuilder();
        builder.importFile(fileName);
        builder.build();
        return builder.getSearch();
    }
}