Search in sources :

Example 31 with Match

use of de.ids_mannheim.korap.response.Match in project Krill by KorAP.

the class TestMatchIdentifier method indexExample7Dependencies.

@Test
public void indexExample7Dependencies() throws IOException, QueryException {
    KrillIndex ki = new KrillIndex();
    ki.addDoc(createSimpleFieldDoc2());
    ki.commit();
    Match km = ki.getMatchInfo("match-c1!d1-p0-4", "tokens", null, null, true, true);
    assertEquals("SnippetHTML (2)", "<span class=\"context-left\">" + "</span>" + "<span class=\"match\">" + "<mark><span title=\"f/m:eins\">" + "<span title=\"f/y:one\">" + "<span title=\"it/is:1\">" + "<span title=\"x/o:erstens\">" + "<span xlink:title=\"x/rel:a\" xlink:show=\"none\" xlink:href=\"#token-c1!d1-p3\">a</span>" + "</span>" + "</span>" + "</span>" + "</span>" + "<span title=\"f/m:zwei\">" + "<span title=\"f/y:two\">" + "<span title=\"it/is:2\">" + "<span title=\"x/o:zweitens\">" + "<span xlink:title=\"x/rel:b\" xlink:show=\"none\" xlink:href=\"#token-c1!d1-p3\">b</span>" + "</span>" + "</span>" + "</span>" + "</span>" + "<span title=\"f/m:drei\">" + "<span title=\"f/y:three\">" + "<span title=\"it/is:3\">" + "<span title=\"x/o:drittens\">c</span>" + "</span>" + "</span>" + "</span>" + "<span xml:id=\"token-c1!d1-p3\">" + "<span title=\"f/m:vier\"><span title=\"f/y:four\">" + "<span title=\"it/is:4\">" + "<span title=\"x/o:viertens\">a</span>" + "</span>" + "</span>" + "</span>" + "</span>" + "</mark>" + "</span>" + "<span class=\"context-right\">" + "<span class=\"more\"></span>" + "</span>", km.getSnippetHTML());
}
Also used : KrillIndex(de.ids_mannheim.korap.KrillIndex) Match(de.ids_mannheim.korap.response.Match) Test(org.junit.Test)

Example 32 with Match

use of de.ids_mannheim.korap.response.Match in project Krill by KorAP.

the class TestMatchIdentifier method indexExampleNullInfo.

@Test
public void indexExampleNullInfo() throws IOException, QueryException {
    KrillIndex ki = new KrillIndex();
    ki.addDoc(createSimpleFieldDoc4());
    ki.commit();
    Match km = ki.getMatchInfo("match-c1!d4-p3-9", "tokens", null, null, false, false);
    JsonNode res = mapper.readTree(km.toJsonString());
    assertEquals("tokens", res.at("/field").asText());
    assertTrue(res.at("/startMore").asBoolean());
    assertTrue(res.at("/endMore").asBoolean());
    assertEquals("c1", res.at("/corpusID").asText());
    assertEquals("d4", res.at("/docID").asText());
    assertEquals("<span class=\"context-left\"><span class=\"more\"></span></span><span class=\"match\"><mark><span title=\"f/m:vier\"><span title=\"f/y:four\"><span title=\"it/is:4\"><span title=\"x/o:viertens\">a</span></span></span></span><span title=\"f/m:fuenf\"><span title=\"f/y:five\"><span title=\"it/is:5\"><span title=\"x/o:fünftens\">b</span></span></span></span><span title=\"f/m:sechs\"><span title=\"f/y:six\"><span title=\"it/is:6\"><span title=\"x/o:sechstens\">c</span></span></span></span><span title=\"f/m:sieben\"><span title=\"f/y:seven\"><span title=\"it/is:7\"><span title=\"x/o:siebtens\">a</span></span></span></span><span title=\"f/m:acht\"><span title=\"f/y:eight\"><span title=\"it/is:8\"><span title=\"x/o:achtens\">b</span></span></span></span><span title=\"f/m:neun\"><span title=\"f/y:nine\"><span title=\"it/is:9\"><span title=\"x/o:neuntens\">a</span></span></span></span></mark></span><span class=\"context-right\"><span class=\"more\"></span></span>", res.at("/snippet").asText());
    assertEquals("match-c1!d4-p3-9", res.at("/matchID").asText());
    assertTrue(res.at("/pubDate").isMissingNode());
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) KrillIndex(de.ids_mannheim.korap.KrillIndex) Match(de.ids_mannheim.korap.response.Match) Test(org.junit.Test)

Example 33 with Match

use of de.ids_mannheim.korap.response.Match in project Krill by KorAP.

the class TestMatchIdentifier method indexNewStructure.

