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 Object
implements SearchResult


Constructor Summary
AbstractLuceneSearchResult()
           
 
Method Summary
 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()
           
protected  Date getDateResult(String key)
           
 String getDisplayTitle()
          Gets the title of the search result appropriate for displaying to a user.
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()
          Gets the username of 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  boolean hasLabels(Map<String,?> results)
           
 boolean isHomePage()
          Checks if the search result represents the homepage of a space.
protected  Map<String,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()
Method Detail

populatePersonalLabels

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

hasLabels

protected boolean hasLabels(Map<String,?> results)

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 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 Set<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 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 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 Date getCreationDate()
Specified by:
getCreationDate in interface SearchResult

getCreator

public String getCreator()
Specified by:
getCreator in interface SearchResult

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 interface SearchResult
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 interface SearchResult
Returns:
the owner title

getContentVersion

public 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 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

public String getLastModifier()
Description copied from interface: SearchResult
Gets the username of the last person to modify the entity represented by the search result.

Specified by:
getLastModifier in interface SearchResult
Returns:
the username of 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 interface SearchResult
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 interface SearchResult
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 interface SearchResult
Returns:
a string describing the last modification to the content
See Also:
ContentEntityObject.getVersionComment()

getSpaceName

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

getSpaceKey

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

getStringResult

protected String getStringResult(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

getDateResult

protected Date getDateResult(String key)

getIntegerResult

protected Integer getIntegerResult(String fieldName)

mapExtraFields

protected Map<String,String> mapExtraFields()


Copyright © 2003-2012 Atlassian. All Rights Reserved.