Package sonia.scm.search
Class QueryBuilder<T>
java.lang.Object
sonia.scm.search.QueryBuilder<T>
- Type Parameters:
T
- type of indexed objects
Build and execute queries against an index.
- Since:
- 2.21.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionExecutes the query and returns the total count of hits.protected QueryCountResult
count
(sonia.scm.search.QueryBuilder.QueryParams queryParams) Executes the query and returns the total count of hits.Executes the query and returns the matches.protected abstract QueryResult
execute
(sonia.scm.search.QueryBuilder.QueryParams queryParams) Executes the query and returns the matches.Return only results which are related to the given part of the id.filter
(Class<?> type, ModelObject idObject) Return only results which are related to the given part of the id.filter
(Repository repository) Return only results which are related to the given repository.limit
(int limit) Defines how many hits are returned.start
(int start) The result should start at the given number.
-
Constructor Details
-
QueryBuilder
public QueryBuilder()
-
-
Method Details
-
filter
Return only results which are related to the given part of the id. Note: this function can be called multiple times.- Parameters:
type
- type of id partid
- value of id part- Returns:
this
- Since:
- 2.23.0
- See Also:
-
filter
Return only results which are related to the given repository.- Parameters:
repository
- repository for filter- Returns:
this
- Since:
- 2.23.0
- See Also:
-
filter
Return only results which are related to the given part of the id. Note: this function can be called multiple times.- Parameters:
type
- type of id partidObject
- object which holds the id value- Returns:
this
- Since:
- 2.23.0
- See Also:
-
start
The result should start at the given number. All matching objects before the given start are skipped.- Parameters:
start
- start of result- Returns:
this
-
limit
Defines how many hits are returned.- Parameters:
limit
- limit of hits- Returns:
this
-
execute
Executes the query and returns the matches.- Parameters:
queryString
- searched query- Returns:
- result of query
-
count
Executes the query and returns the total count of hits.- Parameters:
queryString
- searched query- Returns:
- total count of hits
- Since:
- 2.22.0
-
execute
Executes the query and returns the matches.- Parameters:
queryParams
- query parameter- Returns:
- result of query
-
count
Executes the query and returns the total count of hits.- Parameters:
queryParams
- query parameter- Returns:
- total hit count
- Since:
- 2.22.0
-