Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
eb4a2a176c
3 changed files with 14 additions and 2 deletions
|
@ -16,6 +16,7 @@ import net.osmand.ResultMatcher;
|
||||||
import net.osmand.binary.BinaryMapIndexReader;
|
import net.osmand.binary.BinaryMapIndexReader;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.osm.MapPoiTypes;
|
import net.osmand.osm.MapPoiTypes;
|
||||||
|
import net.osmand.search.core.ObjectType;
|
||||||
import net.osmand.search.core.SearchCoreAPI;
|
import net.osmand.search.core.SearchCoreAPI;
|
||||||
import net.osmand.search.core.SearchCoreFactory;
|
import net.osmand.search.core.SearchCoreFactory;
|
||||||
import net.osmand.search.core.SearchPhrase;
|
import net.osmand.search.core.SearchPhrase;
|
||||||
|
@ -202,6 +203,7 @@ public class SearchUICore {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
api.search(phrase, matcher);
|
api.search(phrase, matcher);
|
||||||
|
matcher.apiSearchFinished(api, phrase);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
LOG.error(e.getMessage(), e);
|
LOG.error(e.getMessage(), e);
|
||||||
|
@ -213,7 +215,7 @@ public class SearchUICore {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void sortSearchResults(SearchPhrase sp, List<SearchResult> searchResults) {
|
public void sortSearchResults(SearchPhrase sp, List<SearchResult> searchResults) {
|
||||||
// sort SearchResult by 1. searchDistance 2. Name
|
// sort SearchResult by 1. searchDistance 2. Name
|
||||||
final LatLon loc = sp.getLastTokenLocation();
|
final LatLon loc = sp.getLastTokenLocation();
|
||||||
final net.osmand.Collator clt = OsmAndCollator.primaryCollator();
|
final net.osmand.Collator clt = OsmAndCollator.primaryCollator();
|
||||||
|
@ -258,6 +260,15 @@ public class SearchUICore {
|
||||||
return requestResults;
|
return requestResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void apiSearchFinished(SearchCoreAPI api, SearchPhrase phrase) {
|
||||||
|
if(matcher != null) {
|
||||||
|
SearchResult sr = new SearchResult(phrase);
|
||||||
|
sr.objectType = ObjectType.SEARCH_API_FINISHED;
|
||||||
|
sr.object = api;
|
||||||
|
matcher.publish(sr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean publish(SearchResult object) {
|
public boolean publish(SearchResult object) {
|
||||||
if(matcher == null || matcher.publish(object)) {
|
if(matcher == null || matcher.publish(object)) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.search.core;
|
||||||
public enum ObjectType {
|
public enum ObjectType {
|
||||||
CITY(true), VILLAGE(true), POSTCODE(true), STREET(true), HOUSE(true),
|
CITY(true), VILLAGE(true), POSTCODE(true), STREET(true), HOUSE(true),
|
||||||
STREET_INTERSECTION(true), POI_TYPE(false), POI(true), LOCATION(true), PARTIAL_LOCATION(false), FAVORITE(true),
|
STREET_INTERSECTION(true), POI_TYPE(false), POI(true), LOCATION(true), PARTIAL_LOCATION(false), FAVORITE(true),
|
||||||
|
SEARCH_API_FINISHED(false),
|
||||||
REGION(true), RECENT_OBJ(true), WPT(true), UNKNOWN_NAME_FILTER(false);
|
REGION(true), RECENT_OBJ(true), WPT(true), UNKNOWN_NAME_FILTER(false);
|
||||||
private boolean hasLocation;
|
private boolean hasLocation;
|
||||||
private ObjectType(boolean location) {
|
private ObjectType(boolean location) {
|
||||||
|
|
|
@ -812,7 +812,7 @@ public class SearchCoreFactory {
|
||||||
sp.objectType = ObjectType.LOCATION;
|
sp.objectType = ObjectType.LOCATION;
|
||||||
sp.wordsSpan = 2;
|
sp.wordsSpan = 2;
|
||||||
resultMatcher.publish(sp);
|
resultMatcher.publish(sp);
|
||||||
} else {
|
} else if (phrase.isNoSelectedType()) {
|
||||||
SearchResult sp = new SearchResult(phrase);
|
SearchResult sp = new SearchResult(phrase);
|
||||||
sp.priority = 0;
|
sp.priority = 0;
|
||||||
sp.object = sp.location = new LatLon(dd, 0);
|
sp.object = sp.location = new LatLon(dd, 0);
|
||||||
|
|
Loading…
Reference in a new issue