Permalink
Browse files

Added delete documents to embedded api

  • Loading branch information...
1 parent 6f2c8a0 commit 6ee94641fddf7b1d661fd98dd89fbdfbee8d76b1 Ignacio Perez Gonzalez committed Jan 27, 2012
@@ -17,6 +17,7 @@
package com.flaptor.indextank.api;
import com.flaptor.indextank.api.resources.Autocomplete;
+import com.flaptor.indextank.api.resources.DeleteDocs;
import com.flaptor.indextank.api.resources.Docs;
import com.flaptor.indextank.api.resources.Search;
import com.ghosthack.turismo.action.Action;
@@ -32,6 +33,8 @@ protected void map() {
put("/indexes/:name/docs", new Docs());
+ delete("/indexes/:name/docs", new DeleteDocs());
+
get("/indexes", new Action() {
public void run() {
// dummy response for embedded server
@@ -138,7 +138,13 @@ public void putDocument(String id, JSONObject fields, JSONObject variables, JSON
indexer.updateCategories(id, prepareProperties(categories));
System.out.println(engine.getIndexer().getStats());
}
-
+
+ public void deleteDocument(String id) {
+ BoostingIndexer indexer = engine.getIndexer();
+ indexer.del(id);
+ System.out.println(engine.getIndexer().getStats());
+ }
+
private Map<String, String> prepareProperties(JSONObject jo) {
Map<String, String> properties = Maps.newHashMap();
if(jo == null) {

0 comments on commit 6ee9464

Please sign in to comment.