Class BaseSearchQuery
- java.lang.Object
-
- edu.cornell.mannlib.vitro.webapp.searchengine.base.BaseSearchQuery
-
- All Implemented Interfaces:
SearchQuery
public class BaseSearchQuery extends Object implements SearchQuery
A foundation class for implementing SearchQuery.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchQuery
SearchQuery.Order
-
-
Constructor Summary
Constructors Constructor Description BaseSearchQuery()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SearchQueryaddFacetFields(String... fields)What fields should be used to facet the results?SearchQueryaddFields(String... names)Which fields should be returned from the query?SearchQueryaddFields(Collection<String> names)Which fields should be returned from the query?SearchQueryaddFilterQueries(String... filterQueries)Restrict the results by these queries.SearchQueryaddFilterQuery(String filterQuery)Restrict the results by this query.SearchQueryaddSortField(String name, SearchQuery.Order order)What field should be used to sort the results, and in what order?Set<String>getFacetFields()intgetFacetLimit()intgetFacetMinCount()Set<String>getFieldsToReturn()Set<String>getFilters()StringgetQuery()intgetRows()Map<String,SearchQuery.Order>getSortFields()intgetStart()SearchQuerysetFacetLimit(int cnt)The maximum number of facet counts that will be returned from the query.SearchQuerysetFacetMinCount(int cnt)Facet having fewer hits will be excluded from the list.SearchQuerysetQuery(String query)Set the text of the query.SearchQuerysetRows(int rows)What is the maximum number of documents that will be returned from the query? A negative value means no limit.SearchQuerysetStart(int start)Where in the ordered list of result documents should the response begin? That is, how many of the results should be skipped? (allows paging of results).StringtoString()
-
-
-
Method Detail
-
setQuery
public SearchQuery setQuery(String query)
Description copied from interface:SearchQuerySet the text of the query. This will be parsed using Lucene query syntax.- Specified by:
setQueryin interfaceSearchQuery- Returns:
- this query
-
setStart
public SearchQuery setStart(int start)
Description copied from interface:SearchQueryWhere in the ordered list of result documents should the response begin? That is, how many of the results should be skipped? (allows paging of results). The default is 0.- Specified by:
setStartin interfaceSearchQuery- Returns:
- this query
-
setRows
public SearchQuery setRows(int rows)
Description copied from interface:SearchQueryWhat is the maximum number of documents that will be returned from the query? A negative value means no limit. The default is -1.- Specified by:
setRowsin interfaceSearchQuery- Returns:
- this query
-
addFields
public SearchQuery addFields(String... names)
Description copied from interface:SearchQueryWhich fields should be returned from the query?- Specified by:
addFieldsin interfaceSearchQuery- Returns:
- this query
-
addFields
public SearchQuery addFields(Collection<String> names)
Description copied from interface:SearchQueryWhich fields should be returned from the query?- Specified by:
addFieldsin interfaceSearchQuery- Returns:
- this query
-
addSortField
public SearchQuery addSortField(String name, SearchQuery.Order order)
Description copied from interface:SearchQueryWhat field should be used to sort the results, and in what order?- Specified by:
addSortFieldin interfaceSearchQuery- Returns:
- this query
-
addFilterQuery
public SearchQuery addFilterQuery(String filterQuery)
Description copied from interface:SearchQueryRestrict the results by this query.- Specified by:
addFilterQueryin interfaceSearchQuery- Returns:
- this query
-
addFilterQueries
public SearchQuery addFilterQueries(String... filterQueries)
Description copied from interface:SearchQueryRestrict the results by these queries.- Specified by:
addFilterQueriesin interfaceSearchQuery- Returns:
- this query
-
addFacetFields
public SearchQuery addFacetFields(String... fields)
Description copied from interface:SearchQueryWhat fields should be used to facet the results?- Specified by:
addFacetFieldsin interfaceSearchQuery- Returns:
- this query
-
setFacetLimit
public SearchQuery setFacetLimit(int cnt)
Description copied from interface:SearchQueryThe maximum number of facet counts that will be returned from the query. The default is 100. A negative value means no limit.- Specified by:
setFacetLimitin interfaceSearchQuery- Returns:
- this query
-
setFacetMinCount
public SearchQuery setFacetMinCount(int cnt)
Description copied from interface:SearchQueryFacet having fewer hits will be excluded from the list. The default is 0.- Specified by:
setFacetMinCountin interfaceSearchQuery- Returns:
- this query
-
getQuery
public String getQuery()
- Specified by:
getQueryin interfaceSearchQuery- Returns:
- The text of the query. May be empty, but never null.
-
getStart
public int getStart()
- Specified by:
getStartin interfaceSearchQuery
-
getRows
public int getRows()
- Specified by:
getRowsin interfaceSearchQuery- Returns:
- A negative value means that no limit has been specified.
-
getFieldsToReturn
public Set<String> getFieldsToReturn()
- Specified by:
getFieldsToReturnin interfaceSearchQuery- Returns:
- May return an empty set, but never null.
-
getSortFields
public Map<String,SearchQuery.Order> getSortFields()
- Specified by:
getSortFieldsin interfaceSearchQuery- Returns:
- May return an empty map, but never null.
-
getFilters
public Set<String> getFilters()
- Specified by:
getFiltersin interfaceSearchQuery- Returns:
- May return an empty set, but never null.
-
getFacetFields
public Set<String> getFacetFields()
- Specified by:
getFacetFieldsin interfaceSearchQuery- Returns:
- May return an empty set, but never null.
-
getFacetLimit
public int getFacetLimit()
- Specified by:
getFacetLimitin interfaceSearchQuery- Returns:
- A negative value means that no limit has been specified.
-
getFacetMinCount
public int getFacetMinCount()
- Specified by:
getFacetMinCountin interfaceSearchQuery- Returns:
- A negative value means that no limit has been specified.
-
-