blob: e47c5590f164c49064f2e696db2aa9ba06906a05 (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.container.search;
import com.yahoo.config.application.api.DeployLogger;
import com.yahoo.io.reader.NamedReader;
import com.yahoo.search.query.profile.config.QueryProfileXMLReader;
import com.yahoo.config.application.api.ApplicationPackage;
import java.util.List;
/**
* Reads the query profile and query profile types from an application package. The actual reading
* is delegated to a {@link com.yahoo.search.query.profile.config.QueryProfileXMLReader}.
*
* @author bratseth
*/
public class QueryProfilesBuilder {
/** Build the set of query profiles for an application package */
public QueryProfiles build(ApplicationPackage applicationPackage, DeployLogger logger) {
List<NamedReader> queryProfileTypeFiles = null;
List<NamedReader> queryProfileFiles = null;
try {
queryProfileTypeFiles = applicationPackage.getQueryProfileTypeFiles();
queryProfileFiles = applicationPackage.getQueryProfileFiles();
return new QueryProfiles(new QueryProfileXMLReader().read(queryProfileTypeFiles, queryProfileFiles),
logger);
}
finally {
NamedReader.closeAll(queryProfileTypeFiles);
NamedReader.closeAll(queryProfileFiles);
}
}
}
|