Search in sources :

Example 11 with CollectionBuilder

use of de.ids_mannheim.korap.collection.CollectionBuilder in project Krill by KorAP.

the class TestCollectionBuilder method LegacyRangeFailure.

@Test
public void LegacyRangeFailure() throws IOException {
    CollectionBuilder kf = new CollectionBuilder();
    /*
        assertEquals("", kf.between("aaaa-bb-cc", "aaaabbcc").toString());
        assertEquals("", kf.till("aaaa-bb-cc").toString());
        assertEquals("", kf.since("aaaa-bb-cc").toString());
        assertEquals("", kf.date("aaaa-bb-cc").toString());
         */
    assertNull(kf.between("pubDate", "aaaa-bb-cc", "aaaabbcc"));
    assertNull(kf.till("pubDate", "aaaa-bb-cc"));
    assertNull(kf.since("pubDate", "aaaa-bb-cc"));
    assertNull(kf.date("pubDate", "aaaa-bb-cc"));
}
Also used : CollectionBuilder(de.ids_mannheim.korap.collection.CollectionBuilder) Test(org.junit.Test)

Example 12 with CollectionBuilder

use of de.ids_mannheim.korap.collection.CollectionBuilder in project Krill by KorAP.

the class TestCollectionBuilder method LegacyRangeLimited.

@Test
public void LegacyRangeLimited() throws IOException {
    CollectionBuilder kf = new CollectionBuilder();
    /*
        assertEquals("+pubDate:[20050000 TO 20099999]",
                kf.between("2005", "2009").toString());
        */
    assertEquals("AndGroup(pubDate:[20050000 TO 99999999] pubDate:[0 TO 20099999])", kf.between("pubDate", "2005", "2009").toString());
    /*
        assertEquals("+pubDate:[20051000 TO 20090899]",
                kf.between("200510", "200908").toString());
        */
    assertEquals("AndGroup(pubDate:[20051000 TO 99999999] pubDate:[0 TO 20090899])", kf.between("pubDate", "200510", "200908").toString());
    /*
        assertEquals("+pubDate:[20051000 TO 20090899]",
                kf.between("2005-10", "2009-08").toString());
        */
    assertEquals("AndGroup(pubDate:[20051000 TO 99999999] pubDate:[0 TO 20090899])", kf.between("pubDate", "2005-10", "2009-08").toString());
    /*
        assertEquals("+pubDate:[20051006 TO 20090803]",
                kf.between("2005-1006", "2009-0803").toString());
         */
    assertEquals("AndGroup(pubDate:[20051006 TO 99999999] pubDate:[0 TO 20090803])", kf.between("pubDate", "2005-1006", "2009-0803").toString());
    /*
        assertEquals("+pubDate:[20051006 TO 20090803]",
                kf.between("2005-10-06", "2009-08-03").toString());
        */
    assertEquals("AndGroup(pubDate:[20051006 TO 99999999] pubDate:[0 TO 20090803])", kf.between("pubDate", "2005-10-06", "2009-08-03").toString());
    /*
        assertEquals("+pubDate:[0 TO 20059999]", kf.till("2005").toString());
        */
    assertEquals("pubDate:[0 TO 20059999]", kf.till("pubDate", "2005").toString());
    /*
        assertEquals("+pubDate:[0 TO 20051099]", kf.till("200510").toString());
        */
    assertEquals("pubDate:[0 TO 20051099]", kf.till("pubDate", "200510").toString());
    /*
        assertEquals("+pubDate:[0 TO 20051099]", kf.till("200510").toString());
        */
    assertEquals("pubDate:[0 TO 20051099]", kf.till("pubDate", "200510").toString());
    /*
        assertEquals("+pubDate:[0 TO 20051099]", kf.till("2005-10").toString());
        */
    assertEquals("pubDate:[0 TO 20051099]", kf.till("pubDate", "2005-10").toString());
    /*
        assertEquals("+pubDate:[0 TO 20051006]", kf.till("2005-1006")
                .toString());
         */
    assertEquals("pubDate:[0 TO 20051006]", kf.till("pubDate", "2005-1006").toString());
    /*
        assertEquals("+pubDate:[0 TO 20051006]", kf.till("2005-10-06")
                .toString());
        */
    assertEquals("pubDate:[0 TO 20051006]", kf.till("pubDate", "2005-10-06").toString());
    /*
        assertEquals("+pubDate:[20050000 TO 99999999]", kf.since("2005")
                .toString());
        */
    assertEquals("pubDate:[20050000 TO 99999999]", kf.since("pubDate", "2005").toString());
    /*
        assertEquals("+pubDate:[20051000 TO 99999999]", kf.since("200510")
                .toString());
        */
    assertEquals("pubDate:[20051000 TO 99999999]", kf.since("pubDate", "200510").toString());
    /*
        assertEquals("+pubDate:[20051000 TO 99999999]", kf.since("2005-10")
                .toString());
        */
    assertEquals("pubDate:[20051000 TO 99999999]", kf.since("pubDate", "2005-10").toString());
    /*
        assertEquals("+pubDate:[20051006 TO 99999999]", kf.since("2005-1006")
                .toString());
        */
    assertEquals("pubDate:[20051006 TO 99999999]", kf.since("pubDate", "2005-1006").toString());
    /*
        assertEquals("+pubDate:[20051006 TO 99999999]", kf.since("2005-10-06")
                .toString());
        */
    assertEquals("pubDate:[20051006 TO 99999999]", kf.since("pubDate", "2005-10-06").toString());
    /*
        assertEquals("+pubDate:[20050000 TO 20059999]", kf.date("2005")
                .toString());
        */
    assertEquals("pubDate:[20050000 TO 20059999]", kf.date("pubDate", "2005").toString());
    /*
        assertEquals("+pubDate:[20051000 TO 20051099]", kf.date("200510")
                .toString());
        */
    assertEquals("pubDate:[20051000 TO 20051099]", kf.date("pubDate", "200510").toString());
    /*
        assertEquals("+pubDate:[20051000 TO 20051099]", kf.date("2005-10")
                .toString());
        */
    assertEquals("pubDate:[20051000 TO 20051099]", kf.date("pubDate", "2005-10").toString());
    /*
        assertEquals("+pubDate:20051006", kf.date("2005-1006").toString());
        */
    assertEquals("pubDate:[20051006 TO 20051006]", kf.date("pubDate", "2005-1006").toString());
    /*
        assertEquals("+pubDate:20051006", kf.date("2005-10-06").toString());
        */
    assertEquals("pubDate:[20051006 TO 20051006]", kf.date("pubDate", "2005-10-06").toString());
}
Also used : CollectionBuilder(de.ids_mannheim.korap.collection.CollectionBuilder) Test(org.junit.Test)

