public class ResultBuilder extends ResultAccessor
ResultAccessor as to
also provide read access to the props that are set here._result| Constructor and Description |
|---|
ResultBuilder(java.lang.String workflowName,
Record result)
Creates a new builder and adds an AnySeq for the
SearchResultConstants.RECORDS. |
| Modifier and Type | Method and Description |
|---|---|
AnySeq |
addFacet(java.lang.String facetName)
Adds facets Seq with the given name and returns it.
|
AnyMap |
addFacetValue(AnySeq facet,
Any value,
java.lang.Long count)
Adds the map containing the count and value for the facet value.
|
AnyMap |
addFacetValue(AnySeq facet,
java.lang.Object value,
java.lang.Long count)
Add a map containing facet value and count to facet.
|
AnyMap |
addFacetValue(AnySeq facet,
java.lang.String value,
Any.ValueType valueType,
java.lang.Long count)
Add a map containing facet value with specified
Any.ValueType and count to facet. |
AnySeq |
addGroup(java.lang.String groupCommand)
Create and return an
AnySeq like RecordMetadata/groupCommand. |
AnySeq |
addGroup(java.lang.String groupName,
java.lang.String groupCommand)
Create and return an
AnySeq like RecordMetadata/groupName/groupCommand. |
AnyMap |
addGroupResults(AnySeq group,
Any value,
java.lang.Long count,
AnySeq results)
Add a group to the
AnySeq group with value, count and results. |
void |
addHighlight(AnyMap resultItem,
java.lang.String attribute,
AnyMap highlight)
Add highlight result to result item.
|
void |
addHighlightText(AnyMap resultItem,
java.lang.String attribute,
java.util.List<java.lang.String> text)
Add multiple highlight texts to result item.
|
void |
addHighlightText(AnyMap resultItem,
java.lang.String attribute,
java.lang.String text)
Add highlight text to result item.
|
AnyMap |
addNestedGroup(AnySeq group,
Any value,
java.lang.Long count,
AnyMap nestedGroup)
Add a group to the
AnySeq group with value, count and a nested group. |
AnyMap |
addResultItem(java.lang.String id,
java.lang.Double score)
Adds a new result item to the list. the given args are mandatory and will be set at the item.
|
void |
setCount(java.lang.Long count)
sets value for
SearchResultConstants.COUNT. |
void |
setRuntime(java.lang.Long millis)
sets value for
SearchResultConstants.RUNTIME. |
getCount, getFacets, getGroups, getIndexSize, getNumberOfRecords, getQuery, getResult, getResultRecord, getResultRecords, getRuntime, getWorkflowName, hasQuery, hasRecordspublic ResultBuilder(java.lang.String workflowName,
Record result)
SearchResultConstants.RECORDS.workflowName - result - public AnyMap addResultItem(java.lang.String id, java.lang.Double score)
public void addHighlightText(AnyMap resultItem, java.lang.String attribute, java.lang.String text)
resultItem - the AnyMap result item.attribute - the highlighted attribute.text - the highlight text.public void addHighlightText(AnyMap resultItem, java.lang.String attribute, java.util.List<java.lang.String> text)
resultItem - the AnyMap result item.attribute - the highlighted attribute.text - a List containing highlight texts.public void addHighlight(AnyMap resultItem, java.lang.String attribute, AnyMap highlight)
resultItem - the AnyMap result item.attribute - the highlighted attribute.highlight - the highlight result.public void setCount(java.lang.Long count)
SearchResultConstants.COUNT.public void setRuntime(java.lang.Long millis)
SearchResultConstants.RUNTIME.public AnySeq addFacet(java.lang.String facetName)
public AnyMap addFacetValue(AnySeq facet, Any value, java.lang.Long count)
facet - NullArgumentException if nullvalue - NullArgumentException if nullcount - if null the count property is not setpublic AnyMap addFacetValue(AnySeq facet, java.lang.Object value, java.lang.Long count)
facet - facet to which value is added.value - value to add.count - count of facet value.public AnyMap addFacetValue(AnySeq facet, java.lang.String value, Any.ValueType valueType, java.lang.Long count)
Any.ValueType and count to facet.facet - facet to which value is added.value - value to add.valueType - type of value.count - count of facet value.public AnySeq addGroup(java.lang.String groupName, java.lang.String groupCommand)
AnySeq like RecordMetadata/groupName/groupCommand.groupName - the group name.groupCommand - the group command.AnySeq like RecordMetadata/groupName/groupCommand.public AnySeq addGroup(java.lang.String groupCommand)
AnySeq like RecordMetadata/groupCommand.groupCommand - the group name.AnySeq like RecordMetadata/groupCommand.public AnyMap addGroupResults(AnySeq group, Any value, java.lang.Long count, AnySeq results)
AnySeq group with value, count and results.group - the group to add to.value - the value.count - the count.results - the results.AnyMap.public AnyMap addNestedGroup(AnySeq group, Any value, java.lang.Long count, AnyMap nestedGroup)
AnySeq group with value, count and a nested group.group - the group to add to.value - the value.count - the count.nestedGroup - the nested group.AnyMap.