public class SearchQuery extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
SearchQuery.Order
Enumeration of available sort orders.
|
Constructor and Description |
---|
SearchQuery() |
Modifier and Type | Method and Description |
---|---|
void |
addCategory(CategoryId category)
Adds a category to search for.
|
void |
addLanguage(LanguageId language)
Adds a language to search for.
|
SearchQuery |
category(CategoryId category)
Category to search for.
|
Collection<CategoryId> |
getCategories()
Returns the collection of categories to search for.
|
Collection<LanguageId> |
getLanguages()
Returns the collection of languages to search for.
|
String |
getQuery()
Text to search for.
|
SearchQuery.Order |
getSort()
Sort order.
|
String |
getTags()
Tags to search for.
|
String |
getUrl()
URL to search for.
|
UserId |
getUser()
User to search for.
|
SearchQuery |
language(LanguageId language)
Language to search for.
|
SearchQuery |
query(String query)
Text to search for.
|
void |
setCategories(Collection<CategoryId> categories)
Sets a collection of categories to search for.
|
void |
setLanguages(Collection<LanguageId> languages)
Sets a collection of languages to search for.
|
void |
setQuery(String query) |
void |
setSort(SearchQuery.Order sort) |
void |
setTags(String tags) |
void |
setupConnection(Connection conn)
Sets up a
Connection with the current search parameters. |
void |
setUrl(String url) |
void |
setUser(UserId user) |
SearchQuery |
sort(SearchQuery.Order order)
Order to sort the result by.
|
SearchQuery |
tags(String tags)
Sets a tag expression to search for.
|
SearchQuery |
user(UserId user)
User to search for.
|
public SearchQuery()
public String getTags()
public void addLanguage(LanguageId language)
If the collection has been changed via setLanguages(Collection)
, it
must be modifiable.
public Collection<LanguageId> getLanguages()
public void setLanguages(Collection<LanguageId> languages)
languages
- Collection of LanguageId
to be used for searching. Must not be
null
.public SearchQuery.Order getSort()
SearchQuery.Order.RELEVANCE
.public void setSort(SearchQuery.Order sort)
public void addCategory(CategoryId category)
If the collection has been changed via setCategories(Collection)
, it
must be modifiable.
public Collection<CategoryId> getCategories()
Since 2.5, the default collection is modifiable.
public void setCategories(Collection<CategoryId> categories)
categories
- Collection of CategoryId
to be used for searching. Must not be
null
.public SearchQuery query(String query)
public SearchQuery tags(String tags)
public SearchQuery language(LanguageId language)
Since version 2.5, multiple languages can be set by invoking this call multiple times.
public SearchQuery category(CategoryId category)
Since version 2.2, multiple categories can be set by invoking this call multiple times.
public SearchQuery user(UserId user)
public SearchQuery sort(SearchQuery.Order order)
public void setupConnection(Connection conn)
Connection
with the current search parameters.conn
- Connection
to set upCopyright © 2010–2017. All rights reserved.