org.opencms.search
Class CmsSearchResource

java.lang.Object
  extended by org.opencms.file.CmsResource
      extended by org.opencms.search.CmsSearchResource
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<I_CmsResource>, I_CmsResource

public class CmsSearchResource
extends CmsResource

A resource implementation that combines the Solr document together with a OpenCms VFS resource.

Since:
8.5.0
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.opencms.file.CmsResource
CmsResource.CmsResourceCopyMode, CmsResource.CmsResourceDeleteMode, CmsResource.CmsResourceUndoMode
 
Nested classes/interfaces inherited from interface org.opencms.file.I_CmsResource
I_CmsResource.CmsResourceAttribute
 
Field Summary
 
Fields inherited from class org.opencms.file.CmsResource
COPY_AS_NEW, COPY_AS_SIBLING, COPY_PRESERVE_SIBLING, DATE_EXPIRED_DEFAULT, DATE_RELEASED_DEFAULT, DATE_RELEASED_EXPIRED_IGNORE, DELETE_PRESERVE_SIBLINGS, DELETE_REMOVE_SIBLINGS, FLAG_INTERNAL, FLAG_LABELED, FLAG_TEMPFILE, m_dateContent, m_length, NAME_CONSTRAINTS, STATE_CHANGED, STATE_DELETED, STATE_KEEP, STATE_NEW, STATE_UNCHANGED, TEMP_FILE_PREFIX, TOUCH_DATE_UNCHANGED, UNDO_CONTENT, UNDO_CONTENT_RECURSIVE, UNDO_MOVE_CONTENT, UNDO_MOVE_CONTENT_RECURSIVE, VFS_FOLDER_SITES, VFS_FOLDER_SYSTEM
 
Fields inherited from interface org.opencms.file.I_CmsResource
COMPARE_DATE_LAST_MODIFIED, COMPARE_DATE_RELEASED, COMPARE_ROOT_PATH, COMPARE_ROOT_PATH_IGNORE_CASE, COMPARE_ROOT_PATH_IGNORE_CASE_FOLDERS_FIRST
 
Constructor Summary
CmsSearchResource(CmsResource resource, I_CmsSearchDocument doc)
          Constructor, creates a new file Object from the given resource with an empty byte array as file content, if the resource does not implement a file.
CmsSearchResource(CmsUUID structureId, CmsUUID resourceId, java.lang.String path, int type, int flags, CmsUUID projectId, CmsResourceState state, long dateCreated, CmsUUID userCreated, long dateLastModified, CmsUUID userLastModified, long dateReleased, long dateExpired, int linkCount, int length, long dateContent, int version, I_CmsSearchDocument doc)
          Constructor, creates a new file object.
 
Method Summary
 java.util.Date getDateField(java.lang.String fieldName)
          Delegator.
 I_CmsSearchDocument getDocument()
          Returns the document.
 java.lang.String getField(java.lang.String fieldName)
          Delegator.
 java.util.List<java.lang.String> getMultivaluedField(java.lang.String fieldName)
          Delegator.
 int getScore(float maxScore)
          Delegator.
 
Methods inherited from class org.opencms.file.CmsResource
checkResourceName, clone, compareTo, equals, getCopy, getDateContent, getDateCreated, getDateExpired, getDateLastModified, getDateReleased, getFlags, getFolderPath, getLength, getName, getName, getParentFolder, getPathLevel, getPathPart, getProjectLastModified, getResourceId, getRootPath, getSiblingCount, getState, getStructureId, getTypeId, getUserCreated, getUserLastModified, getVersion, hashCode, isExpired, isFile, isFolder, isFolder, isInternal, isLabeled, isReleased, isReleasedAndNotExpired, isTemporaryFile, isTemporaryFileName, isTouched, setDateExpired, setDateLastModified, setDateReleased, setFlags, setState, setType, setUserLastModified, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CmsSearchResource

public CmsSearchResource(CmsResource resource,
                         I_CmsSearchDocument doc)
Constructor, creates a new file Object from the given resource with an empty byte array as file content, if the resource does not implement a file.

Parameters:
resource - the base resource object to create a file from
doc - the search document

CmsSearchResource

public CmsSearchResource(CmsUUID structureId,
                         CmsUUID resourceId,
                         java.lang.String path,
                         int type,
                         int flags,
                         CmsUUID projectId,
                         CmsResourceState state,
                         long dateCreated,
                         CmsUUID userCreated,
                         long dateLastModified,
                         CmsUUID userLastModified,
                         long dateReleased,
                         long dateExpired,
                         int linkCount,
                         int length,
                         long dateContent,
                         int version,
                         I_CmsSearchDocument doc)
Constructor, creates a new file object.

Parameters:
structureId - the id of this resources structure record
resourceId - the id of this resources resource record
path - the filename of this resource
type - the type of this resource
flags - the flags of this resource
projectId - the project id this resource was last modified in
state - the state of this resource
dateCreated - the creation date of this resource
userCreated - the id of the user who created this resource
dateLastModified - the date of the last modification of this resource
userLastModified - the id of the user who did the last modification of this resource
dateReleased - the release date of this resource
dateExpired - the expiration date of this resource
linkCount - the count of all siblings of this resource
length - the size of the file content of this resource
dateContent - the date of the last modification of the content of this resource
version - the version number of this resource
doc - the search document
Method Detail

getDateField

public java.util.Date getDateField(java.lang.String fieldName)
Delegator.

I_CmsSearchDocument.getFieldValueAsDate(String)

Parameters:
fieldName - the field name to get the value for
Returns:
the value

getDocument

public I_CmsSearchDocument getDocument()
Returns the document.

Returns:
the document

getField

public java.lang.String getField(java.lang.String fieldName)
Delegator.

I_CmsSearchDocument.getFieldValueAsString(String)

Parameters:
fieldName - the field name to get the value for
Returns:
the value

getMultivaluedField

public java.util.List<java.lang.String> getMultivaluedField(java.lang.String fieldName)
Delegator.

I_CmsSearchDocument.getFieldValueAsString(String)

Parameters:
fieldName - the field name to get the value for
Returns:
the value

getScore

public int getScore(float maxScore)
Delegator.

I_CmsSearchDocument.getScore() Returns the score of this document.

Parameters:
maxScore - the maximum score of this search
Returns:
the score