Add logging output (1.4.2 & 1.4.3)
This commit is contained in:
parent
135c7dfd28
commit
cb11a87a71
@ -37,6 +37,9 @@ public class DocumentQuery implements IDocumentQuery {
|
||||
|
||||
List<Long> result = new ArrayList<>();
|
||||
|
||||
System.out.printf("Searching for locations within %sm of longitude %s and latitude %s%n",
|
||||
radius, longitude, latitude);
|
||||
|
||||
MongoCursor<Document> cursor = collection.find(
|
||||
Filters.and(
|
||||
Filters.regex(M_LOCATION_NAME, ".*" + name + ".*"),
|
||||
@ -45,12 +48,20 @@ public class DocumentQuery implements IDocumentQuery {
|
||||
).projection(Projections.include(I_LOCATION)).iterator();
|
||||
|
||||
try {
|
||||
while (cursor.hasNext())
|
||||
result.add(cursor.next().getLong(I_LOCATION));
|
||||
while (cursor.hasNext()) {
|
||||
Document next = cursor.next();
|
||||
System.out.printf("Adding location with id %s to results%n", next.getLong("location_id"));
|
||||
result.add(next.getLong(I_LOCATION));
|
||||
}
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
if (result.isEmpty())
|
||||
System.out.println("No locations with the given criteria found!");
|
||||
else
|
||||
System.out.println("Final result list: " + result.toString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -77,12 +88,20 @@ public class DocumentQuery implements IDocumentQuery {
|
||||
|
||||
try {
|
||||
while (cursor.hasNext()) {
|
||||
result.add(cursor.next());
|
||||
Document next = cursor.next();
|
||||
System.out.printf("Adding category %s with value %s to results%n",
|
||||
next.getString("_id"), next.getDouble("value"));
|
||||
result.add(next);
|
||||
}
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
if (result.isEmpty())
|
||||
System.out.println("No categories found for type == 'place'!");
|
||||
else
|
||||
System.out.println("Final result list: " + result.toString());
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user