use of com.yahoo.searchdefinition.UnproperSearch in project vespa by vespa-engine.
the class IndexedSearchCluster method deriveAllSearchDefinitions.
protected void deriveAllSearchDefinitions(List<SearchDefinitionSpec> localSearches, List<com.yahoo.searchdefinition.Search> globalSearches) {
for (SearchDefinitionSpec spec : localSearches) {
com.yahoo.searchdefinition.Search search = spec.getSearchDefinition().getSearch();
if (!(search instanceof UnproperSearch)) {
DocumentDatabase db = new DocumentDatabase(this, search.getName(), new DerivedConfiguration(search, globalSearches, deployLogger(), getRoot().getDeployState().rankProfileRegistry(), getRoot().getDeployState().getQueryProfiles().getRegistry()));
// TODO: remove explicit adding of user configs when the complete content model is built using builders.
db.mergeUserConfigs(spec.getUserConfigs());
documentDbs.add(db);
}
}
}
use of com.yahoo.searchdefinition.UnproperSearch in project vespa by vespa-engine.
the class ApplicationDeployTest method testVespaModel.
@Test
public void testVespaModel() throws SAXException, IOException {
FilesApplicationPackage app = createAppPkg(TESTDIR + "app1");
assertThat(app.getApplicationName(), is("app1"));
VespaModel model = new VespaModel(app);
List<SearchDefinition> searchDefinitions = getSearchDefinitions(app);
assertEquals(searchDefinitions.size(), 5);
for (SearchDefinition searchDefinition : searchDefinitions) {
Search s = searchDefinition.getSearch();
switch(s.getName()) {
case "music":
case "laptop":
case "pc":
case "sock":
break;
case "product":
assertTrue(s instanceof UnproperSearch);
assertEquals(s.getDocument().getField("title").getDataType(), DataType.STRING);
break;
default:
fail();
}
}
File[] truth = new File[] { new File(TESTSDDIR + "laptop.sd"), new File(TESTSDDIR + "music.sd"), new File(TESTSDDIR + "pc.sd"), new File(TESTSDDIR + "product.sd"), new File(TESTSDDIR + "sock.sd") };
Arrays.sort(truth);
List<File> appSdFiles = app.getSearchDefinitionFiles();
Collections.sort(appSdFiles);
assertEquals(appSdFiles, Arrays.asList(truth));
List<FilesApplicationPackage.Component> components = app.getComponents();
assertEquals(1, components.size());
Map<String, Bundle.DefEntry> defEntriesByName = defEntries2map(components.get(0).getDefEntries());
assertEquals(5, defEntriesByName.size());
Bundle.DefEntry def1 = defEntriesByName.get("test-namespace");
assertNotNull(def1);
assertEquals("namespace=config\nintVal int default=0", def1.contents);
Bundle.DefEntry def2 = defEntriesByName.get("namespace-in-filename");
assertNotNull(def2);
assertEquals("namespace=a.b\n\ndoubleVal double default=0.0", def2.contents);
// Check that getFilename works
ArrayList<String> sdFileNames = new ArrayList<>();
for (SearchDefinition sd : searchDefinitions) {
sdFileNames.add(sd.getFilename());
}
Collections.sort(sdFileNames);
assertThat(sdFileNames.get(0), is("laptop.sd"));
assertThat(sdFileNames.get(1), is("music.sd"));
assertThat(sdFileNames.get(2), is("pc.sd"));
assertThat(sdFileNames.get(3), is("product.sd"));
assertThat(sdFileNames.get(4), is("sock.sd"));
}
Aggregations