Search in sources :

Example 1 with AutocompleteSearchResult

use of org.nextprot.api.solr.AutocompleteSearchResult in project nextprot-api by calipho-sib.

the class SearchController method convert.

private static AutocompleteSearchResult convert(SearchResult searchResult) {
    AutocompleteSearchResult autocompleteResult = new AutocompleteSearchResult();
    autocompleteResult.setElapsedTime(searchResult.getElapsedTime());
    autocompleteResult.setEntity(searchResult.getEntity());
    autocompleteResult.setIndex(searchResult.getIndex());
    Map<String, List<Map<String, Object>>> facets = searchResult.getFacets();
    for (List<Map<String, Object>> value : facets.values()) {
        for (Map<String, Object> map : value) {
            autocompleteResult.addResult((String) map.get("name"), ((Long) map.get("count")).intValue());
        }
    }
    return autocompleteResult;
}
Also used : AutocompleteSearchResult(org.nextprot.api.solr.AutocompleteSearchResult) UserProteinList(org.nextprot.api.user.domain.UserProteinList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 AutocompleteSearchResult (org.nextprot.api.solr.AutocompleteSearchResult)1 UserProteinList (org.nextprot.api.user.domain.UserProteinList)1