Search in sources :

Example 21 with KrillCollection

use of de.ids_mannheim.korap.KrillCollection in project Krill by KorAP.

the class TestKrillCollectionJSON method nocollectiontypegiven.

@Test
public void nocollectiontypegiven() {
    String metaQuery = _getJSONString("multiterm_rewrite_collection.jsonld");
    KrillCollection kc = new KrillCollection(metaQuery);
    assertEquals(701, kc.getError(0).getCode());
}
Also used : KrillCollection(de.ids_mannheim.korap.KrillCollection) Test(org.junit.Test)

Example 22 with KrillCollection

use of de.ids_mannheim.korap.KrillCollection in project Krill by KorAP.

the class TestKrillCollectionJSON method collection2.

@Test
public void collection2() {
    String metaQuery = _getJSONString("collection_2.jsonld");
    KrillCollection kc = new KrillCollection(metaQuery);
    assertEquals(kc.toString(), "AndGroup(pubDate:[19900000 TO 99999999] pubDate:[0 TO 20061099])");
}
Also used : KrillCollection(de.ids_mannheim.korap.KrillCollection) Test(org.junit.Test)

Example 23 with KrillCollection

use of de.ids_mannheim.korap.KrillCollection in project Krill by KorAP.

the class TestKrillCollectionJSON method metaQuery2Legacy.

@Test
public void metaQuery2Legacy() {
    String metaQuery = getJsonString(getClass().getResource("/queries/metaquery2.jsonld").getFile());
    KrillCollection kc = new KrillCollection(metaQuery);
    /*
        assertEquals(1, kc.getCount());
        assertEquals(
                "filter with QueryWrapperFilter(+(+author:Hesse +pubDate:[0 TO 20131205]))",
                kc.getFilter(0).toString());
        */
    assertEquals("AndGroup(author:Hesse pubDate:[0 TO 20131205])", kc.toString());
}
Also used : KrillCollection(de.ids_mannheim.korap.KrillCollection) Test(org.junit.Test)

Example 24 with KrillCollection

use of de.ids_mannheim.korap.KrillCollection in project Krill by KorAP.

the class TestKrillCollectionJSON method collection5.

@Test
public void collection5() {
    String metaQuery = _getJSONString("collection_5.jsonld");
    KrillCollection kc = new KrillCollection(metaQuery);
    assertEquals(kc.toString(), "OrGroup(pubDate:[19900000 TO 99999999] title:Mannheim)");
}
Also used : KrillCollection(de.ids_mannheim.korap.KrillCollection) Test(org.junit.Test)

Example 25 with KrillCollection

use of de.ids_mannheim.korap.KrillCollection in project Krill by KorAP.

the class TestKrillCollectionJSON method metaQuery1Legacy.

// Legacy collections reflect old tests, that were adopted to the new scheme
@Test
public void metaQuery1Legacy() {
    String metaQuery = getJsonString(getClass().getResource("/queries/metaquery.jsonld").getFile());
    KrillCollection kc = new KrillCollection(metaQuery);
    /*
        assertEquals("filter with QueryWrapperFilter(+textClass:wissenschaft)",
                kc.getFilter(0).toString());
        assertEquals(
                "filter with QueryWrapperFilter(+(+pubPlace:Erfurt +author:Hesse))",
                kc.getFilter(1).toString());
        assertEquals(
                "extend with QueryWrapperFilter(+(+pubDate:[20110429 TO 20131231] +textClass:freizeit))",
                kc.getFilter(2).toString());
        assertEquals(3, kc.getCount());
        */
    // This will and should fail on optimization
    assertEquals("OrGroup(AndGroup(textClass:wissenschaft AndGroup(pubPlace:Erfurt author:Hesse)) AndGroup(AndGroup(pubDate:[20110429 TO 99999999] pubDate:[0 TO 20131231]) textClass:freizeit))", kc.toString());
}
Also used : KrillCollection(de.ids_mannheim.korap.KrillCollection) Test(org.junit.Test)

Aggregations

KrillCollection (de.ids_mannheim.korap.KrillCollection)37 Test (org.junit.Test)35 KrillIndex (de.ids_mannheim.korap.KrillIndex)24 Krill (de.ids_mannheim.korap.Krill)17 Result (de.ids_mannheim.korap.response.Result)15 CollectionBuilder (de.ids_mannheim.korap.collection.CollectionBuilder)11 SearchContext (de.ids_mannheim.korap.response.SearchContext)5 MMapDirectory (org.apache.lucene.store.MMapDirectory)5 TestSimple.getJsonString (de.ids_mannheim.korap.TestSimple.getJsonString)4 FieldDocument (de.ids_mannheim.korap.index.FieldDocument)4 QueryBuilder (de.ids_mannheim.korap.query.QueryBuilder)3 Term (org.apache.lucene.index.Term)2 SpanQuery (org.apache.lucene.search.spans.SpanQuery)2 SpanTermQuery (org.apache.lucene.search.spans.SpanTermQuery)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 SpanClassQuery (de.ids_mannheim.korap.query.SpanClassQuery)1 SpanDistanceQuery (de.ids_mannheim.korap.query.SpanDistanceQuery)1 SpanElementQuery (de.ids_mannheim.korap.query.SpanElementQuery)1 SpanFocusQuery (de.ids_mannheim.korap.query.SpanFocusQuery)1