use of com.yahoo.document.Field in project vespa by vespa-engine.
the class DocumentModelBuilder method extractDataTypesFromFields.
private static void extractDataTypesFromFields(NewDocumentType dt, Collection<Field> fields) {
for (Field f : fields) {
DataType type = f.getDataType();
if (testAddType(dt, type)) {
extractNestedTypes(dt, type);
addType(dt, type);
}
}
}
use of com.yahoo.document.Field in project vespa by vespa-engine.
the class DocumentModelBuilder method handleStruct.
private static StructDataType handleStruct(NewDocumentType dt, StructDataType s) {
for (Field f : s.getFieldsThisTypeOnly()) {
specialHandleAnnotationReference(dt, f);
}
extractNestedTypes(dt, s);
addType(dt, s);
return s;
}
use of com.yahoo.document.Field in project vespa by vespa-engine.
the class DocumentModelBuilder method addToModel.
public void addToModel(Search search) {
// Then we add the search specific stuff
SearchDef searchDef = new SearchDef(search.getName());
addSearchFields(search.extraFieldList(), searchDef);
for (Field f : search.getDocument().fieldSet()) {
addSearchField((SDField) f, searchDef);
}
for (SDField field : search.allConcreteFields()) {
for (Attribute attribute : field.getAttributes().values()) {
if (!searchDef.getFields().containsKey(attribute.getName())) {
searchDef.add(new SearchField(new Field(attribute.getName(), field), !field.getIndices().isEmpty(), true));
}
}
}
for (Field f : search.getDocument().fieldSet()) {
addAlias((SDField) f, searchDef);
}
model.getSearchManager().add(searchDef);
}
use of com.yahoo.document.Field in project vespa by vespa-engine.
the class IndexSchema method deriveIndexFields.
private void deriveIndexFields(ImmutableSDField field, Search search) {
if (!field.doesIndexing() && !field.isIndexStructureField()) {
return;
}
List<Field> lst = flattenField(field.asField());
if (lst.isEmpty()) {
return;
}
String fieldName = field.getName();
for (Field flatField : lst) {
deriveIndexFields(flatField, search);
}
if (lst.size() > 1) {
FieldSet fieldSet = new FieldSet(fieldName);
for (Field flatField : lst) {
fieldSet.addFieldName(flatField.getName());
}
fieldSets.put(fieldName, fieldSet);
}
}
use of com.yahoo.document.Field in project vespa by vespa-engine.
the class FieldOperationApplierForStructs method copyFields.
private void copyFields(SDDocumentType structType, SDDocumentType sdoc) {
// find all fields in OTHER types that have this type:
List<SDDocumentType> list = new ArrayList<>();
list.add(sdoc);
list.addAll(sdoc.getTypes());
for (SDDocumentType anyType : list) {
Iterator<Field> fields = anyType.fieldIterator();
while (fields.hasNext()) {
SDField field = (SDField) fields.next();
DataType structUsedByField = field.getFirstStructRecursive();
if (structUsedByField == null) {
continue;
}
if (structUsedByField.getName().equals(structType.getName())) {
// this field is using this type!!
field.populateWithStructFields(sdoc, field.getName(), field.getDataType(), field.isHeader(), 0);
field.populateWithStructMatching(sdoc, field.getName(), field.getDataType(), field.getMatching());
}
}
}
}
Aggregations