Removed deprecated search method in KrillIndex

Change-Id: I465a54c04402994ad0c0f2aa9720ba38666418ab
diff --git a/Changes b/Changes
index 7a20529..a0ed76c 100644
--- a/Changes
+++ b/Changes
@@ -3,6 +3,8 @@
 	- [cleanup] Renamed fromJson() to fromKoral() (diewald)
 	- [cleanup] Removed deprecated methods in Krill:
 	  setSpanQuery(), getRequest() (diewald)
+	- [cleanup] Removed deprecated method in KrillIndex:
+	  search() (diewald)
 
 0.55.5 2016-05-02
 	- [performance] Changed to a dynamic window for sorting in FocusSpans (margaretha)
diff --git a/src/main/java/de/ids_mannheim/korap/KrillIndex.java b/src/main/java/de/ids_mannheim/korap/KrillIndex.java
index e4535c0..c603f6d 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillIndex.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillIndex.java
@@ -1174,19 +1174,6 @@
     };
 
 
-    @Deprecated
-    public Result search (KrillCollection collection, SpanQuery query,
-            int startIndex, short count, boolean leftTokenContext,
-            short leftContext, boolean rightTokenContext, short rightContext) {
-        Krill ks = new Krill(query);
-        ks.getMeta().setContext(
-                new SearchContext(leftTokenContext, leftContext,
-                        rightTokenContext, rightContext));
-        ks.setCollection(collection);
-        return this.search(ks);
-    };
-
-
     /**
      * Search the endpoint.
      */
diff --git a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionIndex.java b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionIndex.java
index 2449452..b5dadd7 100644
--- a/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/collection/TestKrillCollectionIndex.java
@@ -8,6 +8,9 @@
 import de.ids_mannheim.korap.index.FieldDocument;
 import de.ids_mannheim.korap.index.TextAnalyzer;
 import de.ids_mannheim.korap.response.Result;
+import de.ids_mannheim.korap.response.SearchContext;
+
+import de.ids_mannheim.korap.Krill;
 import de.ids_mannheim.korap.KrillQuery;
 import de.ids_mannheim.korap.query.QueryBuilder;
 
@@ -402,11 +405,20 @@
         assertEquals("Paragraphs", 48, kc.numberOf("paragraphs"));
 
         // Create a query
-        QueryBuilder kq = new QueryBuilder("tokens");
-        SpanQuery query = kq.seg("opennlp/p:NN").with("tt/p:NN").toQuery();
+        Krill ks = new Krill(new QueryBuilder("tokens").seg("opennlp/p:NN").with("tt/p:NN"));
+        ks.setCollection(kc)
+            .getMeta()
+            .setStartIndex(0)
+            .setCount((short) 20)
+            .setContext(new SearchContext(true, (short) 5, true, (short) 5))
+            ;
 
+        Result kr = ks.apply(ki);
+
+        /*
         Result kr = ki.search(kc, query, 0, (short) 20, true, (short) 5, true,
                 (short) 5);
+        */
         assertEquals(kr.getTotalResults(), 70);
 
 
@@ -419,7 +431,6 @@
         assertEquals("Tokens", 1669, kc.numberOf("tokens"));
         assertEquals("Sentences", 188, kc.numberOf("sentences"));
         assertEquals("Paragraphs", 130, kc.numberOf("paragraphs"));
-        // System.err.println(kr.toJSON());
     };
 
 
@@ -486,11 +497,19 @@
         assertEquals("Paragraphs", 48, kc.numberOf("paragraphs"));
 
         // Create a query
-        QueryBuilder kq = new QueryBuilder("tokens");
-        SpanQuery query = kq.seg("opennlp/p:NN").with("tt/p:NN").toQuery();
+        Krill ks = new Krill(new QueryBuilder("tokens").seg("opennlp/p:NN").with("tt/p:NN"));
+        ks.setCollection(kc)
+            .getMeta()
+            .setStartIndex(0)
+            .setCount((short) 20)
+            .setContext(new SearchContext(true, (short) 5, true, (short) 5))
+            ;
 
+        Result kr = ks.apply(ki);
+        /*
         Result kr = ki.search(kc, query, 0, (short) 20, true, (short) 5, true,
                 (short) 5);
+        */
         assertEquals(kr.getTotalResults(), 70);
 
         // kc.extend(kf.and("textClass", "uninteresting"));
