com.primus.searchstudio
Class Results

java.lang.Object
  extended by com.primus.searchstudio.Results
All Implemented Interfaces:
java.io.Serializable

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

Search results value object. Nearly always immutable.

See Also:
Serialized Form

Constructor Summary
Results()
           
 
Method Summary
 void addError(atg.search.routing.command.SearchEngineError error)
          Adds a request error from the search engine.
 void addGenericAction(com.primus.searchstudio.GenericActionItem genericItem)
          Adds a generic query rule action item
 void addResult(Result result)
          Add a single result and update group-by counts accordingly.
 java.util.List getAdvisorActions()
          Returns the list of advisor actions.
 Categories getCategories()
          returns the categories from a browse request or a query
 java.lang.String getDebugString()
          Debug string associated with the results
 java.lang.String getDocProps()
          Returns docProps used in the similar docs and structured queries
 int getElapsedTime()
          Elapsed time for query to complete
 java.util.Collection getErrors()
           
 com.primus.searchstudio.FeedbackReport getFeedbackReport()
          Gets the feedback report
 java.util.List getGenericActions()
          Returns the list of generic query rule action items.
 int getGroupCount()
          Gets the number of answer groups
 java.util.List getPartitionResults()
           
 ConstantQueryID getQueryId()
          Deprecated. as of 2007.0
 com.primus.searchstudio.QueryRule getQueryRule()
          Returns query rule
 com.primus.searchstudio.QueryTerms getQueryTerms()
           
 java.lang.String getQuestion()
           
 Refinements getRefinements()
          returns refinements
 java.util.List getRelatedQueries()
          Deprecated. as of 2006.3. returns an empty list
 RelatedStatements getRelatedStatements()
          return related statements
 com.primus.searchstudio.ReportDataResults getReportDataResults()
           
 java.lang.String getRequestIdentifier()
           
 long getRequestTime()
          Returns the time of day of the response, in milliseconds since 1970
 int getResponseCount()
          returns number of responses as reported in result xml
 double getResponseTime()
           
 java.lang.String getResponseXml()
          The raw response XML.
 Result getResult(int index)
          Get a single result.
 Result getResultById(int id)
          Returns an individual result by ID
 int getResultCount()
          Return the number of results.
 Result[] getResults()
          Return an array of contained results.
 Result[] getResultsByDocument()
          Returns an array of parent Result objects.
 java.util.List getResultsList()
          Returns the internal list of results
 atg.search.routing.command.SearchEngineResponse getSearchEngineResponse()
           
 atg.search.routing.SearchTargetNames getSearchTargetNames()
           
 int getSize()
          Returns the number number of results
 java.util.List getSpellingTerms()
          Get spelling terms
 java.util.List getSuggestedCategories()
          Gets the list of suggested categories
 float getThresh()
          Returns the threshold level
 int getTop()
          Returns the number of top results to be returned
 java.lang.String getUserQuestion()
           
 java.lang.String getViewDocResult()
          This could be a url or an entire document with highlighting
 ViewResult getViewResult()
          Returns the highlighting info
 int hashCode()
          Standard hash code method.
 void setCategories(Categories categories)
          Sets the Categories result.
 void setDebugString(java.lang.String ds)
          Sets the debug string associated with the results
 void setDocProps(java.lang.String docProps)
          Sets docProps used in the similar docs and structured queries
 void setErrors(java.util.Collection errors)
          Sets request errors from the search engine.
 void setGroupCount(int groupCount)
          Sets the number of answer groups
 void setMaxResponseChars(int maxResponseChars)
          Loop through all Result objects and set the maxResponseChars.
 void setPartitionResults(java.util.List pPartitionResults)
           
 void setQueryId(ConstantQueryID queryId)
          Deprecated. as of 2007.0
 void setQueryTerms(com.primus.searchstudio.QueryTerms queryTerms)
           
 void setQuestion(java.lang.String question)
           
 void setRefinements(Refinements refinements)
          set refinements
 void setReportDataResults(com.primus.searchstudio.ReportDataResults pReportDataResults)
          sets report data results
 void setRequestIdentifier(java.lang.String requestIdentifier)
          An identifier generated on the server side that identifies the associated request.
 void setRequestTime(long pRequestTime)
          Sets the time of day of the response, in milliseconds since 1970.
 void setResponseCount(int responseCount)
          sets the number of responses.
 void setResponseTime(double pResponseTime)
           
 void setResponseXml(java.lang.String responseXml)
           
 void setResults(Result[] results)
          Replaces the list of results.
 void setSearchEngineResponse(atg.search.routing.command.SearchEngineResponse response)
           
 void setSearchTargetNames(atg.search.routing.SearchTargetNames pSearchTargetNames)
           
 void setThresh(float thresh)
          Sets the threshold value associated with the results
 void setTop(int top)
          Sets how many top results
 void setUserQuestion(java.lang.String userQuestion)
           
 void setViewDocResult(java.lang.String viewDocResult)
          Used in the case of a view doc request during construction.
 void setViewResult(ViewResult viewResult)
          Used in the case of a vic request during construction.
 java.lang.String toString()
          Standard toString method.
 java.lang.String toSummaryString()
          Standard toString method, but returns summary of Result objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Results

