Class Group
- java.lang.Object
-
- com.lucidworks.search.dsl.DslBase
-
- com.lucidworks.search.dsl.request.DslCloneable
-
- com.lucidworks.search.dsl.request.Group
-
public class Group extends DslCloneable
Grouping parametersQueryDefinition.getGroupedQuery()
andQueryDefinition.getGroupedFilters()
could override main query and filter queries when selecting group details.Note: In order to use these features the documents must be located on the same shard. This could be achieved by restricting data collection to one shard, or by setting up Document Routing on indexing.
The same shard restriction could be lifted with hint "hint.grouping.method=group". But
getLeaderStrategy()
,QueryDefinition.getGroupedQuery()
andQueryDefinition.getGroupedFilters()
will be ignored; and total number of groups will not be calculated.To calculate total number of group with "hint.grouping.method=group", another hint has to be specified: "hint.grouping.num.found=true", but this will require the documents to be located on the same shard too.
-
-
Constructor Summary
Constructors Constructor Description Group(java.lang.String field, GroupLeaderStrategy leaderStrategy, java.util.List<SortElement> sort, java.lang.Long size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Group
clone()
java.lang.String
getField()
GroupLeaderStrategy
getLeaderStrategy()
java.lang.Long
getSize()
java.util.List<SortElement>
getSort()
void
setSort(java.util.List<SortElement> sort)
-
Methods inherited from class com.lucidworks.search.dsl.request.DslCloneable
clone, deepClone
-
-
-
-
Constructor Detail
-
Group
public Group(java.lang.String field, GroupLeaderStrategy leaderStrategy, java.util.List<SortElement> sort, java.lang.Long size)
-
-
Method Detail
-
getField
public java.lang.String getField()
- Returns:
- name of the field that will be used for grouping. Required.
-
getLeaderStrategy
public GroupLeaderStrategy getLeaderStrategy()
- Returns:
- a strategy that is used to determine group head document. If no strategy specified highest scoring document
is selected as the head document for a group.
This field is ignored with "hint.grouping.method=group". "sort" leader strategy with
getSort()
order will be used.
-
getSort
public java.util.List<SortElement> getSort()
- Returns:
- a sort order for group details
-
setSort
public void setSort(java.util.List<SortElement> sort)
-
getSize
public java.lang.Long getSize()
- Returns:
- a number of group details to include. To only return header documents, set to 0. Default is 5.
-
clone
public Group clone()
- Specified by:
clone
in classDslCloneable
-
-