Package org.opencms.search
Interface I_CmsSearchDocument
-
- All Known Implementing Classes:
CmsLuceneDocument
,CmsSolrDocument
public interface I_CmsSearchDocument
The interface for search documents.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SEARCH_PRIORITY_HIGH_VALUE
Value for "high" search priority.static java.lang.String
SEARCH_PRIORITY_LOW_VALUE
Value for "low" search priority.static java.lang.String
SEARCH_PRIORITY_MAX_VALUE
Value for "maximum" search priority.static java.lang.String
SEARCH_PRIORITY_NORMAL_VALUE
Value for "normal" search priority.static java.lang.String
VFS_DOCUMENT_KEY_PREFIX
The VFS prefix for document keys.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addCategoryField(java.util.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(java.util.Collection<java.util.Locale> locales)
Adds the locales of the content to this document.void
addDateField(java.lang.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(java.lang.String rootPath)
Puts the given path into this document.void
addResourceLocales(java.util.Collection<java.util.Locale> locales)
Adds the locales of the resource to this document.void
addRootPathField(java.lang.String rootPath)
Puts the given root path into its default field.void
addSearchField(CmsSearchField field, java.lang.String value)
Adds a dynamic search field to the index.void
addSuffixField(java.lang.String suffix)
Adds the suffix field to the document.void
addTypeField(java.lang.String type)
Adds the resource type to this document.byte[]
getContentBlob()
Returns the content blob of this document.java.lang.Object
getDocument()
Returns the concrete document as Object to be cast if necessary.java.util.List<java.lang.String>
getFieldNames()
Returns all field names of this document.java.util.Date
getFieldValueAsDate(java.lang.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.java.lang.String
getFieldValueAsString(java.lang.String fieldName)
Returns the value of the field for the given name as String.java.util.List<java.lang.String>
getMultivaluedFieldAsStringList(java.lang.String fieldName)
Returns the values of a multi-valued field as list of strings.java.lang.String
getPath()
Returns the root path of the referenced VFS resource of this document.float
getScore()
Returns the score for this document.java.lang.String
getType()
Returns the resource type of the referenced VFS resource of this document.void
setScore(float score)
Sets the score for this document.
-
-
-
Field Detail
-
SEARCH_PRIORITY_HIGH_VALUE
static final java.lang.String SEARCH_PRIORITY_HIGH_VALUE
Value for "high" search priority.- See Also:
- Constant Field Values
-
SEARCH_PRIORITY_LOW_VALUE
static final java.lang.String SEARCH_PRIORITY_LOW_VALUE
Value for "low" search priority.- See Also:
- Constant Field Values
-
SEARCH_PRIORITY_MAX_VALUE
static final java.lang.String SEARCH_PRIORITY_MAX_VALUE
Value for "maximum" search priority.- See Also:
- Constant Field Values
-
SEARCH_PRIORITY_NORMAL_VALUE
static final java.lang.String SEARCH_PRIORITY_NORMAL_VALUE
Value for "normal" search priority.- See Also:
- Constant Field Values
-
VFS_DOCUMENT_KEY_PREFIX
static final java.lang.String VFS_DOCUMENT_KEY_PREFIX
The VFS prefix for document keys.- See Also:
- Constant Field Values
-
-
Method Detail
-
addCategoryField
void addCategoryField(java.util.List<CmsCategory> categories)
Adds the list of the given categories to this document.- Parameters:
categories
- the categories to add
-
addContentField
void addContentField(byte[] content)
Adds the given content byte array to this document.- Parameters:
content
- the content to add
-
addContentLocales
void addContentLocales(java.util.Collection<java.util.Locale> locales)
Adds the locales of the content to this document.- Parameters:
locales
- the locales of the content
-
addDateField
void addDateField(java.lang.String name, long date, boolean analyzed)
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
void addFileSizeField(int length)
Adds the given file size as field to this document.- Parameters:
length
- the length
-
addPathField
void addPathField(java.lang.String rootPath)
Puts the given path into this document.- Parameters:
rootPath
- the given path into this document
-
addResourceLocales
void addResourceLocales(java.util.Collection<java.util.Locale> locales)
Adds the locales of the resource to this document.- Parameters:
locales
- the locales of the resource
-
addRootPathField
void addRootPathField(java.lang.String rootPath)
Puts the given root path into its default field.- Parameters:
rootPath
- the root path to put into the field
-
addSearchField
void addSearchField(CmsSearchField field, java.lang.String value)
Adds a dynamic search field to the index.- Parameters:
field
- the fieldvalue
- the value
-
addSuffixField
void addSuffixField(java.lang.String suffix)
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
void addTypeField(java.lang.String type)
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
java.lang.Object getDocument()
Returns the concrete document as Object to be cast if necessary.- Returns:
- the document as Object
-
getFieldNames
java.util.List<java.lang.String> getFieldNames()
Returns all field names of this document.- Returns:
- the field names
-
getFieldValueAsDate
java.util.Date getFieldValueAsDate(java.lang.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.- Parameters:
fieldName
- the name of the field to get the Date value for- Returns:
- the date or
null
-
getFieldValueAsString
java.lang.String getFieldValueAsString(java.lang.String fieldName)
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
java.util.List<java.lang.String> getMultivaluedFieldAsStringList(java.lang.String fieldName)
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
java.lang.String 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
java.lang.String getType()
Returns the resource type of the referenced VFS resource of this document.- Returns:
- the type
-
setScore
void setScore(float score)
Sets the score for this document.- Parameters:
score
- the score
-
-