use of fr.neamar.kiss.pojo.SearchPojo in project KISS by Neamar.
the class SearchProvider method getResults.
public ArrayList<Pojo> getResults(String query) {
ArrayList<Pojo> pojos = new ArrayList<>();
Set<String> selectedProviders = new TreeSet<>();
selectedProviders.addAll(PreferenceManager.getDefaultSharedPreferences(this).getStringSet("search-providers", new HashSet<>(Arrays.asList("Google"))));
for (String searchProvider : selectedProviders) {
SearchPojo pojo = new SearchPojo();
pojo.query = query;
pojo.relevance = 10;
pojo.url = searchProviderUrls.get(searchProvider);
pojo.name = searchProvider;
pojos.add(pojo);
}
Matcher m = p.matcher(query);
if (m.find()) {
String guessedUrl = URLUtil.guessUrl(query);
if (URLUtil.isValidUrl(guessedUrl)) {
SearchPojo pojo = new SearchPojo();
pojo.query = "";
pojo.relevance = 50;
pojo.name = guessedUrl;
pojo.url = guessedUrl;
pojo.direct = true;
pojos.add(pojo);
}
}
return pojos;
}