Skip to content

Commit

Permalink
Added delete documents to embedded api
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignacio Perez Gonzalez committed Jan 27, 2012
1 parent 6f2c8a0 commit 6ee9464
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions embedded-api/com/flaptor/indextank/api/EmbeddedApiV1.java
Expand Up @@ -17,6 +17,7 @@
package com.flaptor.indextank.api; package com.flaptor.indextank.api;


import com.flaptor.indextank.api.resources.Autocomplete; 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.Docs;
import com.flaptor.indextank.api.resources.Search; import com.flaptor.indextank.api.resources.Search;
import com.ghosthack.turismo.action.Action; import com.ghosthack.turismo.action.Action;
Expand All @@ -32,6 +33,8 @@ protected void map() {


put("/indexes/:name/docs", new Docs()); put("/indexes/:name/docs", new Docs());


delete("/indexes/:name/docs", new DeleteDocs());

get("/indexes", new Action() { get("/indexes", new Action() {
public void run() { public void run() {
// dummy response for embedded server // dummy response for embedded server
Expand Down
8 changes: 7 additions & 1 deletion embedded-api/com/flaptor/indextank/api/IndexEngineApi.java
Expand Up @@ -138,7 +138,13 @@ public void putDocument(String id, JSONObject fields, JSONObject variables, JSON
indexer.updateCategories(id, prepareProperties(categories)); indexer.updateCategories(id, prepareProperties(categories));
System.out.println(engine.getIndexer().getStats()); 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) { private Map<String, String> prepareProperties(JSONObject jo) {
Map<String, String> properties = Maps.newHashMap(); Map<String, String> properties = Maps.newHashMap();
if(jo == null) { if(jo == null) {
Expand Down

0 comments on commit 6ee9464

Please sign in to comment.