Skip navigation links

Oracle® Ultra Search Java API Reference
11g Release 1 (11.1)

B28329-02


oracle.ultrasearch.query
Class Document

java.lang.Object
  extended by oracle.ultrasearch.query.Document


public class Document
extends java.lang.Object

A document returned from a search.

A document is a set of attributes, and their corresponding attribute values. The type (Java Class) of the value matches the type specified by the attribute. A document can have attributes of the same name, so long as they are of different type. In other words, attribute equality is based on both name and type.

In addition, a document also has some properties that are not part of its attributes, such as URL and score.

Since:
1.0.2

Method Summary
 java.lang.Object getAttribute(Attribute att)
          Returns a value associated with an attribute.
 java.util.Collection getAttributeValues(Attribute att)
          Returns all the values associated with an attribute.
 java.util.Collection getAvailableAttributes()
          Returns a collection of all the attributes available in this document.
 int getContentLength()
          Returns document content length.
 java.lang.String getExcerpt()
          Return an excerpt of the document, with keywords highlighted.
 java.util.Collection getGroups()
          Returns the groups this document belongs to.
 java.lang.String getHiliteAttribute(StringAttribute att)
          return the highlighted attribute value for a string attribute.
 java.util.Collection getHiliteAttributes()
          return all the attributes that are highlighted in this document.
 java.util.Collection getHiliteAttributeValues(StringAttribute att)
          return the highlighted attribute values for a string attribute.
 int getId()
          Get the document id.
 java.util.Locale getLanguage()
          Returns the document's language.
 java.util.Date getLastModified()
          Returns date of the last modification on this document.
 int getScore()
          Returns the value of the hit score.
 long getSignature()
          Get the signature of the document.
 java.lang.String getUrl()
          Returns the display URL of the document.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Method Detail

getId

public int getId()
Get the document id.
Returns:
document id

getScore

public int getScore()
Returns the value of the hit score. Higher value indicating higher relevancy to the query.
Returns:
score value.

getUrl

public java.lang.String getUrl()
Returns the display URL of the document.
Returns:
string representing the URL.

getSignature

public long getSignature()
Get the signature of the document.

A document's signature is calculated from its content's checksum. Two documents with the same signature are likely the same content, with high probability, therefore the signature can be used for duplicate document detection.

Returns:
a long number

getContentLength

public int getContentLength()
Returns document content length.
Returns:
content length.

getLastModified

public java.util.Date getLastModified()
Returns date of the last modification on this document.

For documents from Web data source, this date is as reported in the HTTP header.

Returns:
a Date object.

getLanguage

public java.util.Locale getLanguage()
Returns the document's language.

The Locale object returned only has the language field set.

Returns:
a Locale object

getExcerpt

public java.lang.String getExcerpt()
Return an excerpt of the document, with keywords highlighted.
Returns:
a string that contains HTML markup, null allowed

getAvailableAttributes

public java.util.Collection getAvailableAttributes()
Returns a collection of all the attributes available in this document.
Returns:
a collection of Attribute objects

getAttributeValues

public java.util.Collection getAttributeValues(Attribute att)
Returns all the values associated with an attribute.

The returned array contains either java.lang.String, java.math.BigDecimal, or java.util.Date objects, depending on the type specified in the attribute argument.

The return value can be null if the document does not have the specified attribute, or the attribute was not fetched as one of the return attributes of the query which matched this document.

Parameters:
att - Attribute for which the value is requested.
Returns:
a collection of attribute values, can be null.

getAttribute

public java.lang.Object getAttribute(Attribute att)
Returns a value associated with an attribute.

If there are more than one, the value selected is arbitrary, but usually the first element of the array returned by getAttributeValues(). This method is useful if the attribute is usually associated with only one value. The return value can be of type java.lang.String, java.math.BigDecimal, or java.util.Date; depending on the type specified in the attribute argument. The return value can be null if the document does not have the specified attribute, or the attribute was not included as one of the return attributes of the query which matched this document.

Parameters:
att - Attribute for which the value is requested.
Returns:
one of the associated attribute values, can be null.

getHiliteAttributes

public java.util.Collection getHiliteAttributes()
return all the attributes that are highlighted in this document.
Returns:
a collection of StringAttribute objects

getHiliteAttribute

public java.lang.String getHiliteAttribute(StringAttribute att)
return the highlighted attribute value for a string attribute.
Returns:
a HTML fragment

getHiliteAttributeValues

public java.util.Collection getHiliteAttributeValues(StringAttribute att)
return the highlighted attribute values for a string attribute.
Returns:
a collection of strings, each is a HTML fragment

getGroups

public java.util.Collection getGroups()
Returns the groups this document belongs to.
Returns:
a collection of groups, null if document has no group assignment

Skip navigation links

Oracle® Ultra Search Java API Reference
11g Release 1 (11.1)

B28329-02


Copyright © 2002,2008, Oracle. All Rights Reserved.