com.google.appengine.api.search.Document

Here are the examples of the java api class com.google.appengine.api.search.Document taken from open source projects.

1. PlacesHelper#buildDocument()

Project: solutions-mobile-shopping-assistant-backend-java
File: PlacesHelper.java
static Document buildDocument(String placeId, String placeName, String placeAddress, GeoPt location) {
    GeoPoint geoPoint = new GeoPoint(location.getLatitude(), location.getLongitude());
    Document.Builder builder = Document.newBuilder().addField(Field.newBuilder().setName("id").setText(placeId)).addField(Field.newBuilder().setName("name").setText(placeName)).addField(Field.newBuilder().setName("address").setText(placeAddress)).addField(Field.newBuilder().setName("place_location").setGeoPoint(geoPoint));
    // field to use for retrieving documents
    if (environment.value() == Development) {
        builder.addField(Field.newBuilder().setName("value").setNumber(1));
    }
    Document place = builder.build();
    return place;
}

2. MaintenanceTasksServlet#removeAllDocumentsFromIndex()

Project: solutions-mobile-shopping-assistant-backend-java
File: MaintenanceTasksServlet.java
private void removeAllDocumentsFromIndex() {
    Index index = PlacesHelper.getIndex();
    GetRequest request = GetRequest.newBuilder().setReturningIdsOnly(true).build();
    GetResponse<Document> response = index.getRange(request);
    for (Document document : response.getResults()) {
        index.delete(document.getId());
    }
}