| Eliza Margaretha | 8e200cd | 2014-11-13 16:00:38 +0000 | [diff] [blame] | 1 | package de.ids_mannheim.korap.query; |
| 2 | |
| Nils Diewald | d732e54 | 2014-11-12 17:54:02 +0000 | [diff] [blame] | 3 | import java.util.*; |
| 4 | import java.io.IOException; |
| 5 | |
| 6 | import org.apache.lucene.search.spans.SpanQuery; |
| 7 | |
| Nils Diewald | a14ecd6 | 2015-02-26 21:00:20 +0000 | [diff] [blame] | 8 | import de.ids_mannheim.korap.KrillIndex; |
| Nils Diewald | 0339d46 | 2015-02-26 14:53:56 +0000 | [diff] [blame] | 9 | import de.ids_mannheim.korap.KrillQuery; |
| Nils Diewald | 884dbcf | 2015-02-27 17:02:28 +0000 | [diff] [blame] | 10 | import de.ids_mannheim.korap.response.Result; |
| Nils Diewald | bbd39a5 | 2015-02-23 19:56:57 +0000 | [diff] [blame] | 11 | import de.ids_mannheim.korap.Krill; |
| Nils Diewald | 392bcf3 | 2015-02-26 20:01:17 +0000 | [diff] [blame] | 12 | import de.ids_mannheim.korap.response.Match; |
| Nils Diewald | d732e54 | 2014-11-12 17:54:02 +0000 | [diff] [blame] | 13 | import de.ids_mannheim.korap.index.FieldDocument; |
| 14 | |
| 15 | import de.ids_mannheim.korap.util.QueryException; |
| 16 | |
| 17 | import static de.ids_mannheim.korap.TestSimple.*; |
| Nils Diewald | d732e54 | 2014-11-12 17:54:02 +0000 | [diff] [blame] | 18 | |
| 19 | import static org.junit.Assert.*; |
| 20 | import org.junit.Test; |
| 21 | import org.junit.Ignore; |
| 22 | import org.junit.runner.RunWith; |
| 23 | import org.junit.runners.JUnit4; |
| 24 | |
| 25 | @RunWith(JUnit4.class) |
| 26 | public class TestTemporaryQueryLimitations { |
| 27 | |
| 28 | @Test |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 29 | public void classRefCheckNotSupported () throws IOException, QueryException { |
| Nils Diewald | d732e54 | 2014-11-12 17:54:02 +0000 | [diff] [blame] | 30 | |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 31 | // Construct index |
| 32 | KrillIndex ki = new KrillIndex(); |
| 33 | String json = new String("{" + " \"fields\" : [" + " { " |
| 34 | + " \"primaryData\" : \"abc\"" + " }," + " {" |
| 35 | + " \"name\" : \"tokens\"," + " \"data\" : [" |
| 36 | + " [ \"s:a\", \"i:a\", \"_0#0-1\", \"-:t$<i>3\"]," |
| 37 | + " [ \"s:b\", \"i:b\", \"_1#1-2\" ]," |
| 38 | + " [ \"s:c\", \"i:c\", \"_2#2-3\" ]" + " ]" |
| 39 | + " }" + " ]" + "}"); |
| Nils Diewald | d732e54 | 2014-11-12 17:54:02 +0000 | [diff] [blame] | 40 | |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 41 | FieldDocument fd = ki.addDoc(json); |
| 42 | ki.commit(); |
| Nils Diewald | d732e54 | 2014-11-12 17:54:02 +0000 | [diff] [blame] | 43 | |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 44 | json = getString(getClass().getResource( |
| 45 | "/queries/bugs/cosmas_classrefcheck.jsonld").getFile()); |
| Nils Diewald | d732e54 | 2014-11-12 17:54:02 +0000 | [diff] [blame] | 46 | |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 47 | Krill ks = new Krill(json); |
| 48 | Result kr = ks.apply(ki); |
| 49 | assertEquals(kr.getSerialQuery(), |
| 50 | "focus(130: {131: spanContain({129: <tokens:s />}, {130: tokens:s:wegen})})"); |
| 51 | assertEquals(kr.getTotalResults(), 0); |
| 52 | assertEquals(kr.getStartIndex(), 0); |
| 53 | |
| 54 | assertEquals("This is a warning coming from the serialization", kr |
| 55 | .getWarning(1).getMessage()); |
| 56 | assertEquals("Class reference checks are currently not supported" |
| 57 | + " - results may not be correct", kr.getWarning(0) |
| 58 | .getMessage()); |
| Nils Diewald | d732e54 | 2014-11-12 17:54:02 +0000 | [diff] [blame] | 59 | }; |
| 60 | }; |