use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.
the class VsmFields method derive.
protected void derive(StreamingDocumentType document, SDField field) {
if (field.usesStructOrMap()) {
for (SDField structField : field.getStructFields()) {
// Recursion
derive(document, structField);
}
} else {
if (!(field.doesIndexing() || field.doesSummarying() || field.doesAttributing()))
return;
StreamingField streamingField = new StreamingField(field);
addField(streamingField.getName(), streamingField);
deriveIndices(document, field, streamingField);
}
}
use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.
the class FieldOperationApplier method apply.
protected void apply(Field field) {
if (field instanceof SDField) {
SDField sdField = (SDField) field;
sdField.applyOperations();
}
}
use of com.yahoo.searchdefinition.document.SDField 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());
}
}
}
}
use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.
the class TextMatch method process.
@Override
public void process(boolean validate) {
for (SDField field : search.allConcreteFields()) {
if (field.getMatching().getType() != Matching.Type.TEXT)
continue;
ScriptExpression script = field.getIndexingScript();
if (script == null)
continue;
DataType fieldType = field.getDataType();
if (fieldType instanceof CollectionDataType) {
fieldType = ((CollectionDataType) fieldType).getNestedType();
}
if (fieldType != DataType.STRING)
continue;
Set<String> dynamicSummary = new TreeSet<>();
Set<String> staticSummary = new TreeSet<>();
new IndexingOutputs(search, deployLogger, rankProfileRegistry, queryProfiles).findSummaryTo(search, field, dynamicSummary, staticSummary);
MyVisitor visitor = new MyVisitor(dynamicSummary);
visitor.visit(script);
if (!visitor.requiresTokenize)
continue;
ExpressionConverter converter = new MyStringTokenizer(search, findAnnotatorConfig(search, field));
field.setIndexingScript((ScriptExpression) converter.convert(script));
}
}
use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.
the class ValidateFieldWithIndexSettingsCreatesIndex method process.
@Override
public void process(boolean validate) {
if (!validate)
return;
Matching defaultMatching = new Matching();
Ranking defaultRanking = new Ranking();
for (SDField field : search.allConcreteFields()) {
if (field.doesIndexing())
continue;
if (field.doesAttributing())
continue;
if (!field.getRanking().equals(defaultRanking))
fail(search, field, "Fields which are not creating an index or attribute can not contain rank settings.");
if (!field.getMatching().equals(defaultMatching))
fail(search, field, "Fields which are not creating an index or attribute can not contain match settings.");
}
}
Aggregations