summaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/searchdefinition/IndexSettingsTestCase.java
blob: f992d5ee0baec8c929fac30bce6758eae4e008f8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchdefinition;

import com.yahoo.searchdefinition.document.SDField;
import com.yahoo.searchdefinition.document.Stemming;
import com.yahoo.searchdefinition.parser.ParseException;
import org.junit.Test;

import java.io.IOException;

import static org.junit.Assert.assertEquals;

/**
 * Rank settings
 *
 * @author bratseth
 */
public class IndexSettingsTestCase extends SchemaTestCase {

    @Test
    public void testStemmingSettings() throws IOException, ParseException {
        Search search = SearchBuilder.buildFromFile("src/test/examples/indexsettings.sd");

        SDField usingDefault=(SDField) search.getDocument().getField("usingdefault");
        assertEquals(Stemming.SHORTEST,usingDefault.getStemming(search));

        SDField notStemmed=(SDField) search.getDocument().getField("notstemmed");
        assertEquals(Stemming.NONE,notStemmed.getStemming(search));

        SDField allStemmed=(SDField) search.getDocument().getField("allstemmed");
        assertEquals(Stemming.SHORTEST,allStemmed.getStemming(search));

        SDField multiStemmed=(SDField) search.getDocument().getField("multiplestems");
        assertEquals(Stemming.MULTIPLE, multiStemmed.getStemming(search));
    }

}