Search in sources :

Example 1 with ImmutableSDField

use of com.yahoo.searchdefinition.document.ImmutableSDField 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);
    }
}
Also used : Field(com.yahoo.document.Field) ImmutableSDField(com.yahoo.searchdefinition.document.ImmutableSDField) FieldSet(com.yahoo.searchdefinition.document.FieldSet)

Example 2 with ImmutableSDField

use of com.yahoo.searchdefinition.document.ImmutableSDField in project vespa by vespa-engine.

the class FieldSetValidity method checkNormalization.

private void checkNormalization(Search search, FieldSet fieldSet) {
    NormalizeLevel.Level fsNorm = null;
    for (String fld : fieldSet.getFieldNames()) {
        ImmutableSDField field = search.getField(fld);
        NormalizeLevel.Level fieldNorm = field.getNormalizing().getLevel();
        if (fsNorm == null) {
            fsNorm = fieldNorm;
        } else {
            if (!fsNorm.equals(fieldNorm)) {
                warn(search, field.asField(), "The normalization settings for the fields in " + fieldSet + " are inconsistent " + "(explicitly or because of field type). This may lead to recall and ranking issues.");
                return;
            }
        }
    }
}
Also used : NormalizeLevel(com.yahoo.searchdefinition.document.NormalizeLevel) ImmutableSDField(com.yahoo.searchdefinition.document.ImmutableSDField)

Example 3 with ImmutableSDField

use of com.yahoo.searchdefinition.document.ImmutableSDField in project vespa by vespa-engine.

the class FieldSetValidity method checkStemming.

private void checkStemming(Search search, FieldSet fieldSet) {
    Stemming fsStemming = null;
    for (String fld : fieldSet.getFieldNames()) {
        ImmutableSDField field = search.getField(fld);
        Stemming fieldStemming = field.getStemming();
        if (fsStemming == null) {
            fsStemming = fieldStemming;
        } else {
            if (!fsStemming.equals(fieldStemming)) {
                warn(search, field.asField(), "The stemming settings for the fields in the fieldset '" + fieldSet.getName() + "' are inconsistent (explicitly or because of field type). " + "This may lead to recall and ranking issues.");
                return;
            }
        }
    }
}
Also used : ImmutableSDField(com.yahoo.searchdefinition.document.ImmutableSDField) Stemming(com.yahoo.searchdefinition.document.Stemming)

Example 4 with ImmutableSDField

use of com.yahoo.searchdefinition.document.ImmutableSDField in project vespa by vespa-engine.

the class AddExtraFieldsToDocument method addSummaryField.

private void addSummaryField(Search search, SDDocumentType document, SummaryField field, boolean validate) {
    Field docField = document.getField(field.getName());
    if (docField == null) {
        ImmutableSDField existingField = search.getField(field.getName());
        if (existingField == null) {
            SDField newField = new SDField(document, field.getName(), field.getDataType(), field.isHeader(), true);
            newField.setIsExtraField(true);
            document.addField(newField);
        } else if (!existingField.isImportedField()) {
            document.addField(existingField.asField());
        }
    } else if (!docField.getDataType().equals(field.getDataType())) {
        if (validate)
            throw newProcessException(search, field, "Summary field has conflicting type.");
    }
}
Also used : SummaryField(com.yahoo.vespa.documentmodel.SummaryField) SDField(com.yahoo.searchdefinition.document.SDField) Field(com.yahoo.document.Field) ImmutableSDField(com.yahoo.searchdefinition.document.ImmutableSDField) SDField(com.yahoo.searchdefinition.document.SDField) ImmutableSDField(com.yahoo.searchdefinition.document.ImmutableSDField) ImmutableSDField(com.yahoo.searchdefinition.document.ImmutableSDField)

Example 5 with ImmutableSDField

use of com.yahoo.searchdefinition.document.ImmutableSDField in project vespa by vespa-engine.

the class FieldSetValidity method checkMatching.

private void checkMatching(Search search, FieldSet fieldSet) {
    Matching fsMatching = null;
    for (String fld : fieldSet.getFieldNames()) {
        ImmutableSDField field = search.getField(fld);
        Matching fieldMatching = field.getMatching();
        if (fsMatching == null) {
            fsMatching = fieldMatching;
        } else {
            if (!fsMatching.equals(fieldMatching)) {
                warn(search, field.asField(), "The matching settings for the fields in " + fieldSet + " are inconsistent " + "(explicitly or because of field type). This may lead to recall and ranking issues.");
                return;
            }
        }
    }
}
Also used : Matching(com.yahoo.searchdefinition.document.Matching) ImmutableSDField(com.yahoo.searchdefinition.document.ImmutableSDField)

Aggregations

ImmutableSDField (com.yahoo.searchdefinition.document.ImmutableSDField)5 Field (com.yahoo.document.Field)2 FieldSet (com.yahoo.searchdefinition.document.FieldSet)1 Matching (com.yahoo.searchdefinition.document.Matching)1 NormalizeLevel (com.yahoo.searchdefinition.document.NormalizeLevel)1 SDField (com.yahoo.searchdefinition.document.SDField)1 Stemming (com.yahoo.searchdefinition.document.Stemming)1 SummaryField (com.yahoo.vespa.documentmodel.SummaryField)1