aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/prelude/semantics/test/ExactMatchTrickTestCase.java
blob: 6ca055ff980a212e2d873d6e476ae372bc5a3e48 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.semantics.test;

import com.yahoo.search.Query;
import com.yahoo.search.test.QueryTestCase;
import org.junit.jupiter.api.Test;

/**
 * @author bratseth
 */
public class ExactMatchTrickTestCase extends RuleBaseAbstractTestCase {

    public ExactMatchTrickTestCase() {
        super("exactmatchtrick.sr");
    }

    @Test
    void testCompleteMatch() {
        assertSemantics("AND default:primetime default:in default:no default:time", "primetime notime");
    }

    @Test
    void testCompleteMatchWithNegative() { // Notice ordering bug
        assertSemantics("+(AND default:primetime default:in default:time default:no TRUE) -regionexcl:us",
                new Query(QueryTestCase.httpEncode("?query=primetime ANDNOT regionexcl:us&type=adv")));
    }

    @Test
    void testCompleteMatchWithFilterAndNegative() {
        assertSemantics("AND (+(AND default:primetime default:in default:time default:no TRUE) -regionexcl:us) |lang:en",
                new Query(QueryTestCase.httpEncode("?query=primetime ANDNOT regionexcl:us&type=adv&filter=+lang:en")));
    }

}