Package org.intermine.api.search
Class SearchResults
- java.lang.Object
-
- org.intermine.api.search.SearchResults
-
- All Implemented Interfaces:
java.lang.Iterable<SearchResult>
public final class SearchResults extends java.lang.Object implements java.lang.Iterable<SearchResult>
Representations of Lucene search results over the web-searchable data of the user-profile and the mechanisms for generating a set of such results. The LuceneSearchResults data structure encapsulates the relevant data returned from a search over the user-profile's data. It should be constructed with a call to runLuceneSearch.- Author:
- Alex Kalderimis, Thomas Riley, Kim Rutherford
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
filterOutInvalidTemplates(java.util.Map<java.lang.String,? extends WebSearchable> map)
Filter out invalid templates from a map.static boolean
isInvalidTemplate(WebSearchable webSearchable)
Check if a websearchable is an invalid template.java.util.Iterator<SearchResult>
iterator()
static SearchResults
runLuceneSearch(java.lang.String queryString, SearchTarget target, SearchRepository userSearchRepository)
Search a Lucene index and return a search result.int
size()
-
-
-
Method Detail
-
size
public int size()
- Returns:
- size
-
iterator
public java.util.Iterator<SearchResult> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<SearchResult>
-
filterOutInvalidTemplates
public static void filterOutInvalidTemplates(java.util.Map<java.lang.String,? extends WebSearchable> map)
Filter out invalid templates from a map.- Parameters:
map
- The map of websearchables. MUST be modifiable.
-
isInvalidTemplate
public static boolean isInvalidTemplate(WebSearchable webSearchable)
Check if a websearchable is an invalid template.- Parameters:
webSearchable
- The item to check.- Returns:
- True if this a template and it is not valid.
-
runLuceneSearch
public static SearchResults runLuceneSearch(java.lang.String queryString, SearchTarget target, SearchRepository userSearchRepository) throws org.apache.lucene.queryParser.ParseException, java.io.IOException
Search a Lucene index and return a search result. Where the query string is blank, all web searchable items of the requested scope will be returned.- Parameters:
queryString
- the query string from the user.target
- a parameter object containing information about the scope of the search.userSearchRepository
- The current user's search repository.- Returns:
- A result set.
- Throws:
org.apache.lucene.queryParser.ParseException
- if the origQueryString has a syntax error for a Lucene stringjava.io.IOException
- if there is a problem creating the Lucene IndexSearcher
-
-