Package org.opencms.search
Interface I_CmsSearchDocument
- All Known Implementing Classes:
CmsLuceneDocument,CmsSolrDocument
public interface I_CmsSearchDocument
The interface for search documents.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringValue for "high" search priority.static final StringValue for "low" search priority.static final StringValue for "maximum" search priority.static final StringValue for "normal" search priority.static final StringThe VFS prefix for document keys. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCategoryField(List<CmsCategory> categories) Adds the list of the given categories to this document.voidaddContentField(byte[] content) Adds the given content byte array to this document.voidaddContentLocales(Collection<Locale> locales) Adds the locales of the content to this document.voidaddDateField(String name, long date, boolean analyzed) Puts the given date into the field with the given name.voidaddFileSizeField(int length) Adds the given file size as field to this document.voidaddPathField(String rootPath) Puts the given path into this document.voidaddResourceLocales(Collection<Locale> locales) Adds the locales of the resource to this document.voidaddRootPathField(String rootPath) Puts the given root path into its default field.voidaddSearchField(CmsSearchField field, String value) Adds a dynamic search field to the index.voidaddSuffixField(String suffix) Adds the suffix field to the document.voidaddTypeField(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,nullif 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.floatgetScore()Returns the score for this document.getType()Returns the resource type of the referenced VFS resource of this document.voidsetScore(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-trueif 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,nullif 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
nullif 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
-