Search in sources :

Example 1 with FieldSet

use of com.yahoo.searchdefinition.document.FieldSet 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 FieldSet

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

the class FieldSetValidity method process.

@Override
public void process(boolean validate) {
    if (!validate)
        return;
    for (FieldSet fieldSet : search.fieldSets().userFieldSets().values()) {
        checkFieldNames(search, fieldSet);
        checkMatching(search, fieldSet);
        checkNormalization(search, fieldSet);
        checkStemming(search, fieldSet);
    }
}
Also used : FieldSet(com.yahoo.searchdefinition.document.FieldSet)

Example 3 with FieldSet

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

the class IndexSchema method getConfig.

@Override
public void getConfig(IndexschemaConfig.Builder icB) {
    for (int i = 0; i < fields.size(); ++i) {
        IndexField f = fields.get(i);
        IndexschemaConfig.Indexfield.Builder ifB = new IndexschemaConfig.Indexfield.Builder().name(f.getName()).datatype(IndexschemaConfig.Indexfield.Datatype.Enum.valueOf(f.getType())).prefix(f.hasPrefix()).phrases(f.hasPhrases()).positions(f.hasPositions());
        if (f.getSdType() != null && !f.getSdType().equals(com.yahoo.searchdefinition.Index.Type.VESPA)) {
            ifB.indextype(IndexschemaConfig.Indexfield.Indextype.Enum.valueOf(f.getSdType().toString()));
        }
        if (!f.getCollectionType().equals("SINGLE")) {
            ifB.collectiontype(IndexschemaConfig.Indexfield.Collectiontype.Enum.valueOf(f.getCollectionType()));
        }
        icB.indexfield(ifB);
    }
    for (FieldSet fieldSet : fieldSets.values()) {
        IndexschemaConfig.Fieldset.Builder fsB = new IndexschemaConfig.Fieldset.Builder().name(fieldSet.getName());
        for (String f : fieldSet.getFieldNames()) {
            fsB.field(new IndexschemaConfig.Fieldset.Field.Builder().name(f));
        }
        icB.fieldset(fsB);
    }
}
Also used : FieldSet(com.yahoo.searchdefinition.document.FieldSet)

Aggregations

FieldSet (com.yahoo.searchdefinition.document.FieldSet)3 Field (com.yahoo.document.Field)1 ImmutableSDField (com.yahoo.searchdefinition.document.ImmutableSDField)1