com.autonomy.aci.businessobjects
Class ResultList

java.lang.Object
  extended bycom.autonomy.aci.businessobjects.ResultList

public class ResultList
extends java.lang.Object

General container for storing IDOL responses that contain 'autn:hit's (for example from action=Query,Suggest,AgentGetResults etc).

Documents are accessed directly using the getDocumentByReference method while the getDocuments and iterator methods provide mechanisms for processing the entire set of documents.

'Meta' information about the result set and the query that generated it is stored in MetaFields. Depending on the parameter send with the query this can include information such as the total number of hits that match the query, the query expansion options for the query etc. These fields are accessible through the getMetaDataFields and getMetaDataFieldValue methods although convenience methods are provided for reading the values of the most common fields.


Field Summary
static java.lang.String QUERY_SUMMARY_AUTN_FIELD_NAME
          The name of the query summary (a.k.a.
static java.lang.String SPELLING_LIST_AUTN_FIELD_NAME
          The name of the spelling XML element found in IDOL responses.
static java.lang.String SPELLING_QUERY_AUTN_FIELD_NAME
          The name of the spelling query XML element found in IDOL responses.
static java.lang.String TOTAL_HITS_AUTN_FIELD_NAME
          The name of the total hits XML element found in IDOL responses.
 
Constructor Summary
ResultList()
          Construct a ResultList object containing no ResultDocuments.
ResultList(java.util.ArrayList alDocuments)
          Construct a ResultList object containing the ResultDocuments supplied.
 
Method Summary
 void addDocument(ResultDocument document)
          Add the specified document to the list of documents associated with this result set.
 void addMetaDataField(java.lang.String sMetaDataFieldName, java.lang.String sMetaDataFieldValue)
          Associate a meta data field with this result set.
 void clearDocuments()
          Remove all the documents contained in this result set.
 void clearMetaDataFields()
          Remove all the meta data fields associated with this result set.
 ResultDocument getDocumentByReference(java.lang.String sDocReference)
          Retrieve the document with the matching reference from the result set.
 int getDocumentCount()
          Calculate the number of result documents in this result set.
 java.util.ArrayList getDocuments()
          Read all the documents contained in this result set.
 java.util.HashMap getMetaDataFields()
          Read all the meta data fields associated with this result set.
 java.lang.String getMetaDataFieldValue(java.lang.String sMetaDataFieldName)
          Read the value of the specified meta data field.
 java.lang.String getMetaDataFieldValue(java.lang.String sMetaDataFieldName, java.lang.String sDefaultValue)
          Read the value of the specified meta data field.
 java.util.ArrayList getQuerySummary()
          Read the terms in the summary of the query that generated this result set.
 java.util.ArrayList getSpellingList()
          Read the terms in the spelling list of the query that generated this result set.
 java.lang.String getSpellingQuery()
          Read the contents of the corrected spelling query generated this result set.
 int getTotalHits()
          Read the total number of hits for the query that generated this result set.
 java.util.Iterator iterator()
          Obtain an iterator over the result documents in this result set
 void removeDocument(Document document)
          Delete the specified document from the list of documents associated with this result set.
 void setDocuments(java.util.ArrayList documentList)
          Set the result documents associated with this result set.
 void setMetaDataFields(java.util.Map metaDataFieldsMap)
          Set the meta data fields associated with this result set.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SPELLING_LIST_AUTN_FIELD_NAME

public static final java.lang.String SPELLING_LIST_AUTN_FIELD_NAME
The name of the spelling XML element found in IDOL responses.

See Also:
Constant Field Values

SPELLING_QUERY_AUTN_FIELD_NAME

public static final java.lang.String SPELLING_QUERY_AUTN_FIELD_NAME
The name of the spelling query XML element found in IDOL responses.

See Also:
Constant Field Values

QUERY_SUMMARY_AUTN_FIELD_NAME

public static final java.lang.String QUERY_SUMMARY_AUTN_FIELD_NAME
The name of the query summary (a.k.a. query expansion, query suggestion) XML element found in IDOL responses.

See Also:
Constant Field Values

TOTAL_HITS_AUTN_FIELD_NAME

public static final java.lang.String TOTAL_HITS_AUTN_FIELD_NAME
The name of the total hits XML element found in IDOL responses.

See Also:
Constant Field Values
Constructor Detail

ResultList

public ResultList()
Construct a ResultList object containing no ResultDocuments.


ResultList

public ResultList(java.util.ArrayList alDocuments)
Construct a ResultList object containing the ResultDocuments supplied.

Method Detail

setMetaDataFields

public void setMetaDataFields(java.util.Map metaDataFieldsMap)
Set the meta data fields associated with this result set. The meta data fields are defined as those entries in an ACI server response that are contained in the <responsedata> tag but are not part of any <autn:hit> entry.

Parameters:
metaDataFieldsMap - a Map specifying the field names and values which should be associated with this result set.

addMetaDataField

public void addMetaDataField(java.lang.String sMetaDataFieldName,
                             java.lang.String sMetaDataFieldValue)
Associate a meta data field with this result set.

Parameters:
sMetaDataFieldName - the name of the meta data field.
sMetaDataFieldValue - the value to give the meta data field.

clearMetaDataFields

public void clearMetaDataFields()
Remove all the meta data fields associated with this result set.


setDocuments

public void setDocuments(java.util.ArrayList documentList)
Set the result documents associated with this result set.

Parameters:
documentList - a List of ResultDocuments which should be associated with this result set.

addDocument

public void addDocument(ResultDocument document)
Add the specified document to the list of documents associated with this result set.

Parameters:
document - the document to add.

removeDocument

public void removeDocument(Document document)
Delete the specified document from the list of documents associated with this result set.

Parameters:
document - the document to delete. The Document object must have at least the document reference set.

clearDocuments

public void clearDocuments()
Remove all the documents contained in this result set.


getDocuments

public java.util.ArrayList getDocuments()
Read all the documents contained in this result set.

Returns:
an ArrayList of ResultDocuments representing the documents retrieved by a request to an ACI server.

getDocumentByReference

public ResultDocument getDocumentByReference(java.lang.String sDocReference)
Retrieve the document with the matching reference from the result set.

Parameters:
sDocReference - the reference of the document to find.
Returns:
the document with the matching reference or null if no matching document could be found.

getMetaDataFields

public java.util.HashMap getMetaDataFields()
Read all the meta data fields associated with this result set. The meta data fields are defined as those entries in an ACI server response that are contained in the <responsedata> tag but are not part of any <autn:hit> entry.

Returns:
HashMap containing the meta data fields as key-value pairs.

getMetaDataFieldValue

public java.lang.String getMetaDataFieldValue(java.lang.String sMetaDataFieldName)
Read the value of the specified meta data field. The meta data fields are defined as those entries in an ACI server response that are contained in the <responsedata> tag but are not part of any <autn:hit> entry.

Parameters:
sMetaDataFieldName - the name of the meta data field. This must include the "autn:" namespace prefix if it is present in the ACI response.
Returns:
the value of the field. Returns null if the field does not exist.

getMetaDataFieldValue

public java.lang.String getMetaDataFieldValue(java.lang.String sMetaDataFieldName,
                                              java.lang.String sDefaultValue)
Read the value of the specified meta data field. The meta data fields are defined as those entries in an ACI server response that are contained in the <responsedata> tag but are not part of any <autn:hit> entry.

Parameters:
sMetaDataFieldName - the name of the meta data field. This must include the "autn:" namespace prefix if it is present in the ACI response.
sDefaultValue - the value to return if the field does not exist.
Returns:
the value of the field or the default value provided if the field does not exist.

getSpellingList

public java.util.ArrayList getSpellingList()
Read the terms in the spelling list of the query that generated this result set. Note that this will only be present if query had the SpellCheck parameter set to true.

Returns:
an ArrayList of Strings giving the query summary terms.

getSpellingQuery

public java.lang.String getSpellingQuery()
Read the contents of the corrected spelling query generated this result set. Note that this will only be present if query had the SpellCheck parameter set to true.

Returns:
a String giving the query text after spelling correction.

getQuerySummary

public java.util.ArrayList getQuerySummary()
Read the terms in the summary of the query that generated this result set. Note that this will only be present if query had the QuerySummary parameter set to true.

Returns:
an ArrayList of Strings giving the query summary terms.

getTotalHits

public int getTotalHits()
Read the total number of hits for the query that generated this result set. Note that this will only be present if query had the TotalResults parameter set to true.

Returns:
an int.

iterator

public java.util.Iterator iterator()
Obtain an iterator over the result documents in this result set

Returns:
an Iterator over the ResultDocuments in this result list.

getDocumentCount

public int getDocumentCount()
Calculate the number of result documents in this result set. Formally, this is the same as calling getDocuments().size() on this.

Returns:
the number of ResultDocuments in this result set.

toString

public java.lang.String toString()