@Test
public void indexNewStructure() throws IOException, QueryException {
    KrillIndex ki = new KrillIndex();
    ki.addDoc(getClass().getResourceAsStream("/goe/AGX-00002.json"), false);
    ki.commit();
    Match km = ki.getMatchInfo("match-GOE!GOE_AGX.00002-p210-211", "tokens", true, (String) null, (String) null, true, true, true);
    JsonNode res = mapper.readTree(km.toJsonString());
    assertEquals("tokens", res.at("/field").asText());
    assertEquals("GOE_AGX.00002", res.at("/textSigle").asText());
    assertEquals("Goethe, Johann Wolfgang von", res.at("/author").asText());
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) KrillIndex(de.ids_mannheim.korap.KrillIndex) Match(de.ids_mannheim.korap.response.Match) Test(org.junit.Test)

Example 34 with Match

use of de.ids_mannheim.korap.response.Match in project Krill by KorAP.

the class TestMatchIdentifier method indexExample5Spans.

@Test
public void indexExample5Spans() throws IOException, QueryException {
    KrillIndex ki = new KrillIndex();
    ki.addDoc(createSimpleFieldDoc());
    ki.commit();
    Match km = ki.getMatchInfo("match-c1!d1-p7-9(4)8-8(2)7-8", "tokens", null, null, true, false);
    assertEquals("SnippetBrackets (1)", "... [[{f/m:acht:{f/y:eight:{it/is:8:{x/o:achtens:b}}}}{f/m:neun:{f/y:nine:{it/is:9:{x/o:neuntens:a}}}}]] ...", km.getSnippetBrackets());
}
Also used : KrillIndex(de.ids_mannheim.korap.KrillIndex) Match(de.ids_mannheim.korap.response.Match) Test(org.junit.Test)

Example 35 with Match

use of de.ids_mannheim.korap.response.Match in project Krill by KorAP.

the class TestMatchIdentifier method indexExample7Spans.

@Test
public void indexExample7Spans() throws IOException, QueryException {
    KrillIndex ki = new KrillIndex();
    ki.addDoc(createSimpleFieldDoc());
    ki.commit();
    Match km = ki.getMatchInfo("match-c1!d1-p7-10(4)8-8(2)7-8", "tokens", null, null, true, true);
    assertEquals("SnippetBrackets (1)", "... [[{x/tag:{2:{f/m:acht:{f/y:eight:{it/is:8:{x/o:achtens:b}}}}{4:{f/m:neun:{f/y:nine:{it/is:9:{x/o:neuntens:a}}}}}}{f/m:zehn:{f/y:ten:{it/is:10:{x/o:zehntens:c}}}}}]]", km.getSnippetBrackets());
    assertEquals("SnippetHTML (1)", "<span class=\"context-left\">" + "<span class=\"more\">" + "</span>" + "</span>" + "<span class=\"match\">" + "<mark>" + "<span title=\"x/tag\">" + "<mark class=\"class-2 level-0\">" + "<span title=\"f/m:acht\">" + "<span title=\"f/y:eight\">" + "<span title=\"it/is:8\">" + "<span title=\"x/o:achtens\">" + "b" + "</span>" + "</span>" + "</span>" + "</span>" + "<mark class=\"class-4 level-1\">" + "<span title=\"f/m:neun\">" + "<span title=\"f/y:nine\">" + "<span title=\"it/is:9\">" + "<span title=\"x/o:neuntens\">" + "a" + "</span>" + "</span>" + "</span>" + "</span>" + "</mark>" + "</mark>" + "<span title=\"f/m:zehn\">" + "<span title=\"f/y:ten\">" + "<span title=\"it/is:10\">" + "<span title=\"x/o:zehntens\">" + "c" + "</span>" + "</span>" + "</span>" + "</span>" + "</span>" + "</mark>" + "</span>" + "<span class=\"context-right\">" + "</span>", km.getSnippetHTML());
}
Also used : KrillIndex(de.ids_mannheim.korap.KrillIndex) Match(de.ids_mannheim.korap.response.Match) Test(org.junit.Test)

Aggregations

Match (de.ids_mannheim.korap.response.Match)37 Test (org.junit.Test)34 KrillIndex (de.ids_mannheim.korap.KrillIndex)30 Result (de.ids_mannheim.korap.response.Result)9 JsonNode (com.fasterxml.jackson.databind.JsonNode)8 QueryBuilder (de.ids_mannheim.korap.query.QueryBuilder)8 FieldDocument (de.ids_mannheim.korap.index.FieldDocument)7 Krill (de.ids_mannheim.korap.Krill)5 SpanQuery (org.apache.lucene.search.spans.SpanQuery)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 SpanClassQuery (de.ids_mannheim.korap.query.SpanClassQuery)1 SpanFocusQuery (de.ids_mannheim.korap.query.SpanFocusQuery)1 SpanNextQuery (de.ids_mannheim.korap.query.SpanNextQuery)1 SearchContext (de.ids_mannheim.korap.response.SearchContext)1 ArrayList (java.util.ArrayList)1 Term (org.apache.lucene.index.Term)1 SpanTermQuery (org.apache.lucene.search.spans.SpanTermQuery)1 Ignore (org.junit.Ignore)1