Search in sources :

Example 16 with CollectionBuilder

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

the class TestCollectionBuilder method builderDateBorders.

@Test
public void builderDateBorders() throws IOException {
    CollectionBuilder kc = new CollectionBuilder();
    // CollectionBuilderNew.Interface kbi = ;
    assertNull(kc.date("pubDate", ""));
    assertEquals("pubDate:[20051580 TO 20051580]", kc.date("pubDate", "2005-15-80").toString());
    assertNull(kc.date("pubDate", "2005-15-8"));
    assertNull(kc.date("pubDate", "2005-5-18"));
    assertNull(kc.date("pubDate", "200-05-18"));
}
Also used : CollectionBuilder(de.ids_mannheim.korap.collection.CollectionBuilder) Test(org.junit.Test)

Example 17 with CollectionBuilder

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

the class TestCollectionBuilder method builderAndSimple.

@Test
public void builderAndSimple() throws IOException {
    CollectionBuilder kc = new CollectionBuilder();
    assertEquals("author:tree", kc.andGroup().with(kc.term("author", "tree")).toString());
}
Also used : CollectionBuilder(de.ids_mannheim.korap.collection.CollectionBuilder) Test(org.junit.Test)

Example 18 with CollectionBuilder

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

the class TestCollectionBuilder method builderSince.

@Test
public void builderSince() throws IOException {
    CollectionBuilder kc = new CollectionBuilder();
    assertEquals("pubDate:[20050000 TO 99999999]", kc.since("pubDate", "2005").toString());
    assertEquals("pubDate:[20051000 TO 99999999]", kc.since("pubDate", "2005-10").toString());
    assertEquals("pubDate:[20051012 TO 99999999]", kc.since("pubDate", "2005-10-12").toString());
}
Also used : CollectionBuilder(de.ids_mannheim.korap.collection.CollectionBuilder) Test(org.junit.Test)

Example 19 with CollectionBuilder

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

the class TestCollectionBuilder method LegacyFilterExample.

// The legacy tests were adopted from the legacy collection builder and reformuated
@Test
public void LegacyFilterExample() throws IOException {
    CollectionBuilder kf = new CollectionBuilder();
    /*
        assertEquals("+textClass:tree", kf.and("textClass", "tree").toString());
        */
    assertEquals("textClass:tree", kf.andGroup().with(kf.term("textClass", "tree")).toString());
    /*
        assertEquals("+textClass:tree +textClass:sport",
                kf.and("textClass", "tree").and("textClass", "sport")
                        .toString());
        */
    assertEquals("AndGroup(textClass:tree textClass:sport)", kf.andGroup().with(kf.term("textClass", "tree")).with(kf.term("textClass", "sport")).toString());
    /*
        assertEquals(
                "+textClass:tree +textClass:sport textClass:news",
                kf.and("textClass", "tree").and("textClass", "sport")
                        .or("textClass", "news").toString());
        */
    assertEquals("OrGroup(AndGroup(textClass:tree textClass:sport) textClass:news)", kf.orGroup().with(kf.andGroup().with("textClass", "tree").with("textClass", "sport")).with("textClass", "news").toString());
    /*
        assertEquals("+textClass:tree +textClass:sport +textClass:news", kf
                .and("textClass", "tree", "sport", "news").toString());
        */
    assertEquals("AndGroup(textClass:tree textClass:sport textClass:news)", kf.andGroup().with("textClass", "tree").with("textClass", "sport").with("textClass", "news").toString());
    /*
        assertEquals("corpusID:c-1 corpusID:c-2 corpusID:c-3",
                kf.or("corpusID", "c-1", "c-2", "c-3").toString());
        */
    assertEquals("OrGroup(corpusID:c-1 corpusID:c-2 corpusID:c-3)", kf.orGroup().with("corpusID", "c-1").with("corpusID", "c-2").with("corpusID", "c-3").toString());
}
Also used : CollectionBuilder(de.ids_mannheim.korap.collection.CollectionBuilder) Test(org.junit.Test)

Example 20 with CollectionBuilder

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

the class TestCollectionBuilder method builderAndCombined.

@Test
public void builderAndCombined() throws IOException {
    CollectionBuilder kc = new CollectionBuilder();
    assertEquals("AndGroup(author:tree title:name)", kc.andGroup().with(kc.term("author", "tree")).with(kc.term("title", "name")).toString());
}
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