Package org.opencms.search
Class CmsSearchResult
java.lang.Object
org.opencms.search.CmsSearchResult
- All Implemented Interfaces:
Comparable<CmsSearchResult>
,I_CmsMemoryMonitorable
public class CmsSearchResult
extends Object
implements I_CmsMemoryMonitorable, Comparable<CmsSearchResult>
Contains the data of a single item in a search result.
- Since:
- 6.0.0
-
Field Summary
Modifier and TypeFieldDescriptionprotected Date
The creation date of this search result.protected Date
The last modification date of this search result.protected String
The document type of the search result.protected String
The excerpt of this search result.Holds the values of the search result fields.protected String
The resource path of this search result.protected int
The score of this search result. -
Constructor Summary
ModifierConstructorDescriptionprotected
Empty constructor to be used for overriding classes.CmsSearchResult
(int score, org.apache.lucene.document.Document doc, String excerpt) Creates a new search result. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(CmsSearchResult obj) boolean
Returns the date created.Returns the date last modified.Deprecated.Returns the document type of the search result document.Returns the excerpt.Returns the text stored in the search index field with the given name.Deprecated.usegetField(String)
instead with the name of the field, for example useCmsSearchField.FIELD_KEYWORDS
to get the keywords (if available)int
Returns the memory size of the object.getPath()
Returns the path.int
getScore()
Returns the score.getTitle()
Deprecated.usegetField(String)
instead with the name of the field, for example useCmsSearchField.FIELD_TITLE
to get the title (if available)int
hashCode()
-
Field Details
-
m_dateCreated
The creation date of this search result. -
m_dateLastModified
The last modification date of this search result. -
m_documentType
The document type of the search result. -
m_excerpt
The excerpt of this search result. -
m_fields
Holds the values of the search result fields. -
m_path
The resource path of this search result. -
m_score
The score of this search result.
-
-
Constructor Details
-
CmsSearchResult
Creates a new search result.- Parameters:
score
- the score of this search resultdoc
- the Lucene document to extract fields from such as description, title, key words etc. pp.excerpt
- the excerpt of the search result's content
-
CmsSearchResult
protected CmsSearchResult()Empty constructor to be used for overriding classes.
-
-
Method Details
-
compareTo
- Specified by:
compareTo
in interfaceComparable<CmsSearchResult>
- See Also:
-
equals
-
getDateCreated
Returns the date created.- Returns:
- the date created
-
getDateLastModified
Returns the date last modified.- Returns:
- the date last modified
-
getDescription
Deprecated.usegetField(String)
instead with the name of the field, for example useCmsSearchField.FIELD_DESCRIPTION
to get the description (if available)Returns the description.- Returns:
- the description
-
getDocumentType
Returns the document type of the search result document.Usually this will be a VFS resource type String that can be used in the resource type manager with
CmsResourceManager.getResourceType(String)
. However, what is stored in the document type field depends only on the indexer used, and therefore it may also be some String not referring a VFS resource type but some external type or application. It may also benull
in case it has not been set by a non-standard indexer.- Returns:
- the document type of the search result document
- See Also:
-
getExcerpt
Returns the excerpt.- Returns:
- the excerpt
-
getField
Returns the text stored in the search index field with the given name.- Parameters:
fieldName
- the name of the field to get the stored text for- Returns:
- the text stored in the search index field with the given name
-
getKeywords
Deprecated.usegetField(String)
instead with the name of the field, for example useCmsSearchField.FIELD_KEYWORDS
to get the keywords (if available)Returns the key words.- Returns:
- the key words
-
getMemorySize
Description copied from interface:I_CmsMemoryMonitorable
Returns the memory size of the object.- Specified by:
getMemorySize
in interfaceI_CmsMemoryMonitorable
- Returns:
- the memory size of the object
- See Also:
-
getPath
Returns the path.- Returns:
- the path
-
getScore
Returns the score.- Returns:
- the score
-
getTitle
Deprecated.usegetField(String)
instead with the name of the field, for example useCmsSearchField.FIELD_TITLE
to get the title (if available)Returns the title.- Returns:
- the title
-
hashCode
-
getField(String)
instead with the name of the field, for example useCmsSearchField.FIELD_DESCRIPTION
to get the description (if available)