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

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

public class LuceneSearchResult
extends AbstractLuceneSearchResult


Constructor Summary
LuceneSearchResult(org.apache.lucene.document.Document document)
          Constructor to create a search result directly from a Lucene hit
LuceneSearchResult(Map<String,String> results)
          Helper constructor for use in tests.
 
Method Summary
 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.
 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.
 boolean hasLabels()
           
 boolean isFieldRequested(String fieldName)
          check to see if this SearchFieldName has been requested during the search, if this method returns false then getField will throw a FieldNotRequestedException
 String toString()
           
 
Methods inherited from class com.atlassian.confluence.search.v2.lucene.AbstractLuceneSearchResult
getContent, getContentVersion, getCreationDate, getCreator, getDateResult, getDisplayTitle, getIntegerResult, getLabels, getLastModificationDate, getLastModifier, getLastUpdateDescription, getOwnerTitle, getOwnerType, getPersonalLabels, getSpaceKey, getSpaceName, getStringResult, getType, getUrlPath, hasLabels, isHomePage, mapExtraFields, populatePersonalLabels
 
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.document.Document document)
                   throws IOException
Constructor to create a search result directly from a Lucene hit

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

LuceneSearchResult

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

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

hasLabels

public boolean hasLabels()
Returns:
true if this search result has labels, false otherwise.

getExtraFields

public Map<String,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.

Returns:
Map of additional field names and their values.

getHandle

public com.atlassian.bonnie.Handle getHandle()
Description copied from interface: BaseSearchResult
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.

Returns:
the handle that can be used to look up the underlying database object.
See Also:
AnyTypeDao.findByHandle(com.atlassian.bonnie.Handle)

getField

public String getField(String fieldName)
Description copied from interface: BaseSearchResult
Returns the contents of the field as a string. This method will return null if there is no content for the field or the field does not exist. FieldName is case sensitive.

Returns:
the field value or null if the field has been requested but has no value.

toString

public String toString()
Overrides:
toString in class Object

isFieldRequested

public boolean isFieldRequested(String fieldName)
Description copied from interface: BaseSearchResult
check to see if this SearchFieldName has been requested during the search, if this method returns false then getField will throw a FieldNotRequestedException

Returns:


Copyright © 2003-2011 Atlassian. All Rights Reserved.