public class CmsSolrDocument extends java.lang.Object implements I_CmsSearchDocument
限定符和类型 | 字段和说明 |
---|---|
protected static java.text.DateFormat |
DF
A constant for the Solr date format.
|
SEARCH_PRIORITY_HIGH_VALUE, SEARCH_PRIORITY_LOW_VALUE, SEARCH_PRIORITY_MAX_VALUE, SEARCH_PRIORITY_NORMAL_VALUE, VFS_DOCUMENT_KEY_PREFIX
构造器和说明 |
---|
CmsSolrDocument(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.
|
限定符和类型 | 方法和说明 |
---|---|
void |
addCategoryField(java.util.List<CmsCategory> categories)
Adds the list of the given categories to this document.
|
void |
addContentField(byte[] data)
Adds the given content byte array to this document.
|
void |
addContentLocales(java.util.List<java.util.Locale> locales)
Adds the locales of the content to this document.
|
void |
addDateField(java.lang.String name,
long time,
boolean analyzed)
Puts the given date into the field with the given name.
|
void |
addDocumentDependency(CmsObject cms,
CmsDocumentDependency resDeps)
Adds the given document dependency to this document.
|
void |
addFileSizeField(int length)
Adds the given file size as field to this document.
|
void |
addMultiValuedField(java.lang.String fieldName,
java.util.List<java.lang.String> values)
Adds a multi-valued field.
|
void |
addPathField(java.lang.String rootPath)
Puts the given path into this document.
|
void |
addResourceLocales(java.util.List<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 sfield,
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 a list of Strings representing the values of an multi valued field.
|
java.lang.String |
getPath()
Returns the root path of the referenced VFS resource of this document.
|
float |
getScore()
Returns the score for this document.
|
org.apache.solr.common.SolrDocument |
getSolrDocument()
Returns the Solr document.
|
java.lang.String |
getType()
Returns the resource type of the referenced VFS resource of this document.
|
void |
setBoost(float boost)
Sets the boost factor for the whole document.
|
void |
setId(CmsUUID structureId)
Sets the id of this document.
|
void |
setScore(float score)
Sets the score for this document.
|
java.lang.String |
toString() |
public CmsSolrDocument(org.apache.solr.common.SolrDocument doc)
doc
- the Solr documentpublic CmsSolrDocument(org.apache.solr.common.SolrInputDocument doc)
doc
- the Solr documentpublic void addCategoryField(java.util.List<CmsCategory> categories)
I_CmsSearchDocument
addCategoryField
在接口中 I_CmsSearchDocument
categories
- the categories to addI_CmsSearchDocument.addCategoryField(java.util.List)
public void addContentField(byte[] data)
I_CmsSearchDocument
addContentField
在接口中 I_CmsSearchDocument
data
- the content to addI_CmsSearchDocument.addContentField(byte[])
public void addContentLocales(java.util.List<java.util.Locale> locales)
I_CmsSearchDocument
addContentLocales
在接口中 I_CmsSearchDocument
locales
- the locales of the contentI_CmsSearchDocument.addContentLocales(java.util.List)
public void addDateField(java.lang.String name, long time, boolean analyzed)
I_CmsSearchDocument
addDateField
在接口中 I_CmsSearchDocument
name
- the name to put the date intime
- the date to pu into the fieldanalyzed
- true
if the inserted value should be analyzableI_CmsSearchDocument.addDateField(java.lang.String, long, boolean)
public void addDocumentDependency(CmsObject cms, CmsDocumentDependency resDeps)
cms
- the current CmsObjectresDeps
- the dependencypublic void addFileSizeField(int length)
I_CmsSearchDocument
addFileSizeField
在接口中 I_CmsSearchDocument
length
- the lengthI_CmsSearchDocument.addFileSizeField(int)
public void addMultiValuedField(java.lang.String fieldName, java.util.List<java.lang.String> values)
fieldName
- the field name to put the values invalues
- the values to put in the fieldpublic void addPathField(java.lang.String rootPath)
I_CmsSearchDocument
addPathField
在接口中 I_CmsSearchDocument
rootPath
- the given path into this documentI_CmsSearchDocument.addPathField(java.lang.String)
public void addResourceLocales(java.util.List<java.util.Locale> locales)
I_CmsSearchDocument
addResourceLocales
在接口中 I_CmsSearchDocument
locales
- the locales of the resourceI_CmsSearchDocument.addResourceLocales(java.util.List)
public void addRootPathField(java.lang.String rootPath)
I_CmsSearchDocument
addRootPathField
在接口中 I_CmsSearchDocument
rootPath
- the root path to put into the fieldI_CmsSearchDocument.addRootPathField(java.lang.String)
public void addSearchField(CmsSearchField sfield, java.lang.String value)
I_CmsSearchDocument
addSearchField
在接口中 I_CmsSearchDocument
sfield
- the fieldvalue
- the valueI_CmsSearchDocument.addSearchField(org.opencms.search.fields.CmsSearchField, java.lang.String)
public void addSuffixField(java.lang.String suffix)
I_CmsSearchDocument
Example
'html' for a file named 'article.html'
addSuffixField
在接口中 I_CmsSearchDocument
suffix
- the suffix to addI_CmsSearchDocument.addSuffixField(java.lang.String)
public void addTypeField(java.lang.String type)
I_CmsSearchDocument
public byte[] getContentBlob()
I_CmsSearchDocument
getContentBlob
在接口中 I_CmsSearchDocument
I_CmsSearchDocument.getContentBlob()
public java.lang.Object getDocument()
I_CmsSearchDocument
getDocument
在接口中 I_CmsSearchDocument
I_CmsSearchDocument.getDocument()
public java.util.List<java.lang.String> getFieldNames()
I_CmsSearchDocument
getFieldNames
在接口中 I_CmsSearchDocument
I_CmsSearchDocument.getFieldNames()
public java.util.Date getFieldValueAsDate(java.lang.String fieldName)
I_CmsSearchDocument
null
if the field is empty or if the field is not of the type date.getFieldValueAsDate
在接口中 I_CmsSearchDocument
fieldName
- the name of the field to get the Date value fornull
I_CmsSearchDocument.getFieldValueAsDate(java.lang.String)
public java.lang.String getFieldValueAsString(java.lang.String fieldName)
I_CmsSearchDocument
getFieldValueAsString
在接口中 I_CmsSearchDocument
fieldName
- the name of the field to get the String value fornull
if emptyI_CmsSearchDocument.getFieldValueAsString(java.lang.String)
public java.util.List<java.lang.String> getMultivaluedFieldAsStringList(java.lang.String fieldName)
I_CmsSearchDocument
getMultivaluedFieldAsStringList
在接口中 I_CmsSearchDocument
fieldName
- the name of the multi valued field to get the content ofnull
I_CmsSearchDocument.getMultivaluedFieldAsStringList(java.lang.String)
public java.lang.String getPath()
I_CmsSearchDocument
getPath
在接口中 I_CmsSearchDocument
I_CmsSearchDocument.getPath()
public float getScore()
I_CmsSearchDocument
getScore
在接口中 I_CmsSearchDocument
I_CmsSearchDocument.getScore()
public org.apache.solr.common.SolrDocument getSolrDocument()
public java.lang.String getType()
I_CmsSearchDocument
getType
在接口中 I_CmsSearchDocument
I_CmsSearchDocument.getType()
public void setBoost(float boost)
I_CmsSearchDocument
setBoost
在接口中 I_CmsSearchDocument
boost
- the factor to setI_CmsSearchDocument.setBoost(float)
public void setId(CmsUUID structureId)
structureId
- the structure id to usepublic void setScore(float score)
I_CmsSearchDocument
setScore
在接口中 I_CmsSearchDocument
score
- the scoreI_CmsSearchDocument.setScore(float)
public java.lang.String toString()
toString
在类中 java.lang.Object
Object.toString()