use of com.yahoo.searchdefinition.document.Attribute in project vespa by vespa-engine.
the class ValidateFieldTypes method process.
@Override
public void process(boolean validate) {
if (!validate)
return;
String searchName = search.getName();
Map<String, DataType> seenFields = new HashMap<>();
search.allFields().forEach(field -> {
checkFieldType(searchName, "index field", field.getName(), field.getDataType(), seenFields);
for (Map.Entry<String, Attribute> entry : field.getAttributes().entrySet()) {
checkFieldType(searchName, "attribute", entry.getKey(), entry.getValue().getDataType(), seenFields);
}
});
for (DocumentSummary summary : search.getSummaries().values()) {
for (SummaryField field : summary.getSummaryFields()) {
checkFieldType(searchName, "summary field", field.getName(), field.getDataType(), seenFields);
}
}
}
use of com.yahoo.searchdefinition.document.Attribute in project vespa by vespa-engine.
the class SearchClusterTest method testSdConfigLogical.
@Test
public void testSdConfigLogical() throws IOException, SAXException {
// sd1
SDDocumentType sdt1 = new SDDocumentType("s1");
Search search1 = new Search("s1", null);
SDField f1 = new SDField("f1", DataType.STRING);
f1.addAttribute(new Attribute("f1", DataType.STRING));
f1.setIndexingScript(new ScriptExpression(new StatementExpression(new AttributeExpression("f1"))));
sdt1.addField(f1);
search1.addDocument(sdt1);
// sd2
SDDocumentType sdt2 = new SDDocumentType("s2");
Search search2 = new Search("s2", null);
SDField f2 = new SDField("f2", DataType.STRING);
f2.addAttribute(new Attribute("f2", DataType.STRING));
f2.setIndexingScript(new ScriptExpression(new StatementExpression(new AttributeExpression("f2"))));
sdt2.addField(f2);
search2.addDocument(sdt2);
SearchBuilder builder = new SearchBuilder();
builder.importRawSearch(search1);
builder.importRawSearch(search2);
builder.build();
}
Aggregations