Class SearchServiceImpl
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean,SearchService
Implementation notes
Internally, there are generally two kinds of searches performed, precise database searches looking for exact matches in the database and compass/lucene searches which look for matches in the stored index. To add more dependencies to this Service edit the applicationContext-search.xml- Author:
- klc, paul, keshav
-
Nested Class Summary
Nested classes/interfaces inherited from interface ubic.gemma.core.search.SearchService
SearchService.SearchResultMap -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidcanConvertFromId(Class<? extends IdentifiableValueObject<?>> to) getFields(Class<? extends Identifiable> resultType) Obtain a list of fields that can be searched on for the given result type.Set<Class<? extends Identifiable>> Returns a set of supported result types.<T extends Identifiable,U extends IdentifiableValueObject<T>>
SearchResult<U> loadValueObject(SearchResult<T> searchResult) Convert aSearchResultto its VO flavour.List<SearchResult<? extends IdentifiableValueObject<?>>> loadValueObjects(Collection<SearchResult<?>> searchResults) Convert a collection ofSearchResultto their VO flavours.search(SearchSettings settings) search(SearchSettings settings, SearchContext context) The results are sorted in order of decreasing score, organized by class.
-
Constructor Details
-
SearchServiceImpl
public SearchServiceImpl()
-
-
Method Details
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
getFields
Description copied from interface:SearchServiceObtain a list of fields that can be searched on for the given result type.- Specified by:
getFieldsin interfaceSearchService
-
search
@Transactional(readOnly=true) public SearchService.SearchResultMap search(SearchSettings settings, SearchContext context) throws SearchException Description copied from interface:SearchServiceThe results are sorted in order of decreasing score, organized by class. The following objects can be searched for, depending on the configuration of the input object.- Genes
- ExpressionExperiments
- CompositeSequences (probes)
- ArrayDesigns (platforms)
- Characteristics (e.g., Ontology annotations)
- BioSequences
- BibliographicReferences (articles)
- Specified by:
searchin interfaceSearchService- Parameters:
settings- settingscontext-- Returns:
- Map of Class to SearchResults. The results are already filtered for security considerations.
- Throws:
SearchException
-
search
@Transactional(readOnly=true) public SearchService.SearchResultMap search(SearchSettings settings) throws SearchException - Specified by:
searchin interfaceSearchService- Throws:
SearchException
-
getSupportedResultTypes
Description copied from interface:SearchServiceReturns a set of supported result types.This is mainly used to perform a search for everything via
SearchSettings.getResultTypes().- Specified by:
getSupportedResultTypesin interfaceSearchService
-
canConvertFromId
-
loadValueObject
@Transactional(readOnly=true) public <T extends Identifiable,U extends IdentifiableValueObject<T>> SearchResult<U> loadValueObject(SearchResult<T> searchResult) throws IllegalArgumentException Description copied from interface:SearchServiceConvert aSearchResultto its VO flavour.The resulting search result preserve the result ID, score and highlighted text, and
SearchResult.getResultType(), but sees itsSearchResult.getResultObject()transformed.The conversion logic is mainly defined by the corresponding
BaseVoEnabledServicethat match the result type. SeeSearchService.getSupportedResultTypes()for a set of supported result types this o function can handle.- Specified by:
loadValueObjectin interfaceSearchService- Throws:
IllegalArgumentException- if the passed search result is not supported for VO conversion
-
loadValueObjects
@Transactional(readOnly=true) public List<SearchResult<? extends IdentifiableValueObject<?>>> loadValueObjects(Collection<SearchResult<?>> searchResults) throws IllegalArgumentException Description copied from interface:SearchServiceConvert a collection ofSearchResultto their VO flavours.Note that since the results might contain a mixture of different result types, the implementation can take advantage of grouping result by types in order to use
BaseVoEnabledService.loadValueObjects(Collection), which is generally more efficient than loading each result individually.- Specified by:
loadValueObjectsin interfaceSearchService- Parameters:
searchResults- a collection ofSearchResult, which may contain a mixture of differentIdentifiableresult objects- Returns:
- converted search results as per
SearchService.loadValueObject(SearchResult) - Throws:
IllegalArgumentException- if any of the supplied search results cannot be converted to VO- See Also:
-