Skip to content
Snippets Groups Projects
Commit cefd78ce authored by Piotr Gawron's avatar Piotr Gawron
Browse files

perfect match is properly passed to AbstractDbOverlay implementations

parent c2868370
No related branches found
No related tags found
1 merge request!16Resolve "full reaction returned by API should have info about reactants/products/modifiers"
......@@ -92,8 +92,8 @@ AbstractDbOverlay.prototype.searchByQuery = function(originalQuery, perfect, fit
var encodedQueries = [];
var promises = [];
for (var i = 0; i < queries.length; i++) {
encodedQueries.push(self.encodeQuery(AbstractDbOverlay.QueryType.SEARCH_BY_QUERY, queries[i]));
promises.push(self.searchBySingleQuery(queries[i]));
encodedQueries.push(self.encodeQuery(AbstractDbOverlay.QueryType.SEARCH_BY_QUERY, queries[i], perfect));
promises.push(self.searchBySingleQuery(queries[i], perfect));
}
self.setQueries(encodedQueries);
......@@ -170,7 +170,7 @@ AbstractDbOverlay.prototype.searchByEncodedQuery = function(originalQuery, fitBo
} else if (query.type === AbstractDbOverlay.QueryType.SEARCH_BY_TARGET) {
return this.searchNamesByTarget(query.target);
} else if (query.type === AbstractDbOverlay.QueryType.SEARCH_BY_COORDINATES) {
query.coordinates = new google.maps.Point(query.coordinates.x,query.coordinates.y);
query.coordinates = new google.maps.Point(query.coordinates.x, query.coordinates.y);
return this.searchByCoordinates(query);
} else {
throw new Error("Unknown type of query: " + query.type);
......
......@@ -45,6 +45,19 @@ describe('SearchDbOverlay', function() {
});
});
it("searchByQuery with perfectMatch", function() {
return ServerConnector.getProject().then(function(project) {
var map = helper.createCustomMap(project);
map.getModel().setId(15781);
var searchDb = helper.createSearchDbOverlay(map);
return searchDb.searchByQuery("s1",true);
}).then(function(result) {
assert.equal(result.length, 1);
assert.equal(result[0].length, 1);
});
});
it("searchByEncodedQuery", function() {
return ServerConnector.getProject().then(
function(project) {
......
[{"modelId":15781,"id":329173,"type":"ALIAS"}]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment