Search in sources :

Example 1 with SearchField

use of com.yahoo.vespa.documentmodel.SearchField in project vespa by vespa-engine.

the class DocumentModelBuilder method addToModel.

public void addToModel(Search search) {
    // Then we add the search specific stuff
    SearchDef searchDef = new SearchDef(search.getName());
    addSearchFields(search.extraFieldList(), searchDef);
    for (Field f : search.getDocument().fieldSet()) {
        addSearchField((SDField) f, searchDef);
    }
    for (SDField field : search.allConcreteFields()) {
        for (Attribute attribute : field.getAttributes().values()) {
            if (!searchDef.getFields().containsKey(attribute.getName())) {
                searchDef.add(new SearchField(new Field(attribute.getName(), field), !field.getIndices().isEmpty(), true));
            }
        }
    }
    for (Field f : search.getDocument().fieldSet()) {
        addAlias((SDField) f, searchDef);
    }
    model.getSearchManager().add(searchDef);
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField) SearchField(com.yahoo.vespa.documentmodel.SearchField) Field(com.yahoo.document.Field) SearchDef(com.yahoo.vespa.documentmodel.SearchDef) SearchField(com.yahoo.vespa.documentmodel.SearchField) SDField(com.yahoo.searchdefinition.document.SDField) Attribute(com.yahoo.searchdefinition.document.Attribute)

Example 2 with SearchField

use of com.yahoo.vespa.documentmodel.SearchField in project vespa by vespa-engine.

the class DocumentModelBuilder method addSearchField.

private static void addSearchField(SDField field, SearchDef searchDef) {
    SearchField searchField = new SearchField(field, field.getIndices().containsKey(field.getName()) && field.getIndices().get(field.getName()).getType().equals(Index.Type.VESPA), field.getAttributes().containsKey(field.getName()));
    searchDef.add(searchField);
    // Add field to views
    addToView(field.getIndices().keySet(), searchField, searchDef);
}
Also used : SearchField(com.yahoo.vespa.documentmodel.SearchField)

Aggregations

SearchField (com.yahoo.vespa.documentmodel.SearchField)2 Field (com.yahoo.document.Field)1 Attribute (com.yahoo.searchdefinition.document.Attribute)1 SDField (com.yahoo.searchdefinition.document.SDField)1 SearchDef (com.yahoo.vespa.documentmodel.SearchDef)1