Class LuceneSearchResult
- java.lang.Object
 - 
- com.atlassian.confluence.search.v2.AbstractSearchResult
 - 
- com.atlassian.confluence.internal.search.v2.lucene.LuceneSearchResult
 
 
 
- 
- All Implemented Interfaces:
 BaseSearchResult,SearchResult
public class LuceneSearchResult extends AbstractSearchResult
 
- 
- 
Field Summary
- 
Fields inherited from interface com.atlassian.confluence.search.v2.SearchResult
HIGHLIGHT_END, HIGHLIGHT_START 
 - 
 
- 
Constructor Summary
Constructors Constructor Description LuceneSearchResult(org.apache.lucene.document.Document document, Optional<HitHighlighter> maybeHighlighter, Function<String,ConfluenceUser> userLookup)Constructor to create a search result directly from a Lucene documentLuceneSearchResult(org.apache.lucene.document.Document document, Optional<HitHighlighter> maybeHighlighter, Optional<String> maybeExplanation, Function<String,ConfluenceUser> userLookup) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDisplayTitleWithHighlights()Gets the title of the search result appropriate for displaying to a user with matches highlighted.Optional<String>getExplain()Returns query explanation if it is requested seeISearch.isExplain().Set<String>getFieldNames()Return names of all fields of a given document.StringgetFieldValue(String fieldName)Return a string value of a field of a given document, if the field has multiple values then return last value, if there is no such field then return null.Set<String>getFieldValues(String fieldName)Return set of string values of a field of a given document, if the field has single value then return singleton set of that value, if there is no such field then return empty set.longgetHandleId()Get the handle IDStringgetResultExcerptWithHighlights()Gets excerpt from the context of the search result, asSearchResult.getResultExcerpt(), but in a HTML-safe manner.- 
Methods inherited from class com.atlassian.confluence.search.v2.AbstractSearchResult
getContent, getContentVersion, getCreationDate, getCreator, getCreatorUser, getDateResult, getDisplayTitle, getExtraFields, getField, getHandle, getIntegerResult, getLabels, getLastModificationDate, getLastModifier, getLastModifierUser, getLastUpdateDescription, getOwnerTitle, getOwnerType, getPersonalLabels, getResultExcerpt, getResultExcerpt, getSanitisedContent, getSpaceKey, getSpaceName, getStatus, getStringResult, getType, getUrlPath, getUserResult, hasLabels, isHomePage, toString 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
LuceneSearchResult
public LuceneSearchResult(org.apache.lucene.document.Document document, Optional<HitHighlighter> maybeHighlighter, Function<String,ConfluenceUser> userLookup)Constructor to create a search result directly from a Lucene document 
- 
LuceneSearchResult
public LuceneSearchResult(org.apache.lucene.document.Document document, Optional<HitHighlighter> maybeHighlighter, Optional<String> maybeExplanation, Function<String,ConfluenceUser> userLookup) 
 - 
 
- 
Method Detail
- 
getResultExcerptWithHighlights
public String getResultExcerptWithHighlights()
Description copied from interface:SearchResultGets excerpt from the context of the search result, asSearchResult.getResultExcerpt(), but in a HTML-safe manner. Implementations should highlight hits withSearchResult.HIGHLIGHT_STARTandSearchResult.HIGHLIGHT_END. The default implementation simply HTML-encode the result ofSearchResult.getResultExcerpt().- Returns:
 - excerpt of the content of the search result with matches highlighted
 
 
- 
getDisplayTitleWithHighlights
public String getDisplayTitleWithHighlights()
Description copied from interface:SearchResultGets the title of the search result appropriate for displaying to a user with matches highlighted. All results should return something useful for this method.- Returns:
 - the title of the search result appropriate for display on a page with matches highlighted
 
 
- 
getFieldNames
public Set<String> getFieldNames()
Description copied from interface:BaseSearchResultReturn names of all fields of a given document.- Specified by:
 getFieldNamesin interfaceBaseSearchResult- Specified by:
 getFieldNamesin classAbstractSearchResult- Returns:
 - names of all known fields or null
 
 
- 
getFieldValue
public String getFieldValue(String fieldName)
Description copied from class:AbstractSearchResultReturn a string value of a field of a given document, if the field has multiple values then return last value, if there is no such field then return null.- Specified by:
 getFieldValuein classAbstractSearchResult- Returns:
 - a string value of a field
 
 
- 
getHandleId
public long getHandleId()
Description copied from interface:BaseSearchResultGet the handle ID- Returns:
 - the ID of the 
Handleobject 
 
- 
getFieldValues
public Set<String> getFieldValues(String fieldName)
Description copied from class:AbstractSearchResultReturn set of string values of a field of a given document, if the field has single value then return singleton set of that value, if there is no such field then return empty set.- Specified by:
 getFieldValuesin interfaceBaseSearchResult- Specified by:
 getFieldValuesin classAbstractSearchResult- Returns:
 - a string value of a field
 
 
- 
getExplain
public Optional<String> getExplain()
Description copied from interface:SearchResultReturns query explanation if it is requested seeISearch.isExplain(). 
 - 
 
 -