Class ProjectedSearchResult
- java.lang.Object
-
- com.atlassian.confluence.search.v2.ProjectedSearchResult
-
- All Implemented Interfaces:
BaseSearchResult
,SearchResult
@ParametersAreNonnullByDefault public class ProjectedSearchResult extends Object implements SearchResult
-
-
Field Summary
-
Fields inherited from interface com.atlassian.confluence.search.v2.SearchResult
HIGHLIGHT_END, HIGHLIGHT_START
-
-
Constructor Summary
Constructors Constructor Description ProjectedSearchResult(SearchResult delegate, Collection<String> requestedFields)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
getContent()
Gets the text content of the search result.Integer
getContentVersion()
Returns the version of the content if available, ornull
if there's no version for this result.Date
getCreationDate()
String
getCreator()
Deprecated.ConfluenceUser
getCreatorUser()
Gets the person who created the entity represented by the search result.String
getDisplayTitle()
Gets the title of the search result appropriate for displaying to a user.String
getDisplayTitleWithHighlights()
Gets the title of the search result appropriate for displaying to a user with matches highlighted.Map<String,String>
getExtraFields()
If the retrieved documents contain additional fields that cannot be directly accessed by this interface then they can be retrieved via this method.String
getField(String fieldName)
Returns the contents of the field as a string.Set<String>
getFieldNames()
Return names of all fields of a given document.Set<String>
getFieldValues(String fieldName)
Return set of string values of a field of a given document, if the field has single value then return singleton set of that value, if there is no such field then return empty set.Handle
getHandle()
Retrieves the handle that can then be used by the AnyTypeDao to retrieve the database object referenced by this search result.long
getHandleId()
Get the handle IDSet<String>
getLabels(com.atlassian.user.User user)
Gets the labels on the current search result that are visible to the specified user.Date
getLastModificationDate()
Gets the last modification date of the entity represented by the search result.String
getLastModifier()
Deprecated.ConfluenceUser
getLastModifierUser()
Gets the last person to modify the entity represented by the search result.String
getLastUpdateDescription()
Gets some string describing the last modification to this content.String
getOwnerTitle()
If this result represents an attachment then this field will return the title of the page or blog post the attachment is attached to.String
getOwnerType()
If this result represents an attachment then this field will return the type of the container, a page or blogpost.Set<String>
getPersonalLabels()
Gets all the personal labels on the current search result.String
getResultExcerpt()
Gets excerpt from the context of the search result.String
getResultExcerptWithHighlights()
Gets excerpt from the context of the search result, asSearchResult.getResultExcerpt()
, but in a HTML-safe manner.String
getSpaceKey()
String
getSpaceName()
String
getStatus()
Gets a string representation of the entity status represented by the search result.String
getType()
Gets a string representation of the type of the entity represented by the search result.String
getUrlPath()
Gets the URL path to the search result, relative to the site's context root.boolean
hasLabels()
boolean
isHomePage()
Checks if the search result represents the homepage of a space.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.confluence.search.v2.SearchResult
getExplain
-
-
-
-
Constructor Detail
-
ProjectedSearchResult
public ProjectedSearchResult(SearchResult delegate, Collection<String> requestedFields)
-
-
Method Detail
-
getExtraFields
public Map<String,String> getExtraFields()
Description copied from interface:SearchResult
If the retrieved documents contain additional fields that cannot be directly accessed by this interface then they can be retrieved via this method.The field names are abstracted from the underlying search implementation and will be centrally defined. Their values are not yet documented.
- Specified by:
getExtraFields
in interfaceSearchResult
- Returns:
- Map of additional field names and their values.
-
getResultExcerpt
public String getResultExcerpt()
Description copied from interface:SearchResult
Gets excerpt from the context of the search result. Implementation could choose how to generate the result excerpts, for example, concatenated fragments of the document content where hits are found, or simply the first few words of the document.- Specified by:
getResultExcerpt
in interfaceSearchResult
- Returns:
- excerpt of the content of the search result
-
getResultExcerptWithHighlights
public String getResultExcerptWithHighlights()
Description copied from interface:SearchResult
Gets excerpt from the context of the search result, asSearchResult.getResultExcerpt()
, but in a HTML-safe manner. Implementations should highlight hits withSearchResult.HIGHLIGHT_START
andSearchResult.HIGHLIGHT_END
. The default implementation simply HTML-encode the result ofSearchResult.getResultExcerpt()
.- Specified by:
getResultExcerptWithHighlights
in interfaceSearchResult
- Returns:
- excerpt of the content of the search result with matches highlighted
-
getDisplayTitleWithHighlights
public String getDisplayTitleWithHighlights()
Description copied from interface:SearchResult
Gets the title of the search result appropriate for displaying to a user with matches highlighted. All results should return something useful for this method.- Specified by:
getDisplayTitleWithHighlights
in interfaceSearchResult
- Returns:
- the title of the search result appropriate for display on a page with matches highlighted
-
getContent
public String getContent()
Description copied from interface:SearchResult
Gets the text content of the search result.- Specified by:
getContent
in interfaceSearchResult
- Returns:
- the text content of the search result
-
getType
public String getType()
Description copied from interface:SearchResult
Gets a string representation of the type of the entity represented by the search result. If the entity is a content object, this is the value ofContentEntityObject.getType()
- Specified by:
getType
in interfaceSearchResult
- Returns:
- the type of the entity represented as a string, or null if no such type can be determined
- See Also:
ContentTypeAware.getType()
-
getStatus
public final String getStatus()
Description copied from interface:SearchResult
Gets a string representation of the entity status represented by the search result. If the entity is a content object, this is the value ofContentEntityObject.getContentStatus()
- Specified by:
getStatus
in interfaceSearchResult
- Returns:
- the status of the entity
-
isHomePage
public boolean isHomePage()
Description copied from interface:SearchResult
Checks if the search result represents the homepage of a space.- Specified by:
isHomePage
in interfaceSearchResult
- Returns:
- true if the result represents the homepage of a space
-
getLastModificationDate
public Date getLastModificationDate()
Description copied from interface:SearchResult
Gets the last modification date of the entity represented by the search result.- Specified by:
getLastModificationDate
in interfaceSearchResult
- Returns:
- the last modification date of the entity
-
getLastModifier
@Deprecated public String getLastModifier()
Deprecated.- Specified by:
getLastModifier
in interfaceSearchResult
-
getLastModifierUser
public ConfluenceUser getLastModifierUser()
Description copied from interface:SearchResult
Gets the last person to modify the entity represented by the search result.- Specified by:
getLastModifierUser
in interfaceSearchResult
- Returns:
- the result's last modifier
-
getDisplayTitle
public String getDisplayTitle()
Description copied from interface:SearchResult
Gets the title of the search result appropriate for displaying to a user. All results should return something useful for this method.- Specified by:
getDisplayTitle
in interfaceSearchResult
- Returns:
- the title of the search result appropriate for display on a page
- See Also:
Addressable.getDisplayTitle()
-
getUrlPath
public String getUrlPath()
Description copied from interface:SearchResult
Gets the URL path to the search result, relative to the site's context root. All results should return something useful for this method- Specified by:
getUrlPath
in interfaceSearchResult
- Returns:
- the URL path to the search result
- See Also:
Addressable.getUrlPath()
-
getLastUpdateDescription
public String getLastUpdateDescription()
Description copied from interface:SearchResult
Gets some string describing the last modification to this content. May be null if no such string is available. For content objects, this will be the same as the "version comment"This string is user-supplied, and therefore not internationalised
- Specified by:
getLastUpdateDescription
in interfaceSearchResult
- Returns:
- a string describing the last modification to the content
- See Also:
ContentEntityObject.getVersionComment()
-
getSpaceName
public String getSpaceName()
- Specified by:
getSpaceName
in interfaceSearchResult
- Returns:
- the name of the space that contains this search result.
-
getSpaceKey
public String getSpaceKey()
- Specified by:
getSpaceKey
in interfaceSearchResult
- Returns:
- the key of the space that contains this search result
-
hasLabels
public boolean hasLabels()
- Specified by:
hasLabels
in interfaceSearchResult
- Returns:
- true if this search result has labels, false otherwise.
-
getLabels
public Set<String> getLabels(com.atlassian.user.User user)
Description copied from interface:SearchResult
Gets the labels on the current search result that are visible to the specified user.- Specified by:
getLabels
in interfaceSearchResult
- Parameters:
user
- filter labels by this user- Returns:
- the labels on the current search result that are visible to the specified user.
-
getPersonalLabels
public Set<String> getPersonalLabels()
Description copied from interface:SearchResult
Gets all the personal labels on the current search result.- Specified by:
getPersonalLabels
in interfaceSearchResult
- Returns:
- all the personal labels on the current search result
-
getCreationDate
public Date getCreationDate()
- Specified by:
getCreationDate
in interfaceSearchResult
-
getCreator
@Deprecated public String getCreator()
Deprecated.- Specified by:
getCreator
in interfaceSearchResult
-
getCreatorUser
public ConfluenceUser getCreatorUser()
Description copied from interface:SearchResult
Gets the person who created the entity represented by the search result.- Specified by:
getCreatorUser
in interfaceSearchResult
- Returns:
- the result's creator
-
getOwnerType
public String getOwnerType()
Description copied from interface:SearchResult
If this result represents an attachment then this field will return the type of the container, a page or blogpost.- Specified by:
getOwnerType
in interfaceSearchResult
- Returns:
- the owner type
-
getOwnerTitle
public String getOwnerTitle()
Description copied from interface:SearchResult
If this result represents an attachment then this field will return the title of the page or blog post the attachment is attached to.- Specified by:
getOwnerTitle
in interfaceSearchResult
- Returns:
- the owner title
-
getContentVersion
public Integer getContentVersion() throws NumberFormatException
Description copied from interface:SearchResult
Returns the version of the content if available, ornull
if there's no version for this result.- Specified by:
getContentVersion
in interfaceSearchResult
- Throws:
NumberFormatException
- if the document in the index has an unparseable version number
-
getHandle
public Handle getHandle()
Description copied from interface:BaseSearchResult
Retrieves the handle that can then be used by the AnyTypeDao to retrieve the database object referenced by this search result.Because the database and index are not updated at the same time, it is possible for a deleted entity to still be represented in the search index. Do not assume that this handle will always refer to a live object.
- Specified by:
getHandle
in interfaceBaseSearchResult
- Returns:
- the handle that can be used to look up the underlying database object.
- See Also:
AnyTypeDao.findByHandle(com.atlassian.bonnie.Handle)
-
getHandleId
public long getHandleId()
Description copied from interface:BaseSearchResult
Get the handle ID- Specified by:
getHandleId
in interfaceBaseSearchResult
- Returns:
- the ID of the
Handle
object
-
getFieldNames
public Set<String> getFieldNames()
Description copied from interface:BaseSearchResult
Return names of all fields of a given document.- Specified by:
getFieldNames
in interfaceBaseSearchResult
- Returns:
- names of all known fields or null
-
getField
public String getField(String fieldName)
Description copied from interface:BaseSearchResult
Returns the contents of the field as a string. This method will return null if there is no content for the field or the field does not exist. FieldName is case sensitive.- Specified by:
getField
in interfaceBaseSearchResult
- Returns:
- the field value or null.
-
getFieldValues
public Set<String> getFieldValues(String fieldName)
Description copied from interface:BaseSearchResult
Return set of string values of a field of a given document, if the field has single value then return singleton set of that value, if there is no such field then return empty set.- Specified by:
getFieldValues
in interfaceBaseSearchResult
- Returns:
- the field values or null.
-
-