Search in sources :

Example 76 with SDField

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 + "\'");
            }
        }
    }
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField)

Example 77 with SDField

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());
    }
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField) Attribute(com.yahoo.searchdefinition.document.Attribute)

Example 78 with SDField

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;
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField) ArrayList(java.util.ArrayList) VespaConfigChangeAction(com.yahoo.vespa.model.application.validation.change.VespaConfigChangeAction)

Example 79 with SDField

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);
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) DerivedConfiguration(com.yahoo.searchdefinition.derived.DerivedConfiguration) SDField(com.yahoo.searchdefinition.document.SDField) AbstractSearchCluster(com.yahoo.vespa.model.search.AbstractSearchCluster) Search(com.yahoo.searchdefinition.Search) Index(com.yahoo.searchdefinition.Index) DocumentDatabase(com.yahoo.vespa.model.search.DocumentDatabase) Map(java.util.Map)

Example 80 with SDField

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());
    }
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField)

Aggregations

SDField (com.yahoo.searchdefinition.document.SDField)85 Test (org.junit.Test)33 SDDocumentType (com.yahoo.searchdefinition.document.SDDocumentType)22 Search (com.yahoo.searchdefinition.Search)15 Attribute (com.yahoo.searchdefinition.document.Attribute)11 Index (com.yahoo.searchdefinition.Index)7 RankProfileRegistry (com.yahoo.searchdefinition.RankProfileRegistry)7 ArrayList (java.util.ArrayList)7 BaseDeployLogger (com.yahoo.config.model.application.provider.BaseDeployLogger)6 Field (com.yahoo.document.Field)6 SummaryField (com.yahoo.vespa.documentmodel.SummaryField)6 ScriptExpression (com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression)6 QueryProfileRegistry (com.yahoo.search.query.profile.QueryProfileRegistry)5 ImmutableSDField (com.yahoo.searchdefinition.document.ImmutableSDField)5 QueryProfiles (com.yahoo.vespa.model.container.search.QueryProfiles)5 ArrayDataType (com.yahoo.document.ArrayDataType)4 DataType (com.yahoo.document.DataType)4 DocumentReference (com.yahoo.searchdefinition.DocumentReference)4 RankProfile (com.yahoo.searchdefinition.RankProfile)4 TemporarySDField (com.yahoo.searchdefinition.document.TemporarySDField)4