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 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.
 com.atlassian.bonnie.Handle getHandle()
          Retrieves the handle that can then be used by the AnyTypeObjectDao to retrieve the database object referenced by this search result.
 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 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 isHomePage()
          Checks if the search result represents the homepage of a space.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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 results)
Helper constructor for use in tests. Do not use in real code.

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

getHandle

public com.atlassian.bonnie.Handle getHandle()
Description copied from interface: SearchResult
Retrieves the handle that can then be used by the AnyTypeObjectDao 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:
AnyTypeObjectDao.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:
Addressable.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

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()


Copyright © 2003-2008 Atlassian Pty Ltd. All Rights Reserved.