atg.search.routing.command.search
Class AnswerGroup

java.lang.Object
  extended by atg.search.routing.command.search.AnswerGroup
All Implemented Interfaces:
java.io.Serializable

public class AnswerGroup
extends java.lang.Object
implements java.io.Serializable

The engine returns a list of answer groups. When grouping by document, an answer group has one result. When grouping by property, an answer group might have multiple results. Answer groups are distinguished by their 1-based answer group ids. See getId().

See Also:
Serialized Form

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Constructor Summary
AnswerGroup()
           
 
Method Summary
 void addResult(Result pResult)
          Adds the result to this answer group
 int getId()
          Returns the answer group id, a 1-based identifier.
 Result getResult()
          Returns the first result in the group.
 java.util.List<Result> getResults()
          These are the results.
static java.util.List<AnswerGroup> group(java.util.List<Result> pResults)
          Utility method that groups a flat list of Results into a list of AnswerGroups.
 boolean isEmpty()
          Indicates whether the group has any results
 void setId(int pId)
          Sets the answer group id, a 1-based identifier.
 void setResults(java.util.List<Result> pResults)
          Sets the results for this answer group
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values
Constructor Detail

AnswerGroup

public AnswerGroup()
Method Detail

getId

public int getId()
Returns the answer group id, a 1-based identifier.

Returns:
the 1-based answer group id

setId

public void setId(int pId)
Sets the answer group id, a 1-based identifier.

Parameters:
pId - the answer group id, a 1-based identifier.

getResult

public Result getResult()
Returns the first result in the group. Call when you want the first result (or when you are not grouping by property and can therefore be certain there is only one result).

Returns:
the first result

getResults

public java.util.List<Result> getResults()
These are the results. List of Results. See getResult() if you want the first result (or when you are not grouping by property and can therefore be certain there is only one result).

Returns:
List of Results.

setResults

public void setResults(java.util.List<Result> pResults)
Sets the results for this answer group

Parameters:
pResults - the results for the group

addResult

public void addResult(Result pResult)
Adds the result to this answer group

Parameters:
pResult - the result to add

isEmpty

public boolean isEmpty()
Indicates whether the group has any results

Returns:
true if the group has no results

group

public static java.util.List<AnswerGroup> group(java.util.List<Result> pResults)
Utility method that groups a flat list of Results into a list of AnswerGroups.

Parameters:
pResults - flat list of results
Returns:
list of groups