Example 13 with CollectionBuilder

use of de.ids_mannheim.korap.collection.CollectionBuilder in project Krill by KorAP.

the class TestCollectionBuilder method builderDateDay.

@Test
public void builderDateDay() throws IOException {
    CollectionBuilder kc = new CollectionBuilder();
    assertEquals("pubDate:[20051011 TO 20051011]", kc.date("pubDate", "2005-10-11").toString());
}
Also used : CollectionBuilder(de.ids_mannheim.korap.collection.CollectionBuilder) Test(org.junit.Test)

Example 14 with CollectionBuilder

use of de.ids_mannheim.korap.collection.CollectionBuilder in project Krill by KorAP.

the class TestCollectionBuilder method LegacyRangeExample.

@Test
public void LegacyRangeExample() throws IOException {
    CollectionBuilder kf = new CollectionBuilder();
    /*
        assertEquals("+pubDate:[20030604 TO 20030899]",
                kf.between("2003-06-04", "2003-08-99").toString());
        */
    // This will be optimized and probably crash
    assertEquals("AndGroup(pubDate:[20030604 TO 99999999] pubDate:[0 TO 20030899])", kf.andGroup().with(kf.since("pubDate", "2003-06-04")).with(kf.till("pubDate", "2003-08-99")).toString());
    /*
        assertEquals("+pubDate:[0 TO 20030604]", kf.till("2003-06-04")
                .toString());
        */
    assertEquals("pubDate:[0 TO 20030604]", kf.till("pubDate", "2003-06-04").toString());
    /*
        assertEquals("+pubDate:[20030604 TO 99999999]", kf.since("2003-06-04")
                .toString());
        */
    assertEquals("pubDate:[20030604 TO 99999999]", kf.since("pubDate", "2003-06-04").toString());
    /*
        assertEquals("+pubDate:20030604", kf.date("2003-06-04").toString());
        */
    assertEquals("pubDate:[20030604 TO 20030604]", kf.date("pubDate", "2003-06-04").toString());
}
Also used : CollectionBuilder(de.ids_mannheim.korap.collection.CollectionBuilder) Test(org.junit.Test)

Example 15 with CollectionBuilder

use of de.ids_mannheim.korap.collection.CollectionBuilder in project Krill by KorAP.

the class TestCollectionBuilder method builderNegationRoot.

@Test
public void builderNegationRoot() throws IOException {
    CollectionBuilder kc = new CollectionBuilder();
    CollectionBuilder.Interface kbi = kc.orGroup().with(kc.term("author", "tree1")).with(kc.term("title", "name1"));
    assertEquals("OrGroup(author:tree1 title:name1)", kbi.toString());
    assertFalse(kbi.isNegative());
    kbi = kc.andGroup().with(kc.orGroup().with(kc.term("author", "tree1")).with(kc.term("title", "name1"))).not();
    assertEquals("OrGroup(author:tree1 title:name1)", kbi.toString());
    assertTrue(kbi.isNegative());
}
Also used : CollectionBuilder(de.ids_mannheim.korap.collection.CollectionBuilder) Test(org.junit.Test)

Aggregations

CollectionBuilder (de.ids_mannheim.korap.collection.CollectionBuilder)33 Test (org.junit.Test)33 KrillCollection (de.ids_mannheim.korap.KrillCollection)11 KrillIndex (de.ids_mannheim.korap.KrillIndex)11 Krill (de.ids_mannheim.korap.Krill)5 Result (de.ids_mannheim.korap.response.Result)4 QueryBuilder (de.ids_mannheim.korap.query.QueryBuilder)3 TestSimple.getJsonString (de.ids_mannheim.korap.TestSimple.getJsonString)2 FieldDocument (de.ids_mannheim.korap.index.FieldDocument)2 SearchContext (de.ids_mannheim.korap.response.SearchContext)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 KrillMeta (de.ids_mannheim.korap.KrillMeta)1 SpanDistanceQuery (de.ids_mannheim.korap.query.SpanDistanceQuery)1