lundi 9 mars 2015

GAE: Spatial search performance issues with Search API


Vote count:

0




I am using the spatial search features of the GAE Search API to search for the nearest pois within a distance of around 50km (no points outside).


My query looks like following:



String distanceQuery = "distance(poi_location, geopoint(" + lat + ", " + lon + "))";

SortOptions sortOptions = SortOptions.newBuilder()
.addSortExpression(SortExpression.newBuilder()
.setExpression(distanceQuery)
.setDirection(SortExpression.SortDirection.ASCENDING)
.setDefaultValueNumeric(distanceInMeter + 1))
.setLimit(1000)
.build();

QueryOptions options = QueryOptions.newBuilder()
.setOffset(offset)
.setLimit(limit)
.setReturningIdsOnly(true)
.setSortOptions(sortOptions)
.build();

String queryString = distanceQuery + " < " + distanceInMeter;

Query query = Query.newBuilder().setOptions(options).build(queryString);
IndexSpec indexSpec = IndexSpec.newBuilder().setName(INDEX_POST).build();
Index index = SearchServiceFactory.getSearchService().getIndex(indexSpec);
return index.search(query);


It works, however the performance is quite bad. There are only around 30 "documents" stored and a query on them costs around 2400ms. Is this the expected performance? Is there anything I can improve?



asked 16 secs ago







GAE: Spatial search performance issues with Search API

Aucun commentaire:

Enregistrer un commentaire