public Results()
Method Detail

setSearchTargetNames

public void setSearchTargetNames(atg.search.routing.SearchTargetNames pSearchTargetNames)
Parameters:
pSearchTargetNames - target names actually used during the search

getSearchTargetNames

public atg.search.routing.SearchTargetNames getSearchTargetNames()
Returns:
search target names actually used during the search, plus generated or looked-up ids

getRequestIdentifier

public java.lang.String getRequestIdentifier()
Returns:
server-generated request identifier, or null if one wasn't generated

setRequestIdentifier

public void setRequestIdentifier(java.lang.String requestIdentifier)
An identifier generated on the server side that identifies the associated request.

Parameters:
requestIdentifier -

getRequestTime

public long getRequestTime()
Returns the time of day of the response, in milliseconds since 1970

Returns:
time of day of the response, in milliseconds since 1970

setRequestTime

public void setRequestTime(long pRequestTime)
Sets the time of day of the response, in milliseconds since 1970. Set automatically by Routing.

Parameters:
pRequestTime - time of day of the response, in milliseconds since 1970

getQueryId

public ConstantQueryID getQueryId()
Deprecated. as of 2007.0

Gets the ID of the original query

Returns:
the ID of the associated query

setQueryId

public void setQueryId(ConstantQueryID queryId)
Deprecated. as of 2007.0

Sets the ID of the original query

Parameters:
queryId - the ID of the associated query

getErrors

public java.util.Collection getErrors()
Returns:
Collection of SearchEngineErrors

setErrors

public void setErrors(java.util.Collection errors)
Sets request errors from the search engine.

Parameters:
errors - Collection of SearchEngineErrors

addError

public void addError(atg.search.routing.command.SearchEngineError error)
Adds a request error from the search engine.

Parameters:
error -

getResultCount

public int getResultCount()
Return the number of results.

Returns:
number of individual results available

getSize

public int getSize()
Returns the number number of results

Returns:
number of results

getResults

public Result[] getResults()
Return an array of contained results.

Returns:
an array of contained results or a null object if there are no contained results
See Also:
setResults(com.primus.searchstudio.Result[])

getResultsList

public java.util.List getResultsList()
Returns the internal list of results

Returns:
List of contained results

getResultsByDocument

public Result[] getResultsByDocument()
Returns an array of parent Result objects.

Returns:
Array of parent Result objects or a null object if there are no parent result objects

setResults

public void setResults(Result[] results)
Replaces the list of results. Existing results will be lost. Group-by counts will be updated.

Parameters:
results - array of results
See Also:
getResults()

getResult

public Result getResult(int index)
                 throws java.lang.IndexOutOfBoundsException
Get a single result.

Parameters:
index - which result
Returns:
Result object
Throws:
java.lang.IndexOutOfBoundsException
See Also:
setResults(com.primus.searchstudio.Result[])

addResult

public void addResult(Result result)
Add a single result and update group-by counts accordingly.

Parameters:
result - single result to add

setMaxResponseChars

public void setMaxResponseChars(int maxResponseChars)
Loop through all Result objects and set the maxResponseChars. This forces recalculation of excerpts.


toString

public java.lang.String toString()
Standard toString method.

Overrides:
toString in class java.lang.Object
Returns:
string representation of results

toSummaryString

public java.lang.String toSummaryString()
Standard toString method, but returns summary of Result objects. This makes for a more compact representation.

Returns:
string summary representation of results

hashCode

public int hashCode()
Standard hash code method.

Overrides:
hashCode in class java.lang.Object

getResultById

public Result getResultById(int id)
Returns an individual result by ID

Parameters:
id - the id of the result
Returns:
the result

setCategories

public void setCategories(Categories categories)
Sets the Categories result. This can be from a browse request or the associated categories of a query. Only called during construction of the Results.

Parameters:
categories - The categories

getCategories

public Categories getCategories()
returns the categories from a browse request or a query

Returns:
the categories

getRelatedStatements

public RelatedStatements getRelatedStatements()
return related statements

Returns:
related statements

setRefinements

public void setRefinements(Refinements refinements)
set refinements

Parameters:
refinements - refinements

getRefinements

public Refinements getRefinements()
returns refinements

Returns:
refinements

getSuggestedCategories

public java.util.List getSuggestedCategories()
Gets the list of suggested categories

Returns:
list of suggested categories

getSpellingTerms

public java.util.List getSpellingTerms()
Get spelling terms

Returns:
spelling terms

getElapsedTime

public int getElapsedTime()
Elapsed time for query to complete

Returns:
elapsed time, in milliseconds

setResponseCount

