blob: 370ca20e6124c406008ca8c1c6769415afcb9d56 (
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
38
39
40
|
// 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 org.junit.jupiter.api.Test;
/**
* @author bratseth
*/
public class OrPhraseTestCase extends RuleBaseAbstractTestCase {
public OrPhraseTestCase() {
super("orphrase.sr");
}
@Test
void testReplacing1() {
assertSemantics("OR title:\"software engineer\" (AND new york)", "software engineer new york");
assertSemantics("title:\"software engineer\"", "software engineer"); // Skip OR when there is nothing else
}
@Test
void testReplacing2() {
assertSemantics("OR \"lord of the rings\" lotr", "lotr");
}
@Test
void testReplacing2WithFollowingQuery() {
assertSemantics("AND (OR \"lord of the rings\" lotr) is a movie", "lotr is a movie");
}
@Test
void testReplacing2WithPrecedingQuery() {
assertSemantics("AND a movie is (OR \"lord of the rings\" lotr)", "a movie is lotr");
}
@Test
void testReplacing2WithSurroundingQuery() {
assertSemantics("AND a movie is (OR \"lord of the rings\" lotr) yes", "a movie is lotr yes");
}
}
|