Package org.opencms.search.solr
Class CmsSolrDocument
java.lang.Object
org.opencms.search.solr.CmsSolrDocument
- All Implemented Interfaces:
I_CmsSearchDocument
A search document implementation for Solr indexes.
- Since:
- 8.5.0
-
Field Summary
Fields inherited from interface org.opencms.search.I_CmsSearchDocument
SEARCH_PRIORITY_HIGH_VALUE, SEARCH_PRIORITY_LOW_VALUE, SEARCH_PRIORITY_MAX_VALUE, SEARCH_PRIORITY_NORMAL_VALUE, VFS_DOCUMENT_KEY_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionCmsSolrDocument(org.apache.solr.common.SolrDocument doc) Public constructor to create a encapsulate a Solr document.CmsSolrDocument(org.apache.solr.common.SolrInputDocument doc) Public constructor to create a encapsulate a Solr document. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCategoryField(List<CmsCategory> categories) Adds the list of the given categories to this document.voidaddContentField(byte[] data) 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 time, boolean analyzed) Puts the given date into the field with the given name.voidaddDocumentDependency(CmsObject cms, CmsDocumentDependency resDeps) Adds the given document dependency to this document.voidaddFileSizeField(int length) Adds the given file size as field to this document.voidaddMultiValuedField(String fieldName, List<String> values) Adds a multi-valued field.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 sfield, 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.org.apache.solr.common.SolrDocumentReturns the Solr document.getType()Returns the resource type of the referenced VFS resource of this document.voidSets the id of this document.voidsetScore(float score) Sets the score for this document.toString()
-
Constructor Details
-
CmsSolrDocument
Public constructor to create a encapsulate a Solr document.- Parameters:
doc- the Solr document
-
CmsSolrDocument
Public constructor to create a encapsulate a Solr document.- Parameters:
doc- the Solr document
-
-
Method Details
-
addCategoryField
Description copied from interface:I_CmsSearchDocumentAdds the list of the given categories to this document.- Specified by:
addCategoryFieldin interfaceI_CmsSearchDocument- Parameters:
categories- the categories to add- See Also:
-
addContentField
Description copied from interface:I_CmsSearchDocumentAdds the given content byte array to this document.- Specified by:
addContentFieldin interfaceI_CmsSearchDocument- Parameters:
data- the content to add- See Also:
-
addContentLocales
Description copied from interface:I_CmsSearchDocumentAdds the locales of the content to this document.- Specified by:
addContentLocalesin interfaceI_CmsSearchDocument- Parameters:
locales- the locales of the content- See Also:
-
addDateField
Description copied from interface:I_CmsSearchDocumentPuts the given date into the field with the given name.- Specified by:
addDateFieldin interfaceI_CmsSearchDocument- Parameters:
name- the name to put the date intime- the date to pu into the fieldanalyzed-trueif the inserted value should be analyzable- See Also:
-
addDocumentDependency
Adds the given document dependency to this document.- Parameters:
cms- the current CmsObjectresDeps- the dependency
-
addFileSizeField
Description copied from interface:I_CmsSearchDocumentAdds the given file size as field to this document.- Specified by:
addFileSizeFieldin interfaceI_CmsSearchDocument- Parameters:
length- the length- See Also:
-
addMultiValuedField
Adds a multi-valued field.- Parameters:
fieldName- the field name to put the values invalues- the values to put in the field
-
addPathField
Description copied from interface:I_CmsSearchDocumentPuts the given path into this document.- Specified by:
addPathFieldin interfaceI_CmsSearchDocument- Parameters:
rootPath- the given path into this document- See Also:
-
addResourceLocales
Description copied from interface:I_CmsSearchDocumentAdds the locales of the resource to this document.- Specified by:
addResourceLocalesin interfaceI_CmsSearchDocument- Parameters:
locales- the locales of the resource- See Also:
-
addRootPathField
Description copied from interface:I_CmsSearchDocumentPuts the given root path into its default field.- Specified by:
addRootPathFieldin interfaceI_CmsSearchDocument- Parameters:
rootPath- the root path to put into the field- See Also:
-
addSearchField
Description copied from interface:I_CmsSearchDocumentAdds a dynamic search field to the index.- Specified by:
addSearchFieldin interfaceI_CmsSearchDocument- Parameters:
sfield- the fieldvalue- the value- See Also:
-
addSuffixField
Description copied from interface:I_CmsSearchDocumentAdds the suffix field to the document. This field should contain the resource suffix.Example
'html' for a file named 'article.html'- Specified by:
addSuffixFieldin interfaceI_CmsSearchDocument- Parameters:
suffix- the suffix to add- See Also:
-
addTypeField
Description copied from interface:I_CmsSearchDocumentAdds the resource type to this document.- Specified by:
addTypeFieldin interfaceI_CmsSearchDocument- Parameters:
type- the resource type name.- See Also:
-
getContentBlob
Description copied from interface:I_CmsSearchDocumentReturns the content blob of this document.- Specified by:
getContentBlobin interfaceI_CmsSearchDocument- Returns:
- the content blob
- See Also:
-
getDocument
Description copied from interface:I_CmsSearchDocumentReturns the concrete document as Object to be cast if necessary.- Specified by:
getDocumentin interfaceI_CmsSearchDocument- Returns:
- the document as Object
- See Also:
-
getFieldNames
Description copied from interface:I_CmsSearchDocumentReturns all field names of this document.- Specified by:
getFieldNamesin interfaceI_CmsSearchDocument- Returns:
- the field names
- See Also:
-
getFieldValueAsDate
Description copied from interface:I_CmsSearchDocumentTries 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.- Specified by:
getFieldValueAsDatein interfaceI_CmsSearchDocument- Parameters:
fieldName- the name of the field to get the Date value for- Returns:
- the date or
null - See Also:
-
getFieldValueAsString
Description copied from interface:I_CmsSearchDocumentReturns the value of the field for the given name as String.- Specified by:
getFieldValueAsStringin interfaceI_CmsSearchDocument- Parameters:
fieldName- the name of the field to get the String value for- Returns:
- the String value or
nullif empty - See Also:
-
getMultivaluedFieldAsStringList
Description copied from interface:I_CmsSearchDocumentReturns the values of a multi-valued field as list of strings.- Specified by:
getMultivaluedFieldAsStringListin interfaceI_CmsSearchDocument- 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.
- See Also:
-
getPath
Description copied from interface:I_CmsSearchDocumentReturns the root path of the referenced VFS resource of this document.- Specified by:
getPathin interfaceI_CmsSearchDocument- Returns:
- the root path
- See Also:
-
getScore
Description copied from interface:I_CmsSearchDocumentReturns the score for this document.- Specified by:
getScorein interfaceI_CmsSearchDocument- Returns:
- the score
- See Also:
-
getSolrDocument
Returns the Solr document.- Returns:
- the Solr document
-
getType
Description copied from interface:I_CmsSearchDocumentReturns the resource type of the referenced VFS resource of this document.- Specified by:
getTypein interfaceI_CmsSearchDocument- Returns:
- the type
- See Also:
-
setId
Sets the id of this document.- Parameters:
structureId- the structure id to use
-
setScore
Description copied from interface:I_CmsSearchDocumentSets the score for this document.- Specified by:
setScorein interfaceI_CmsSearchDocument- Parameters:
score- the score- See Also:
-
toString
-