public void setResponseCount(int responseCount)
sets the number of responses. Might be different than size of result list

Parameters:
responseCount - result count

getResponseCount

public int getResponseCount()
returns number of responses as reported in result xml

Returns:
response count

setGroupCount

public void setGroupCount(int groupCount)
Sets the number of answer groups

Parameters:
groupCount - number of groups

getGroupCount

public int getGroupCount()
Gets the number of answer groups

Returns:
number of answer groups

getAdvisorActions

public java.util.List getAdvisorActions()
Returns the list of advisor actions. These actions are also in the generic action list, but the caller must search through the list and interpret the individual list items.

Returns:
list of advisor actions

addGenericAction

public void addGenericAction(com.primus.searchstudio.GenericActionItem genericItem)
Adds a generic query rule action item

Parameters:
genericItem - the generic action

getGenericActions

public java.util.List getGenericActions()
Returns the list of generic query rule action items. It is the caller's responsibility to interpret the items. Note, also, that this list contains all actions, including the advisor actions.

Returns:

getFeedbackReport

public com.primus.searchstudio.FeedbackReport getFeedbackReport()
Gets the feedback report

Returns:
feedback report

getRelatedQueries

public java.util.List getRelatedQueries()
Deprecated. as of 2006.3. returns an empty list

Returns a list of related queries

Returns:
list of related queries

getQueryRule

public com.primus.searchstudio.QueryRule getQueryRule()
Returns query rule

Returns:
query rule

setViewDocResult

public void setViewDocResult(java.lang.String viewDocResult)
Used in the case of a view doc request during construction. This could be a url or an entire document with highlighting

Parameters:
viewDocResult - the document or url that was requested

getViewDocResult

public java.lang.String getViewDocResult()
This could be a url or an entire document with highlighting

Returns:
the document or url. null if the original request was not a viewDoc request

getViewResult

public ViewResult getViewResult()
Returns the highlighting info

Returns:
the ViewResult. null if the original request was not a viewDoc request

setViewResult

public void setViewResult(ViewResult viewResult)
Used in the case of a vic request during construction.

Parameters:
viewResult - the viewresult was requested

getDebugString

public java.lang.String getDebugString()
Debug string associated with the results

Returns:
debug string

setDebugString

public void setDebugString(java.lang.String ds)
Sets the debug string associated with the results

Parameters:
ds - debug string

getThresh

public float getThresh()
Returns the threshold level

Returns:
the thresh.

setThresh

public void setThresh(float thresh)
Sets the threshold value associated with the results

Parameters:
thresh -

getTop

public int getTop()
Returns the number of top results to be returned

Returns:
top.

setTop

public void setTop(int top)
Sets how many top results

Parameters:
top - how many top results

getDocProps

public java.lang.String getDocProps()
Returns docProps used in the similar docs and structured queries

Returns:
docProps. null if the original request does not have doc properties set

setDocProps

public void setDocProps(java.lang.String docProps)
Sets docProps used in the similar docs and structured queries

Parameters:
docProps -

getResponseXml

public java.lang.String getResponseXml()
The raw response XML. Normally not available. To get it, set SearchEngineRequest.setKeepingResponseData(boolean).

Returns:
the raw response xml

setReportDataResults

public void setReportDataResults(com.primus.searchstudio.ReportDataResults pReportDataResults)
sets report data results

Parameters:
pReportDataResults -

setResponseXml

public void setResponseXml(java.lang.String responseXml)
Parameters:
responseXml - raw response xml returned by search.

getReportDataResults

public com.primus.searchstudio.ReportDataResults getReportDataResults()
Returns:
report data results

getPartitionResults

public java.util.List getPartitionResults()
Returns:
List of SearchEngineResponses, one from each partition

setPartitionResults

public void setPartitionResults(java.util.List pPartitionResults)
Parameters:
pPartitionResults - List of SearchEngineResponses

getResponseTime

public double getResponseTime()
Returns:
XML parse time in ms

setResponseTime

public void setResponseTime(double pResponseTime)
Parameters:
pResponseTime - XML parse time in ms

getQueryTerms

public com.primus.searchstudio.QueryTerms getQueryTerms()
Returns:
query terms

setQueryTerms

public void setQueryTerms(com.primus.searchstudio.QueryTerms queryTerms)
Parameters:
queryTerms - query terms

setSearchEngineResponse

public void setSearchEngineResponse(atg.search.routing.command.SearchEngineResponse response)
Parameters:
response - search engine response

getSearchEngineResponse

public atg.search.routing.command.SearchEngineResponse getSearchEngineResponse()
Returns:
search engine response

setQuestion

public void setQuestion(java.lang.String question)
Parameters:
question - normalized user question

getQuestion

public java.lang.String getQuestion()
Returns:
normalized user question

setUserQuestion

public void setUserQuestion(java.lang.String userQuestion)
Parameters:
userQuestion - original user question

getUserQuestion

public java.lang.String getUserQuestion()
Returns:
original user question