Search in sources :

Example 1 with Matching

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

the class ValidateFieldWithIndexSettingsCreatesIndex method process.

@Override
public void process(boolean validate) {
    if (!validate)
        return;
    Matching defaultMatching = new Matching();
    Ranking defaultRanking = new Ranking();
    for (SDField field : search.allConcreteFields()) {
        if (field.doesIndexing())
            continue;
        if (field.doesAttributing())
            continue;
        if (!field.getRanking().equals(defaultRanking))
            fail(search, field, "Fields which are not creating an index or attribute can not contain rank settings.");
        if (!field.getMatching().equals(defaultMatching))
            fail(search, field, "Fields which are not creating an index or attribute can not contain match settings.");
    }
}
Also used : Matching(com.yahoo.searchdefinition.document.Matching) Ranking(com.yahoo.searchdefinition.document.Ranking) SDField(com.yahoo.searchdefinition.document.SDField)

Example 2 with Matching

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

the class TagType method implementTagType.

private void implementTagType(SDField field) {
    field.setDataType(DataType.getWeightedSet(DataType.STRING, true, true));
    // Don't set matching and ranking if this field is not attribute nor index
    if (!field.doesIndexing() && !field.doesAttributing())
        return;
    Matching m = field.getMatching();
    if (!m.isTypeUserSet())
        m.setType(Matching.Type.WORD);
    if (field.getRankType() == null || field.getRankType() == RankType.DEFAULT)
        field.setRankType((RankType.TAGS));
}
Also used : Matching(com.yahoo.searchdefinition.document.Matching)

Example 3 with Matching

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

the class IndexingScriptChangeMessageBuilder method checkMatching.

private void checkMatching(ChangeMessageBuilder builder) {
    Matching currentMatching = currentField.getMatching();
    Matching nextMatching = nextField.getMatching();
    if (!currentMatching.equals(nextMatching)) {
        builder.addChange("matching", toString(currentMatching), toString(nextMatching));
    }
}
Also used : Matching(com.yahoo.searchdefinition.document.Matching)

Example 4 with Matching

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

Matching (com.yahoo.searchdefinition.document.Matching)4 ImmutableSDField (com.yahoo.searchdefinition.document.ImmutableSDField)1 Ranking (com.yahoo.searchdefinition.document.Ranking)1 SDField (com.yahoo.searchdefinition.document.SDField)1