Package ubic.gemma.model.common.search
Class SearchSettings
- java.lang.Object
-
- ubic.gemma.model.common.search.SearchSettings
-
- All Implemented Interfaces:
Serializable
public class SearchSettings extends Object implements Serializable
Configuration options for searching.- Author:
- paul
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SearchSettings.SearchMode
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_MAX_RESULTS_PER_RESULT_TYPE
How many results per result type are allowed.static char
SINGLE_WILDCARD_CHAR
static char
WILDCARD_CHAR
-
Constructor Summary
Constructors Constructor Description SearchSettings()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static SearchSettings
arrayDesignSearch(String query)
Convenience method to get pre-configured settings.static SearchSettings
bibliographicReferenceSearch(String query)
Convenience method to get pre-configured settings.static SearchSettings
compositeSequenceSearch(String query, ArrayDesign arrayDesign)
Convenience method to get pre-configured settings.static SearchSettings
expressionExperimentSearch(String query)
Convenience method to get pre-configured settings.static SearchSettings
expressionExperimentSearch(String query, Taxon taxon)
Convenience method to get pre-configured settings.static SearchSettings
geneSearch(String query, Taxon taxon)
Convenience method to get pre-configured settings.String
getQuery()
Get this query, trimmed.String
getRawQuery()
Get the original query that was set by#setQuery(String)
, untrimmed.String
getTermUri()
Deprecated.usegetQuery()
andisTermQuery()
instead.boolean
hasResultType(Class<?> cls)
Check if this is configured to search a given result type.Map<String,String>
highlightDocument(org.apache.lucene.document.Document document, org.apache.lucene.search.highlight.Highlighter luceneHighlighter, org.apache.lucene.analysis.Analyzer analyzer, Set<String> fields)
Map<String,String>
highlightTerm(String termUri, String termLabel, String field)
Highlight a given ontology term.boolean
isTermQuery()
Indicate if the query refers to an ontology term.boolean
isWildcard()
Check if the query is a wildcard query.void
setTermUri(String termUri)
Deprecated.URI can be set with#setQuery(String)
instead.String
toString()
-
-
-
Field Detail
-
WILDCARD_CHAR
public static final char WILDCARD_CHAR
- See Also:
- Constant Field Values
-
SINGLE_WILDCARD_CHAR
public static final char SINGLE_WILDCARD_CHAR
- See Also:
- Constant Field Values
-
DEFAULT_MAX_RESULTS_PER_RESULT_TYPE
public static final int DEFAULT_MAX_RESULTS_PER_RESULT_TYPE
How many results per result type are allowed. This implies that if you search for multiple types of things, you can get more than this.- See Also:
- Constant Field Values
-
-
Method Detail
-
arrayDesignSearch
public static SearchSettings arrayDesignSearch(String query)
Convenience method to get pre-configured settings.- Parameters:
query
- query- Returns:
- search settings
-
bibliographicReferenceSearch
public static SearchSettings bibliographicReferenceSearch(String query)
Convenience method to get pre-configured settings.- Parameters:
query
- query- Returns:
- search settings
-
compositeSequenceSearch
public static SearchSettings compositeSequenceSearch(String query, ArrayDesign arrayDesign)
Convenience method to get pre-configured settings.- Parameters:
query
- queryarrayDesign
- the array design to limit the search to- Returns:
- search settings
-
expressionExperimentSearch
public static SearchSettings expressionExperimentSearch(String query)
Convenience method to get pre-configured settings.- Parameters:
query
- query- Returns:
- search settings
-
expressionExperimentSearch
public static SearchSettings expressionExperimentSearch(String query, Taxon taxon)
Convenience method to get pre-configured settings.- Parameters:
query
- querytaxon
- if you want to filter by taxon (can be null)- Returns:
- search settings
-
geneSearch
public static SearchSettings geneSearch(String query, Taxon taxon)
Convenience method to get pre-configured settings.- Parameters:
query
- querytaxon
- the taxon to limit the search to (can be null)- Returns:
- search settings
-
getQuery
public String getQuery()
Get this query, trimmed.
-
getRawQuery
public String getRawQuery()
Get the original query that was set by#setQuery(String)
, untrimmed.
-
isTermQuery
public boolean isTermQuery()
Indicate if the query refers to an ontology term.This is done by checking if this query starts with 'http://' for now, but there could be fancier checks performed in the future.
-
getTermUri
@Deprecated public String getTermUri()
Deprecated.usegetQuery()
andisTermQuery()
instead.Obtain the term URI.- Returns:
- the term URI if this is a term query, otherwise null
-
setTermUri
@Deprecated public void setTermUri(String termUri)
Deprecated.URI can be set with#setQuery(String)
instead.Set this term URI.- Parameters:
termUri
- a valid term URI, or null or a blank string
-
isWildcard
public boolean isWildcard()
Check if the query is a wildcard query.
-
hasResultType
public boolean hasResultType(Class<?> cls)
Check if this is configured to search a given result type.
-
highlightTerm
@Nullable public Map<String,String> highlightTerm(String termUri, String termLabel, String field)
Highlight a given ontology term.This is a shorthand for
#getHighlighter()
andHighlighter.highlightTerm(String, String, String)
that deals with a potentially null highlighter.- Returns:
- a highlight, or null if no provider is set or the provider returns null
- See Also:
#setHighlighter(Highlighter)
-
highlightDocument
@Nullable public Map<String,String> highlightDocument(org.apache.lucene.document.Document document, org.apache.lucene.search.highlight.Highlighter luceneHighlighter, org.apache.lucene.analysis.Analyzer analyzer, Set<String> fields)
-
-