com.atlassian.confluence.search.v2.lucene
Class AbstractLuceneSearchResult

java.lang.Object
  extended by com.atlassian.confluence.search.v2.lucene.AbstractLuceneSearchResult
All Implemented Interfaces:
BaseSearchResult, SearchResult
Direct Known Subclasses:
LuceneSearchResult

public abstract class AbstractLuceneSearchResult
extends java.lang.Object
implements SearchResult


Constructor Summary
AbstractLuceneSearchResult()
          Deprecated. since 5.2. Use AbstractLuceneSearchResult(com.google.common.base.Function)
AbstractLuceneSearchResult(com.google.common.base.Function<java.lang.String,ConfluenceUser> userLookup)
           
 
Method Summary
 java.lang.String getContent()
          Gets the text content of the search result.
 java.lang.Integer getContentVersion()
          Returns the version of the content if available, or null if there's no version for this result.
 java.util.Date getCreationDate()
           
 java.lang.String getCreator()
          Deprecated. 
 ConfluenceUser getCreatorUser()
          Gets the person who created the entity represented by the search result.
protected  java.util.Date getDateResult(java.lang.String key)
           
 java.lang.String getDisplayTitle()
          Gets the title of the search result appropriate for displaying to a user.
protected  java.lang.Integer getIntegerResult(java.lang.String fieldName)
           
 java.util.Set<java.lang.String> getLabels(com.atlassian.user.User user)
          Gets the labels on the current search result that are visible to the specified user.
 java.util.Date getLastModificationDate()
          Gets the last modification date of the entity represented by the search result.
 java.lang.String getLastModifier()
          Deprecated. 
 ConfluenceUser getLastModifierUser()
          Gets the last person to modify the entity represented by the search result.
 java.lang.String getLastUpdateDescription()
          Gets some string describing the last modification to this content.
 java.lang.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.
 java.lang.String getOwnerType()
          If this result represents an attachment then this field will return the type of the container, a page or blogpost.
 java.util.Set<java.lang.String> getPersonalLabels()
          Gets all the personal labels on the current search result.
 java.lang.String getSpaceKey()
           
 java.lang.String getSpaceName()
           
protected  java.lang.String getStringResult(java.lang.String... fieldNames)
          Retrieves the value for the specified field name.
 java.lang.String getType()
          Gets a string representation of the type of the entity represented by the search result.
 java.lang.String getUrlPath()
          Gets the URL path to the search result, relative to the site's context root.
protected  ConfluenceUser getUserResult(java.lang.String fieldName)
          Attempts to resolve the contents of the given field as a ConfluenceUser.
protected  boolean hasLabels(java.util.Map<java.lang.String,?> results)
           
 boolean isHomePage()
          Checks if the search result represents the homepage of a space.
protected  java.util.Map<java.lang.String,java.lang.String> mapExtraFields()
           
protected  void populatePersonalLabels(org.apache.lucene.document.Document document)
           
 
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
getExtraFields, hasLabels
 
Methods inherited from interface com.atlassian.confluence.search.v2.BaseSearchResult
getField, getHandle, isFieldRequested
 

Constructor Detail

AbstractLuceneSearchResult

public AbstractLuceneSearchResult(com.google.common.base.Function<java.lang.String,ConfluenceUser> userLookup)

AbstractLuceneSearchResult

@Deprecated
public AbstractLuceneSearchResult()
Deprecated. since 5.2. Use AbstractLuceneSearchResult(com.google.common.base.Function)

Method Detail

populatePersonalLabels

protected void populatePersonalLabels(org.apache.lucene.document.Document document)

hasLabels

protected boolean hasLabels(java.util.Map<java.lang.String,?> results)

getLabels

public java.util.Set<java.lang.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 interface SearchResult
Parameters:
user - filter labels by this user
Returns:
the labels on the current search result that are visible to the specified user.

getPersonalLabels

public java.util.Set<java.lang.String> getPersonalLabels()
Description copied from interface: SearchResult
Gets all the personal labels on the current search result.

Specified by:
getPersonalLabels in interface SearchResult
Returns:
all the personal labels on the current search result

getContent

public java.lang.String getContent()
Description copied from interface: SearchResult
Gets the text content of the search result.

Specified by:
getContent in interface SearchResult
Returns:
the text content of the search result

getType

public java.lang.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 of ContentEntityObject.getType()

Specified by:
getType in interface SearchResult
Returns:
the type of the entity represented as a string, or null if no such type can be determined
See Also:
ContentTypeAware.getType()

isHomePage

public boolean isHomePage()
Description copied from interface: SearchResult
Checks if the search result represents the homepage of a space.

Specified by:
isHomePage in interface SearchResult
Returns:
true if the result represents the homepage of a space

getCreationDate

public java.util.Date getCreationDate()
Specified by:
getCreationDate in interface SearchResult

getCreator

@Deprecated
public java.lang.String getCreator()
Deprecated. 

Specified by:
getCreator in interface SearchResult

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 interface SearchResult
Returns:
the result's creator

getOwnerType

public java.lang.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 interface SearchResult
Returns:
the owner type

getOwnerTitle

public java.lang.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 interface SearchResult
Returns:
the owner title

getContentVersion

public java.lang.Integer getContentVersion()
Description copied from interface: SearchResult
Returns the version of the content if available, or null if there's no version for this result.

Specified by:
getContentVersion in interface SearchResult

getLastModificationDate

public java.util.Date getLastModificationDate()
Description copied from interface: SearchResult
Gets the last modification date of the entity represented by the search result.

Specified by:
getLastModificationDate in interface SearchResult
Returns:
the last modification date of the entity

getLastModifier

@Deprecated
public java.lang.String getLastModifier()
Deprecated. 

Specified by:
getLastModifier in interface SearchResult

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 interface SearchResult
Returns:
the result's last modifier

getDisplayTitle

public java.lang.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 interface SearchResult
Returns:
the title of the search result appropriate for display on a page
See Also:
Addressable.getDisplayTitle()

getUrlPath

public java.lang.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 interface SearchResult
Returns:
the URL path to the search result
See Also:
Addressable.getUrlPath()

getLastUpdateDescription

public java.lang.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 interface SearchResult
Returns:
a string describing the last modification to the content
See Also:
ContentEntityObject.getVersionComment()

getSpaceName

public java.lang.String getSpaceName()
Specified by:
getSpaceName in interface SearchResult
Returns:
the name of the space that contains this search result.

getSpaceKey

public java.lang.String getSpaceKey()
Specified by:
getSpaceKey in interface SearchResult
Returns:
the key of the space that contains this search result

getStringResult

protected java.lang.String getStringResult(java.lang.String... fieldNames)
Retrieves the value for the specified field name. If more than one field name is provided, it will attempt to retrieve a value for each field in order, returning as soon as a non-null value is encountered.

Parameters:
fieldNames - field name(s) to retrieve a value for
Returns:
the first non-null value associated with the ordered list of field names passed in

getUserResult

protected ConfluenceUser getUserResult(java.lang.String fieldName)
Attempts to resolve the contents of the given field as a 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).

Since:
5.2

getDateResult

protected java.util.Date getDateResult(java.lang.String key)

getIntegerResult

protected java.lang.Integer getIntegerResult(java.lang.String fieldName)

mapExtraFields

protected java.util.Map<java.lang.String,java.lang.String> mapExtraFields()


Copyright © 2003-2014 Atlassian. All Rights Reserved.