Search in sources :

Example 11 with Index

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

the class IndexOperation method apply.

public void apply(SDField field) {
    Index index = field.getIndex(indexName);
    if (index == null) {
        index = new Index(indexName);
        field.addIndex(index);
    }
    applyToIndex(index);
}
Also used : Index(com.yahoo.searchdefinition.Index)

Example 12 with Index

use of com.yahoo.searchdefinition.Index 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)

Aggregations

Index (com.yahoo.searchdefinition.Index)12 SDField (com.yahoo.searchdefinition.document.SDField)7 Search (com.yahoo.searchdefinition.Search)2 Attribute (com.yahoo.searchdefinition.document.Attribute)2 BooleanIndexDefinition (com.yahoo.searchdefinition.document.BooleanIndexDefinition)2 SummaryField (com.yahoo.vespa.documentmodel.SummaryField)2 Map (java.util.Map)2 DerivedConfiguration (com.yahoo.searchdefinition.derived.DerivedConfiguration)1 ImmutableSDField (com.yahoo.searchdefinition.document.ImmutableSDField)1 SDDocumentType (com.yahoo.searchdefinition.document.SDDocumentType)1 DocumentSummary (com.yahoo.vespa.documentmodel.DocumentSummary)1 AbstractSearchCluster (com.yahoo.vespa.model.search.AbstractSearchCluster)1 DocumentDatabase (com.yahoo.vespa.model.search.DocumentDatabase)1 IndexedSearchCluster (com.yahoo.vespa.model.search.IndexedSearchCluster)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 Test (org.junit.Test)1