public abstract class AbstractSearchResult extends Object implements SearchResult
Constructor and Description |
---|
AbstractSearchResult(com.google.common.base.Function<String,ConfluenceUser> userLookup) |
Modifier and Type | Method and Description |
---|---|
String |
getContent()
Gets the text content of the search result.
|
Integer |
getContentVersion()
Returns the version of the content if available, or
null 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.
|
protected Date |
getDateResult(String key) |
String |
getDisplayTitle()
Gets the title of the search result appropriate for displaying to a user.
|
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.
|
abstract String |
getFieldValue(String fieldName)
Return a string value of a field of a given document, if the field has multiple values then return last value,
if there is no such field then return null.
|
abstract 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.
|
com.atlassian.bonnie.Handle |
getHandle()
Retrieves the handle that can then be used by the AnyTypeDao to retrieve the database object referenced by this
search result.
|
protected Integer |
getIntegerResult(String fieldName) |
Set<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 |
getSpaceKey() |
String |
getSpaceName() |
protected String |
getStringResult(String... fieldNames)
Retrieves the value for the specified field name.
|
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.
|
protected ConfluenceUser |
getUserResult(String fieldName)
Attempts to resolve the contents of the given field as a
ConfluenceUser . |
boolean |
hasLabels() |
boolean |
isHomePage()
Checks if the search result represents the homepage of a space.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isFieldRequested
public AbstractSearchResult(com.google.common.base.Function<String,ConfluenceUser> userLookup)
public Set<String> getLabels(com.atlassian.user.User user)
SearchResult
getLabels
in interface SearchResult
user
- filter labels by this userpublic Set<String> getPersonalLabels()
SearchResult
getPersonalLabels
in interface SearchResult
public String getContent()
SearchResult
getContent
in interface SearchResult
public String getType()
SearchResult
ContentEntityObject.getType()
getType
in interface SearchResult
ContentTypeAware.getType()
public boolean isHomePage()
SearchResult
isHomePage
in interface SearchResult
public Date getCreationDate()
getCreationDate
in interface SearchResult
@Deprecated public String getCreator()
getCreator
in interface SearchResult
public ConfluenceUser getCreatorUser()
SearchResult
getCreatorUser
in interface SearchResult
public String getOwnerType()
SearchResult
getOwnerType
in interface SearchResult
public String getOwnerTitle()
SearchResult
getOwnerTitle
in interface SearchResult
public Integer getContentVersion()
SearchResult
null
if there's no version for this result.getContentVersion
in interface SearchResult
public Date getLastModificationDate()
SearchResult
getLastModificationDate
in interface SearchResult
@Deprecated public String getLastModifier()
getLastModifier
in interface SearchResult
public ConfluenceUser getLastModifierUser()
SearchResult
getLastModifierUser
in interface SearchResult
public String getDisplayTitle()
SearchResult
getDisplayTitle
in interface SearchResult
Addressable.getDisplayTitle()
public String getUrlPath()
SearchResult
getUrlPath
in interface SearchResult
Addressable.getUrlPath()
public String getLastUpdateDescription()
SearchResult
This string is user-supplied, and therefore not internationalised
getLastUpdateDescription
in interface SearchResult
ContentEntityObject.getVersionComment()
public String getSpaceName()
getSpaceName
in interface SearchResult
public String getSpaceKey()
getSpaceKey
in interface SearchResult
public boolean hasLabels()
hasLabels
in interface SearchResult
public Map<String,String> getExtraFields()
SearchResult
The field names are abstracted from the underlying search implementation and will be centrally defined. Their values are not yet documented.
getExtraFields
in interface SearchResult
public com.atlassian.bonnie.Handle getHandle()
BaseSearchResult
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.
getHandle
in interface BaseSearchResult
AnyTypeDao.findByHandle(com.atlassian.bonnie.Handle)
public String getField(String fieldName)
BaseSearchResult
getField
in interface BaseSearchResult
public abstract String getFieldValue(String fieldName)
public abstract Set<String> getFieldValues(String fieldName)
protected String getStringResult(String... fieldNames)
fieldNames
- field name(s) to retrieve a value forprotected ConfluenceUser getUserResult(String fieldName)
ConfluenceUser
. The method first attempts to
resolve the user using the field value as a UserKey
. If that fails, it tries to resolve the user using
the field value as a username. If that fails, it returns null. This is necessary because the same DocumentFieldName.LAST_MODIFIER_NAME
and ContentEntityMetadataExtractor.CREATOR_NAME_FIELD
fields are
used both to store userkeys (post-upgrade) and usernames (pre-upgrade).Copyright © 2003–2016 Atlassian. All rights reserved.