@@ -571,12 +590,15 @@
 
 
         // Create a query
-        QueryBuilder kq = new QueryBuilder("tokens");
-        SpanQuery query = kq.seg("opennlp/p:NN").with("tt/p:NN").toQuery();
+        Krill ks = new Krill(new QueryBuilder("tokens").seg("opennlp/p:NN").with("tt/p:NN"));
+        ks.setCollection(kc)
+            .getMeta()
+            .setStartIndex(0)
+            .setCount((short) 20)
+            .setContext(new SearchContext(true, (short) 5, true, (short) 5));
 
+        Result kr = ks.apply(ki);
 
-        Result kr = ki.search(kc, query, 0, (short) 20, true, (short) 5, true,
-                (short) 5);
         assertEquals(kr.getTotalResults(), 369);
 
         // kc.filter(kf.and("corpusID", "QQQ"));
@@ -587,8 +609,14 @@
         assertEquals("Sentences", 0, kc.numberOf("sentences"));
         assertEquals("Paragraphs", 0, kc.numberOf("paragraphs"));
 
+        ks.setCollection(kc);
+
+        // Create a query        
+        kr = ks.apply(ki);
+        /*
         kr = ki.search(kc, query, 0, (short) 20, true, (short) 5, true,
                 (short) 5);
+        */
         assertEquals(kr.getTotalResults(), 0);
     };
 
@@ -627,7 +655,17 @@
         assertEquals("Sentences", 103, kc.numberOf("sentences"));
         assertEquals("Tokens", 1229, kc.numberOf("tokens"));
 
-        kr = ki.search(kc, sq, 0, (short) 20, true, (short) 5, true, (short) 5);
+        
+        Krill ks = new Krill(sq);
+        ks.setCollection(kc)
+            .getMeta()
+            .setStartIndex(0)
+            .setCount((short) 20)
+            .setContext(new SearchContext(true, (short) 5, true, (short) 5))
+            ;
+        kr = ks.apply(ki);
+
+        // kr = ki.search(kc, sq, 0, (short) 20, true, (short) 5, true, (short) 5);
 
         assertEquals((long) 39, kr.getTotalResults());
     };
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java
index 488f3e1..5aacbb5 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMatchIndex.java
@@ -15,6 +15,7 @@
 import org.junit.runners.JUnit4;
 
 import de.ids_mannheim.korap.KrillCollection;
+import de.ids_mannheim.korap.Krill;
 import de.ids_mannheim.korap.KrillIndex;
 import de.ids_mannheim.korap.query.QueryBuilder;
 import de.ids_mannheim.korap.query.SpanClassQuery;
@@ -24,6 +25,7 @@
 import de.ids_mannheim.korap.query.SpanWithinQuery;
 import de.ids_mannheim.korap.response.Match;
 import de.ids_mannheim.korap.response.Result;
+import de.ids_mannheim.korap.response.SearchContext;
 
 // mvn -Dtest=TestWithinIndex#indexExample1 test
 
@@ -488,14 +490,21 @@
                         new SpanClassQuery(new SpanTermQuery(new Term("base",
                                 "s:a")), (byte) 3)), (byte) 3));
 
-        fail("Skipping may go horribly wrong! (Known issue)");
+        // fail("Skipping may go horribly wrong! (Known issue)");
 
-        kr = ki.search(kc, sq, 0, (short) 20, true, (short) 5, true, (short) 5);
-        //        System.err.println(kr.getOverview());
+        Krill ks = new Krill(sq);
+        ks.getMeta()
+            .setStartIndex(0)
+            .setCount((short) 20)
+            .setContext(new SearchContext(true, (short) 5, true, (short) 5))
+            // .setCollection(kc)
+            ;
 
+        kr = ks.apply(ki);
+        // kr = ki.search(kc, sq, 0, (short) 20, true, (short) 5, true, (short) 5);
 
         assertEquals(
-                kr.getSerialQuery(),
+                     kr.getSerialQuery(),
                 "spanContain(<base:p />, focus(3: spanContain({2: <base:s />}, {3: base:s:a})))");
         assertEquals(12, kr.getTotalResults());
         assertEquals("[a{2:bc{3:a}b}cabac]", kr.getMatch(0)