blob: c398f0ed99ee18b2d672a6dd18b32313f1f6e271 (
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
|
// 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.Test;
/**
* Experiments with a way to match only if it doesn't remove all hard conditions in the query.
* The problem is that a straightforward use case of replacement leads to nonsensical queries as shown.
*
* @author bratseth
*/
public class MatchOnlyIfNotOnlyTermTestCase extends RuleBaseAbstractTestCase {
public MatchOnlyIfNotOnlyTermTestCase() {
super("match-only-if-not-only-term.sr");
}
@Test
public void testMatch() {
assertSemantics("RANK showname:\"saturday night live\"!1000 (AND justin timberlake)", "justin timberlake snl");
assertSemantics("RANK showname:\"saturday night live\"!1000 (AND justin timberlake)", "justin timberlake saturday night live");
}
@Test
public void testNoMatch() {
// TODO: This shows that we do match, i.e that currently the behavior is undesired
assertSemantics("showname:\"saturday night live\"!1000", "snl");
assertSemantics("showname:\"saturday night live\"!1000", "saturday night live");
}
}
|