Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
raonifn committed Jul 23, 2015
1 parent 161dd73 commit 3333395
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/main/java/br/com/aasp/poc/gae/RecorteServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.google.appengine.api.datastore.EntityNotFoundException;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;
import com.google.appengine.api.datastore.Text;
import com.google.appengine.api.search.Document;
import com.google.appengine.api.search.Field;
import com.google.appengine.api.search.Index;
Expand Down Expand Up @@ -65,7 +66,7 @@ protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws Se
String id = UUID.randomUUID().toString();

Entity entity = new Entity("Recorte", id);
entity.setProperty("texto", texto);
entity.setProperty("texto", new Text(texto));

AsyncDatastoreService asyncDS = DatastoreServiceFactory.getAsyncDatastoreService();
asyncDS.put(entity);
Expand Down Expand Up @@ -96,7 +97,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se
try {
Entity entity = datastoreService.get(key);
resp.setContentType("application/json");
resp.getWriter().printf("{\"texto\": \"%s\"}", entity.getProperty("texto"));
resp.getWriter().printf("{\"texto\": \"%s\"}", ((Text) entity.getProperty("texto")).getValue());
} catch (EntityNotFoundException e) {
resp.setStatus(404);
resp.setContentType("application/json");
Expand Down
3 changes: 2 additions & 1 deletion src/main/webapp/js/recorte.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
$('#searchResult ul').html('');
for (var i = 0; i < data.length; i++) {
$('#searchResult ul').append(
"<li>" + data[i].texto + "</li>")
"<li>(" + data[i].score + ") - " + data[i].texto
+ "</li>")
}
}
});
Expand Down

0 comments on commit 3333395

Please sign in to comment.