use of ubic.gemma.core.search.SearchResultDisplayObject in project Gemma by PavlidisLab.
the class ExpressionExperimentSearchServiceImpl method searchExperimentsAndExperimentGroupBlankQuery.
/**
* if query is blank, return list of public sets, user-owned sets (if logged in) and user's recent session-bound
* sets called by ubic.gemma.web.controller .expression.experiment.ExpressionExperimentController.
* searchExperimentsAndExperimentGroup(String, Long) does not include session bound sets
*/
private List<SearchResultDisplayObject> searchExperimentsAndExperimentGroupBlankQuery(Long taxonId) {
boolean taxonLimited = taxonId != null;
List<SearchResultDisplayObject> displayResults = new LinkedList<>();
// These are widely considered to be the most important results and
// therefore need to be at the top
List<SearchResultDisplayObject> masterResults = new LinkedList<>();
Collection<ExpressionExperimentSetValueObject> evos = expressionExperimentSetService.loadAllExperimentSetValueObjects(true);
for (ExpressionExperimentSetValueObject evo : evos) {
if (taxonLimited && !evo.getTaxonId().equals(taxonId)) {
continue;
}
SearchResultDisplayObject srdvo = new SearchResultDisplayObject(evo);
if (evo.getName().startsWith(ExpressionExperimentSearchServiceImpl.MASTER_SET_PREFIX)) {
masterResults.add(srdvo);
} else {
displayResults.add(srdvo);
}
}
Collections.sort(displayResults);
// should we also sort by which species is most important(humans obviously) or is that not politically
// correct???
displayResults.addAll(0, masterResults);
return displayResults;
}
use of ubic.gemma.core.search.SearchResultDisplayObject in project Gemma by PavlidisLab.
the class ExpressionExperimentSearchServiceImpl method getExpressionExperimentResults.
private List<SearchResultDisplayObject> getExpressionExperimentResults(Map<Class<?>, List<SearchResult>> results) {
// get all expressionExperiment results and convert result object into a value object
List<SearchResult> srEEs = results.get(ExpressionExperiment.class);
if (srEEs == null) {
srEEs = new ArrayList<>();
}
List<Long> eeIds = new ArrayList<>();
for (SearchResult sr : srEEs) {
eeIds.add(sr.getId());
}
Collection<ExpressionExperimentValueObject> eevos = expressionExperimentService.loadValueObjects(eeIds, true);
List<SearchResultDisplayObject> experiments = new ArrayList<>();
for (ExpressionExperimentValueObject eevo : eevos) {
experiments.add(new SearchResultDisplayObject(eevo));
}
return experiments;
}
use of ubic.gemma.core.search.SearchResultDisplayObject in project Gemma by PavlidisLab.
the class ExpressionExperimentController method searchExperimentsAndExperimentGroups.
/**
* AJAX (used by experimentAndExperimentGroupCombo.js)
*
* @param taxonId if the search should not be limited by taxon, pass in null
* @param query query
* @return Collection of SearchResultDisplayObjects
*/
public List<SearchResultDisplayObject> searchExperimentsAndExperimentGroups(String query, Long taxonId) {
boolean taxonLimited = (taxonId != null);
List<SearchResultDisplayObject> displayResults = new ArrayList<>();
// add session bound sets
// get any session-bound groups
Collection<SessionBoundExpressionExperimentSetValueObject> sessionResult = (taxonLimited) ? sessionListManager.getModifiedExperimentSets(taxonId) : sessionListManager.getModifiedExperimentSets();
List<SearchResultDisplayObject> sessionSets = new ArrayList<>();
// create SearchResultDisplayObjects
if (sessionResult != null && sessionResult.size() > 0) {
for (SessionBoundExpressionExperimentSetValueObject eevo : sessionResult) {
SearchResultDisplayObject srdo = new SearchResultDisplayObject(eevo);
srdo.setUserOwned(true);
sessionSets.add(srdo);
}
}
// keep sets in proper order (session-bound groups first)
Collections.sort(sessionSets);
displayResults.addAll(sessionSets);
displayResults.addAll(expressionExperimentSearchService.searchExperimentsAndExperimentGroups(query, taxonId));
for (SearchResultDisplayObject r : displayResults) {
r.setOriginalQuery(query);
}
return displayResults;
}
Aggregations