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

java.lang.Object
  extended by com.atlassian.confluence.search.v2.lucene.LuceneSearchResult
All Implemented Interfaces:
SearchResult

public class LuceneSearchResult
extends java.lang.Object
implements SearchResult


Constructor Summary
LuceneSearchResult(org.apache.lucene.search.Hit hit)
          Constructor to create a search result directly from a Lucene hit
LuceneSearchResult(java.util.Map<java.lang.String,java.lang.String> results)
          Helper constructor for use in tests.
 
Method Summary
 java.lang.String getContent()
          Gets the text content of the search result.
 java.util.Date getCreationDate()
           
 java.lang.String getCreator()
           
 java.lang.String getDisplayTitle()
          Gets the title of the search result appropriate for displaying to a user.
 java.util.Map<java.lang.String,java.lang.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.
 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.
 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()
          Gets the username of 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()
           
 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.
 boolean hasLabels()
           
 boolean isHomePage()
          Checks if the search result represents the homepage of a space.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LuceneSearchResult

public LuceneSearchResult(org.apache.lucene.search.Hit hit)
                   throws java.io.IOException
Constructor to create a search result directly from a Lucene hit

Parameters:
hit - the Lucene hit behind this result
Throws:
java.io.IOException - if something goes wrong getting data from the hit

LuceneSearchResult

public LuceneSearchResult(java.util.Map<java.lang.String,java.lang.String> results)
Helper constructor for use in tests. Do not use in real code.

Parameters:
results - the already-converted map of results
Method Detail

getExtraFields

public java.util.Map<java.lang.String,java.lang.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 interface SearchResult
Returns:
Map of additional field names and their values.

getHandle

public com.atlassian.bonnie.Handle getHandle()
Description copied from interface: SearchResult
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 interface SearchResult
Returns:
the handle that can be used to look up the underlying database object.
See Also:
AnyTypeDao.findByHandle(com.atlassian.bonnie.Handle)

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

public java.lang.String getCreator()
Specified by:
getCreator in interface SearchResult

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

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

public java.lang.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 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

hasLabels

public boolean hasLabels()
Specified by:
hasLabels in interface SearchResult
Returns:
true if this search result has labels, false otherwise.

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2003-2010 Atlassian. All Rights Reserved.