use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.
the class ImportedFieldsResolver method validateTargetField.
private SDField validateTargetField(TemporaryImportedField importedField, DocumentReference reference, boolean validate) {
String targetFieldName = importedField.targetFieldName();
Search targetSearch = reference.targetSearch();
if (validate && isImportedField(targetSearch, targetFieldName)) {
fail(importedField, targetFieldAsString(targetFieldName, reference) + ": Is an imported field. Not supported");
}
SDField targetField = targetSearch.getConcreteField(targetFieldName);
if (targetField == null) {
fail(importedField, targetFieldAsString(targetFieldName, reference) + ": Not found");
} else if (!targetField.doesAttributing()) {
if (validate)
fail(importedField, targetFieldAsString(targetFieldName, reference) + ": Is not an attribute field. Only attribute fields supported");
} else if (targetField.doesIndexing()) {
if (validate)
fail(importedField, targetFieldAsString(targetFieldName, reference) + ": Is an index field. Not supported");
}
return targetField;
}
use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.
the class LiteralBoost method reduceFieldLiteralBoost.
private void reduceFieldLiteralBoost(SDField field, Search search) {
SDField literalField = addField(search, field, "literal", "{ input " + field.getName() + " | tokenize | index " + field.getName() + "_literal; }", "literal-boost");
literalField.setWeight(field.getWeight() + field.getLiteralBoost());
}
use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.
the class MultifieldIndexHarmonizer method populateIndexToFields.
private void populateIndexToFields(Search search) {
for (SDField field : search.allConcreteFields()) {
if (!field.doesIndexing())
continue;
for (Iterator j = field.getFieldNameAsIterator(); j.hasNext(); ) {
String indexName = (String) j.next();
addIndexField(indexName, field);
}
}
}
use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.
the class SetLanguage method process.
@Override
public void process(boolean validate) {
List<String> textFieldsWithoutLanguage = new ArrayList<>();
for (SDField field : search.allConcreteFields()) {
if (fieldMustComeAfterLanguageSettingField(field)) {
textFieldsWithoutLanguage.add(field.getName());
}
if (field.containsExpression(SetLanguageExpression.class) && !textFieldsWithoutLanguage.isEmpty()) {
StringBuilder fieldString = new StringBuilder();
for (String fieldName : textFieldsWithoutLanguage) {
fieldString.append(fieldName).append(" ");
}
warn(search, field, "Field '" + field.getName() + "' sets the language for this document, " + "and should be defined as the first field in the searchdefinition." + "Preceding text fields that will not have their language set: " + fieldString.toString() + " (This warning is omitted for any subsequent fields that also do set_language.)");
return;
}
}
}
use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.
the class FilterFieldNames method process.
@Override
public void process(boolean validate) {
for (SDField f : search.allConcreteFields()) {
if (f.getRanking().isFilter()) {
filterField(f.getName());
}
}
for (RankProfile profile : rankProfileRegistry.localRankProfiles(search)) {
Set<String> filterFields = new LinkedHashSet<>();
findFilterFields(search, profile, filterFields);
for (Iterator<String> itr = filterFields.iterator(); itr.hasNext(); ) {
String fieldName = itr.next();
profile.filterFields().add(fieldName);
profile.addRankSetting(fieldName, RankProfile.RankSetting.Type.RANKTYPE, RankType.EMPTY);
}
}
}
Aggregations