com.plumtree.server.search
Interface IPTSResult


public interface IPTSResult

A single search result, returned as part of an IPTSQueryResponse.


Method Summary
 boolean getFieldAsBoolean(IPTSField field)
          Returns the value of a boolean IPTSField.
 double getFieldAsDouble(IPTSField field)
          Returns the value of a floating-point IPTSField.
 int getFieldAsInt(IPTSField field)
          Returns the value of an integer IPTSField.
 java.lang.Object getFieldAsObject(IPTSField field)
          Returns the value of a IPTSField, regardless of type.
 java.lang.String getFieldAsString(IPTSField field)
          Returns the value of a String IPTSField.
 com.plumtree.openfoundation.util.XPDateTime getFieldAsXPDateTime(IPTSField field)
          Returns the value of a floating-point IPTSField.
 java.lang.String[] getFieldExcerpts(IPTSField field, java.lang.String startingDelimiter, java.lang.String endingDelimiter)
          Returns a set of excerpts of the indicated IPTSField that matched the user's query.
 boolean getFieldExists(IPTSField field)
          Returns whether or not the field exists in this result.
 int getRank()
          Returns the rank of this result within its result set.
 

Method Detail

getRank

int getRank()
Returns the rank of this result within its result set. Convenience method that returns the same result as calling getFieldAsInt on the RANK field (see IPTSSearchableCollection.Rank).

Returns:
the rank of this result.

getFieldExists

boolean getFieldExists(IPTSField field)
Returns whether or not the field exists in this result. NOTE: Fields can not exist because they were not queried for, they were not indexed because they contain a null or empty string value, or because the calling code is trying to get an invalid field in this result.

Returns:
whether or not the field exists.

getFieldAsString

java.lang.String getFieldAsString(IPTSField field)
                                  throws PTSNoFieldValueException
Returns the value of a String IPTSField. Throws a PTSNoFieldValueException if the field is not defined for this result.

Returns:
value of the indicated field, as a String
Throws:
PTSNoFieldValueException - if the field is not defined for this result.

getFieldAsInt

int getFieldAsInt(IPTSField field)
                  throws PTSNoFieldValueException
Returns the value of an integer IPTSField. Note that the Search Server stores all numeric types as 32-bit float values. Values will suffer roundoff error. Throws a PTSNoFieldValueException if the field is not defined for this result.

Returns:
value of the indicated field, as an int
Throws:
PTSNoFieldValueException - if the field is not defined for this result.

getFieldAsDouble

double getFieldAsDouble(IPTSField field)
                        throws PTSNoFieldValueException
Returns the value of a floating-point IPTSField. Note that the Search Server stores all numeric types as 32-bit float values. Values will suffer roundoff error. Throws a PTSNoFieldValueException if the field is not defined for this result.

Returns:
value of the indicated field, as double
Throws:
PTSNoFieldValueException - if the field is not defined for this result.

getFieldAsXPDateTime

com.plumtree.openfoundation.util.XPDateTime getFieldAsXPDateTime(IPTSField field)
                                                                 throws PTSNoFieldValueException
Returns the value of a floating-point IPTSField. Note that the Search Server stores dates as 32-bit float values. Values will suffer roundoff error. Throws a PTSNoFieldValueException if the field is not defined for this result.

Returns:
value of the indicated field, as date/time
Throws:
PTSNoFieldValueException - if the field is not defined for this result.

getFieldAsBoolean

boolean getFieldAsBoolean(IPTSField field)
                          throws PTSNoFieldValueException
Returns the value of a boolean IPTSField. Throws a PTSNoFieldValueException if the field is not defined for this result.

Returns:
value of the indicated field, as boolean
Throws:
PTSNoFieldValueException - if the field is not defined for this result.

getFieldAsObject

java.lang.Object getFieldAsObject(IPTSField field)
                                  throws PTSNoFieldValueException
Returns the value of a IPTSField, regardless of type. The actual underlying type of the returned Object will be String, Integer, Double, Boolean, or XPDateTime. Throws a PTSNoFieldValueException if the field is not defined for this result.

Returns:
value of the indicated field, as generic Object.
Throws:
PTSNoFieldValueException - if the field is not defined for this result.

getFieldExcerpts

java.lang.String[] getFieldExcerpts(IPTSField field,
                                    java.lang.String startingDelimiter,
                                    java.lang.String endingDelimiter)
Returns a set of excerpts of the indicated IPTSField that matched the user's query. For example, if the user searched for dog, one of the returned Strings might be "went to the <b>dog</b> park with Rover". Returns null if no excerpts were found.

Parameters:
field - the field to excerpt. Must be a string field (and non-null).
startingDelimiter - text to insert before the token(s) that matched the query. Usually some sort of opening HTML tag, like <b>.
endingDelimiter - text to insert after the token(s) that matched the query. Usually some sort of closing HTML tag, like </b>.
Returns:
array of excerpts