Add extra type for search to display results faster
This commit is contained in:
parent
4123776efd
commit
1f75f8f10e
3 changed files with 17 additions and 1 deletions
|
@ -269,6 +269,16 @@ public class SearchUICore {
|
|||
}
|
||||
}
|
||||
|
||||
public void apiSearchRegionFinished(SearchCoreAPI api, BinaryMapIndexReader region, SearchPhrase phrase) {
|
||||
if(matcher != null) {
|
||||
SearchResult sr = new SearchResult(phrase);
|
||||
sr.objectType = ObjectType.SEARCH_API_REGION_FINISHED;
|
||||
sr.object = api;
|
||||
sr.file = region;
|
||||
matcher.publish(sr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean publish(SearchResult object) {
|
||||
if(matcher == null || matcher.publish(object)) {
|
||||
|
|
|
@ -9,8 +9,10 @@ public enum ObjectType {
|
|||
LOCATION(true), PARTIAL_LOCATION(false),
|
||||
// UI OBJECTS
|
||||
FAVORITE(true), WPT(true), RECENT_OBJ(true),
|
||||
|
||||
REGION(true),
|
||||
SEARCH_API_FINISHED(false), UNKNOWN_NAME_FILTER(false);
|
||||
SEARCH_API_FINISHED(false), SEARCH_API_REGION_FINISHED(false),
|
||||
UNKNOWN_NAME_FILTER(false);
|
||||
private boolean hasLocation;
|
||||
private ObjectType(boolean location) {
|
||||
this.hasLocation = location;
|
||||
|
|
|
@ -160,6 +160,7 @@ public class SearchCoreFactory {
|
|||
// phrase.isLastWord(ObjectType.CITY, ObjectType.VILLAGE, ObjectType.POSTCODE) || phrase.isLastWord(ObjectType.REGION)
|
||||
if (phrase.isNoSelectedType() || phrase.getRadiusLevel() >= 2) {
|
||||
initAndSearchCities(phrase, resultMatcher);
|
||||
resultMatcher.apiSearchFinished(this, phrase);
|
||||
searchByName(phrase, resultMatcher);
|
||||
}
|
||||
return true;
|
||||
|
@ -320,6 +321,7 @@ public class SearchCoreFactory {
|
|||
req.setBBoxRadius(loc.getLatitude(), loc.getLongitude(), phrase.getRadiusSearch(DEFAULT_ADDRESS_BBOX_RADIUS * 10));
|
||||
}
|
||||
r.searchAddressDataByName(req);
|
||||
resultMatcher.apiSearchRegionFinished(this, r, phrase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -376,6 +378,7 @@ public class SearchCoreFactory {
|
|||
BinaryMapIndexReader r = offlineIterator.next();
|
||||
currentFile[0] = r;
|
||||
r.searchPoiByName(req);
|
||||
resultMatcher.apiSearchRegionFinished(this, r, phrase);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -572,6 +575,7 @@ public class SearchCoreFactory {
|
|||
for (BinaryMapIndexReader o : oo) {
|
||||
selected[0] = o;
|
||||
o.searchPoi(req);
|
||||
resultMatcher.apiSearchRegionFinished(this, o, phrase);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue