use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.
the class IndexCommandResolver method checkCommand.
private void checkCommand(String command) {
for (SDField field : fields) {
if (!field.hasQueryCommand(command)) {
if (harmonizedCommands.contains(command)) {
deployLogger.log(Level.WARNING, command + " must be added to all fields going to the same index (" + indexName + ")" + ", adding to field " + field.getName());
field.addQueryCommand(command);
} else {
deployLogger.log(Level.WARNING, "All fields going to the same index should have the same query-commands. Field \'" + field.getName() + "\' doesn't contain command \'" + command + "\'");
}
}
}
}
use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.
the class RankProfileTypeSettingsProcessor method processImportedField.
private void processImportedField(ImportedField field) {
SDField targetField = field.targetField();
Attribute attribute = targetField.getAttributes().get(targetField.getName());
if (attribute != null && attribute.tensorType().isPresent()) {
addAttributeTypeToRankProfiles(field.fieldName(), attribute.tensorType().get().toString());
}
}
use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.
the class IndexingScriptChangeValidator method validate.
public List<VespaConfigChangeAction> validate(ValidationOverrides overrides, Instant now) {
List<VespaConfigChangeAction> result = new ArrayList<>();
for (SDField nextField : nextSearch.allConcreteFields()) {
String fieldName = nextField.getName();
SDField currentField = currentSearch.getConcreteField(fieldName);
if (currentField != null) {
validateScripts(currentField, nextField, overrides, now).ifPresent(r -> result.add(r));
}
}
return result;
}
use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.
the class NoPrefixForIndexes method validate.
@Override
public void validate(VespaModel model, DeployState deployState) {
for (AbstractSearchCluster cluster : model.getSearchClusters()) {
if (cluster instanceof IndexedSearchCluster) {
IndexedSearchCluster sc = (IndexedSearchCluster) cluster;
for (DocumentDatabase docDb : sc.getDocumentDbs()) {
DerivedConfiguration sdConfig = docDb.getDerivedConfiguration();
Search search = sdConfig.getSearch();
for (SDField field : search.allConcreteFields()) {
if (field.doesIndexing()) {
// if (!field.getIndexTo().isEmpty() && !field.getIndexTo().contains(field.getName())) continue;
if (field.getMatching().getAlgorithm().equals(Matching.Algorithm.PREFIX)) {
failField(search, field);
}
for (Map.Entry<String, Index> e : field.getIndices().entrySet()) {
if (e.getValue().isPrefix()) {
failField(search, field);
}
}
}
}
}
}
}
}
use of com.yahoo.searchdefinition.document.SDField in project vespa by vespa-engine.
the class UriHack method processField.
private void processField(Search search, SDField uriField) {
String uriName = uriField.getName();
uriField.setStemming(Stemming.NONE);
DataType generatedType = DataType.STRING;
if (uriField.getDataType() instanceof ArrayDataType) {
generatedType = new ArrayDataType(DataType.STRING);
} else if (uriField.getDataType() instanceof WeightedSetDataType) {
WeightedSetDataType wdt = (WeightedSetDataType) uriField.getDataType();
generatedType = new WeightedSetDataType(DataType.STRING, wdt.createIfNonExistent(), wdt.removeIfZero());
}
for (String suffix : URL_SUFFIX) {
String partName = uriName + "." + suffix;
// I wonder if this is explicit in qrs or implicit in backend?
// search.addFieldSetItem(uriName, partName);
SDField partField = new SDField(partName, generatedType, true);
partField.setIndexStructureField(uriField.doesIndexing());
partField.setRankType(uriField.getRankType());
partField.setStemming(Stemming.NONE);
partField.getNormalizing().inferLowercase();
if (uriField.getIndex(suffix) != null) {
partField.addIndex(uriField.getIndex(suffix));
}
search.addExtraField(partField);
search.fieldSets().addBuiltInFieldSetItem(BuiltInFieldSets.INTERNAL_FIELDSET_NAME, partField.getName());
}
}
Aggregations