Remove unnecessary sort
This commit is contained in:
parent
d107cc6e25
commit
dee6476797
2 changed files with 10 additions and 12 deletions
|
@ -291,8 +291,14 @@ public class SearchUICore {
|
|||
return null;
|
||||
}
|
||||
|
||||
public <T extends SearchCoreAPI> SearchResultCollection shallowSearch(Class<T> cl,
|
||||
String text, final ResultMatcher<SearchResult> matcher) throws IOException {
|
||||
public <T extends SearchCoreAPI> SearchResultCollection shallowSearch(Class<T> cl, String text,
|
||||
ResultMatcher<SearchResult> matcher) throws IOException {
|
||||
return shallowSearch(cl, text, matcher, true, true);
|
||||
}
|
||||
|
||||
public <T extends SearchCoreAPI> SearchResultCollection shallowSearch(Class<T> cl, String text,
|
||||
final ResultMatcher<SearchResult> matcher,
|
||||
boolean resortAll, boolean removeDuplicates) throws IOException {
|
||||
T api = getApiByClass(cl);
|
||||
if (api != null) {
|
||||
if (debugMode) {
|
||||
|
@ -306,7 +312,7 @@ public class SearchUICore {
|
|||
|
||||
SearchResultCollection collection = new SearchResultCollection(
|
||||
sphrase);
|
||||
collection.addSearchResults(rm.getRequestResults(), true, true);
|
||||
collection.addSearchResults(rm.getRequestResults(), resortAll, removeDuplicates);
|
||||
if (debugMode) {
|
||||
LOG.info("Finish shallow search <" + sphrase + "> Results=" + rm.getRequestResults().size());
|
||||
}
|
||||
|
|
|
@ -109,8 +109,6 @@ import net.osmand.util.MapUtils;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import static net.osmand.plus.poi.PoiFiltersHelper.PoiTemplateList;
|
||||
|
@ -1509,18 +1507,12 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
private void reloadHistoryInternal() {
|
||||
if (historySearchFragment != null) {
|
||||
try {
|
||||
SearchResultCollection res = searchUICore.shallowSearch(SearchHistoryAPI.class, "", null);
|
||||
SearchResultCollection res = searchUICore.shallowSearch(SearchHistoryAPI.class, "", null, false, false);
|
||||
List<QuickSearchListItem> rows = new ArrayList<>();
|
||||
if (res != null) {
|
||||
for (SearchResult sr : res.getCurrentSearchResults()) {
|
||||
rows.add(new QuickSearchListItem(app, sr));
|
||||
}
|
||||
Collections.sort(rows, new Comparator<QuickSearchListItem>() {
|
||||
@Override
|
||||
public int compare(QuickSearchListItem o1, QuickSearchListItem o2) {
|
||||
return Double.compare(o1.getSearchResult().priority, o2.getSearchResult().priority);
|
||||
}
|
||||
});
|
||||
}
|
||||
historySearchFragment.updateListAdapter(rows, false);
|
||||
} catch (Exception e) {
|
||||
|
|
Loading…
Reference in a new issue