public abstract class AbstractSearchResult extends Object implements SearchResult
HIGHLIGHT_END, HIGHLIGHT_START| 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 |
getResultExcerpt()
Gets excerpt from the context of the search result.
|
protected String |
getResultExcerpt(int maxLength) |
protected String |
getSanitisedContent() |
String |
getSpaceKey() |
String |
getSpaceName() |
String |
getStatus()
Gets a string representation of the entity status represented by the search result.
|
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, waitgetDisplayTitleWithHighlights, getExplain, getResultExcerptWithHighlightsisFieldRequestedpublic AbstractSearchResult(com.google.common.base.Function<String,ConfluenceUser> userLookup)
public Set<String> getLabels(com.atlassian.user.User user)
SearchResultgetLabels in interface SearchResultuser - filter labels by this userpublic Set<String> getPersonalLabels()
SearchResultgetPersonalLabels in interface SearchResultpublic String getContent()
SearchResultgetContent in interface SearchResultprotected String getSanitisedContent()
protected String getResultExcerpt(int maxLength)
public String getResultExcerpt()
SearchResultgetResultExcerpt in interface SearchResultpublic String getType()
SearchResultContentEntityObject.getType()getType in interface SearchResultContentTypeAware.getType()public String getStatus()
SearchResultContentEntityObject.getContentStatus()getStatus in interface SearchResultpublic boolean isHomePage()
SearchResultisHomePage in interface SearchResultpublic Date getCreationDate()
getCreationDate in interface SearchResult@Deprecated public String getCreator()
getCreator in interface SearchResultpublic ConfluenceUser getCreatorUser()
SearchResultgetCreatorUser in interface SearchResultpublic String getOwnerType()
SearchResultgetOwnerType in interface SearchResultpublic String getOwnerTitle()
SearchResultgetOwnerTitle in interface SearchResultpublic Integer getContentVersion()
SearchResultnull if there's no version for this result.getContentVersion in interface SearchResultpublic Date getLastModificationDate()
SearchResultgetLastModificationDate in interface SearchResult@Deprecated public String getLastModifier()
getLastModifier in interface SearchResultpublic ConfluenceUser getLastModifierUser()
SearchResultgetLastModifierUser in interface SearchResultpublic String getDisplayTitle()
SearchResultgetDisplayTitle in interface SearchResultAddressable.getDisplayTitle()public String getUrlPath()
SearchResultgetUrlPath in interface SearchResultAddressable.getUrlPath()public String getLastUpdateDescription()
SearchResult
This string is user-supplied, and therefore not internationalised
getLastUpdateDescription in interface SearchResultContentEntityObject.getVersionComment()public String getSpaceName()
getSpaceName in interface SearchResultpublic String getSpaceKey()
getSpaceKey in interface SearchResultpublic boolean hasLabels()
hasLabels in interface SearchResultpublic Map<String,String> getExtraFields()
SearchResultThe field names are abstracted from the underlying search implementation and will be centrally defined. Their values are not yet documented.
getExtraFields in interface SearchResultpublic com.atlassian.bonnie.Handle getHandle()
BaseSearchResultBecause 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 BaseSearchResultAnyTypeDao.findByHandle(com.atlassian.bonnie.Handle)public String getField(String fieldName)
BaseSearchResultgetField in interface BaseSearchResultpublic abstract String getFieldValue(String fieldName)
public abstract Set<String> getFieldValues(String fieldName)
getFieldValues in interface BaseSearchResultprotected 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–2019 Atlassian. All rights reserved.