Package org.ametys.cms.solr
Class SolrQueryHandler
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.cms.solr.SolrQueryHandler
- All Implemented Interfaces:
LogEnabled
,Initializable
,Component
,Serviceable
public class SolrQueryHandler
extends AbstractLogEnabled
implements Component, Serviceable, Initializable
Handler to execute Solr JSON queries
-
Field Summary
Modifier and TypeFieldDescriptionprotected SearcherFactory
The searcher factory.protected org.apache.solr.client.solrj.SolrClient
The solr clientprotected SolrClientProvider
The solr client providerprotected SolrIndexer
The Solr indexerstatic final String
Avalon role. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionexecuteSolrQuery
(String query, String coreName) Execute a solr query.Get the solr core namesvoid
void
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon role. -
_searcherFactory
The searcher factory. -
_solrClient
The solr client -
_solrIndexer
The Solr indexer -
_solrClientProvider
The solr client provider
-
-
Constructor Details
-
SolrQueryHandler
public SolrQueryHandler()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
executeSolrQuery
Execute a solr query.- Parameters:
query
- The query as a String representing a JSON.coreName
- The solr core name- Returns:
- The result as a JSON String
- Throws:
Exception
- If an error occurs
-
getSolrCoreNames
Get the solr core names- Returns:
- The solr core names
- Throws:
Exception
- If an error occurs
-