Package org.opencms.search
Interface I_CmsSearchDocument
- All Known Implementing Classes:
CmsLuceneDocument
,CmsSolrDocument
public interface I_CmsSearchDocument
The interface for search documents.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Value for "high" search priority.static final String
Value for "low" search priority.static final String
Value for "maximum" search priority.static final String
Value for "normal" search priority.static final String
The VFS prefix for document keys. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCategoryField
(List<CmsCategory> categories) Adds the list of the given categories to this document.void
addContentField
(byte[] content) Adds the given content byte array to this document.void
addContentLocales
(Collection<Locale> locales) Adds the locales of the content to this document.void
addDateField
(String name, long date, boolean analyzed) Puts the given date into the field with the given name.void
addFileSizeField
(int length) Adds the given file size as field to this document.void
addPathField
(String rootPath) Puts the given path into this document.void
addResourceLocales
(Collection<Locale> locales) Adds the locales of the resource to this document.void
addRootPathField
(String rootPath) Puts the given root path into its default field.void
addSearchField
(CmsSearchField field, String value) Adds a dynamic search field to the index.void
addSuffixField
(String suffix) Adds the suffix field to the document.void
addTypeField
(String type) Adds the resource type to this document.byte[]
Returns the content blob of this document.Returns the concrete document as Object to be cast if necessary.Returns all field names of this document.getFieldValueAsDate
(String fieldName) Tries to return the value of the field for the given name as Date,null
if the field is empty or if the field is not of the type date.getFieldValueAsString
(String fieldName) Returns the value of the field for the given name as String.getMultivaluedFieldAsStringList
(String fieldName) Returns the values of a multi-valued field as list of strings.getPath()
Returns the root path of the referenced VFS resource of this document.float
getScore()
Returns the score for this document.getType()
Returns the resource type of the referenced VFS resource of this document.void
setScore
(float score) Sets the score for this document.
-
Field Details
-
SEARCH_PRIORITY_HIGH_VALUE
Value for "high" search priority.- See Also:
-
SEARCH_PRIORITY_LOW_VALUE
Value for "low" search priority.- See Also:
-
SEARCH_PRIORITY_MAX_VALUE
Value for "maximum" search priority.- See Also:
-
SEARCH_PRIORITY_NORMAL_VALUE
Value for "normal" search priority.- See Also:
-
VFS_DOCUMENT_KEY_PREFIX
The VFS prefix for document keys.- See Also:
-
-
Method Details
-
addCategoryField
Adds the list of the given categories to this document.- Parameters:
categories
- the categories to add
-
addContentField
Adds the given content byte array to this document.- Parameters:
content
- the content to add
-
addContentLocales
Adds the locales of the content to this document.- Parameters:
locales
- the locales of the content
-
addDateField
Puts the given date into the field with the given name.- Parameters:
name
- the name to put the date indate
- the date to pu into the fieldanalyzed
-true
if the inserted value should be analyzable
-
addFileSizeField
Adds the given file size as field to this document.- Parameters:
length
- the length
-
addPathField
Puts the given path into this document.- Parameters:
rootPath
- the given path into this document
-
addResourceLocales
Adds the locales of the resource to this document.- Parameters:
locales
- the locales of the resource
-
addRootPathField
Puts the given root path into its default field.- Parameters:
rootPath
- the root path to put into the field
-
addSearchField
Adds a dynamic search field to the index.- Parameters:
field
- the fieldvalue
- the value
-
addSuffixField
Adds the suffix field to the document. This field should contain the resource suffix.Example
'html' for a file named 'article.html'
- Parameters:
suffix
- the suffix to add
-
addTypeField
Adds the resource type to this document.- Parameters:
type
- the resource type name.
-
getContentBlob
byte[] getContentBlob()Returns the content blob of this document.- Returns:
- the content blob
-
getDocument
Returns the concrete document as Object to be cast if necessary.- Returns:
- the document as Object
-
getFieldNames
Returns all field names of this document.- Returns:
- the field names
-
getFieldValueAsDate
Tries to return the value of the field for the given name as Date,null
if the field is empty or if the field is not of the type date.- Parameters:
fieldName
- the name of the field to get the Date value for- Returns:
- the date or
null
-
getFieldValueAsString
Returns the value of the field for the given name as String.- Parameters:
fieldName
- the name of the field to get the String value for- Returns:
- the String value or
null
if empty
-
getMultivaluedFieldAsStringList
Returns the values of a multi-valued field as list of strings.- Parameters:
fieldName
- the name of the multivalued field to get the values from.- Returns:
- the values of a multi-valued field as list of strings.
-
getPath
Returns the root path of the referenced VFS resource of this document.- Returns:
- the root path
-
getScore
float getScore()Returns the score for this document.- Returns:
- the score
-
getType
Returns the resource type of the referenced VFS resource of this document.- Returns:
- the type
-
setScore
Sets the score for this document.- Parameters:
score
- the score
-