Class CmsSolrSpellchecker
- java.lang.Object
-
- org.opencms.search.solr.spellchecking.CmsSolrSpellchecker
-
public final class CmsSolrSpellchecker extends java.lang.Object
CmsSolrSpellchecker is used to perform spellchecking in OpenCms by using Solr. The JSON-formatted result of the spellchecking operation contains suggestions for misspelled words and is compatible with the expected structure of the tinyMCE editor.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SPELLCHECKER_INDEX_CORE
The spellcheck core name.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CmsSolrSpellchecker
getInstance()
Return an instance of this class.static CmsSolrSpellchecker
getInstance(org.apache.solr.core.CoreContainer container)
Return an instance of this class.void
getSpellcheckingResult(javax.servlet.http.HttpServletResponse res, javax.servlet.ServletRequest servletRequest, CmsObject cms)
Performs spellchecking using Solr and returns the spellchecking results using JSON.void
parseAndAddDictionaries(CmsObject cms)
Parses and adds dictionaries to the Solr index.
-
-
-
Field Detail
-
SPELLCHECKER_INDEX_CORE
public static final java.lang.String SPELLCHECKER_INDEX_CORE
The spellcheck core name.- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static CmsSolrSpellchecker getInstance()
Return an instance of this class.- Returns:
- instance of CmsSolrSpellchecker
-
getInstance
public static CmsSolrSpellchecker getInstance(org.apache.solr.core.CoreContainer container)
Return an instance of this class.- Parameters:
container
- Solr CoreContainer container object in order to create a server object.- Returns:
- instance of CmsSolrSpellchecker
-
getSpellcheckingResult
public void getSpellcheckingResult(javax.servlet.http.HttpServletResponse res, javax.servlet.ServletRequest servletRequest, CmsObject cms) throws CmsPermissionViolationException, java.io.IOException
Performs spellchecking using Solr and returns the spellchecking results using JSON.- Parameters:
res
- The HttpServletResponse object.servletRequest
- The ServletRequest object.cms
- The CmsObject object.- Throws:
CmsPermissionViolationException
- in case of the anonymous guest userjava.io.IOException
- if writing the response fails
-
parseAndAddDictionaries
public void parseAndAddDictionaries(CmsObject cms) throws CmsRoleViolationException
Parses and adds dictionaries to the Solr index.- Parameters:
cms
- the OpenCms object.- Throws:
CmsRoleViolationException
- in case the user does not have the required role ROOT_ADMIN
-
-