Enable the Solr administrative interface
We can monitor Solr in WebSphere Commerce Search using the Solr administrative interface. The Solr native administrative interface can be used to gather runtime statistics for each Solr core that is running on the search server. It can also be used to perform simple search queries.
Before beginning
- Download the supported Solr package from Apache. The archive file solr-7.3.1.zip contains a /solr-7.3.1/server/solr-webapp/webapp directory.
For more information about the Apache graphical user interface, see SolrAdminGUI.
- Import the Search_eardir/search-solr.war project into your workspace.
- Select the following directories and files from the downloaded solr-7.3.1.zip file. You will copy them into one of two locations, depending on whether we are working in a developer or runtime environment.
- css
- img
- js
- libs
- partials
- index.html
- favicon.ico
Procedure
- Setting up the Solr administrative interface in a development environment
- Place the files in the Search-Solr/WebContent directory.
- Open the Search-Solr/WebContent/WEB-INF/ibm-web-ext.xml file for editing.
- Find the enable-file-serving property and set it to true. For example:
<web-ext xmlns="http://websphere.ibm.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-ext_1_0.xsd" version="1.0"> <reload-interval value="3"/> <context-root uri="/solr" /> <enable-directory-browsing value="false"/> <enable-file-serving value="true"/> <enable-reloading value="false"/> <enable-serving-servlets-by-class-name value="false" /> </web-ext>
Save our changes and close the file. Right-click the search-solr project and select Properties > Web Project Settings. Set the context root to /solr. Update the search-solr.war/WEB-INF/web.xml file. Change the URL pattern for the SolrSearchServlet servlet to /solr. For example: <servlet-mapping> <servlet-name>SolrSearchServlet</servlet-name> <url-pattern>/solr</url-pattern> </servlet-mapping>
Save our changes and close the file. Publish the search EAR.
Setting up the Solr administrative interface in a runtime environment
- Copy the files from solr-7.3.1.zip to the /profile/apps/search-ear.ear/search-solr.war/ directory.
- Edit the /profile/apps/search-ear.ear/search-solr.war/WEB-INF/ibm-web-ext.xml file.
- Find the enable-file-serving property and set it to true. For example:
<web-ext xmlns="http://websphere.ibm.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-ext_1_0.xsd" version="1.0"> <reload-interval value="3"/> <context-root uri="/solr" /> <enable-directory-browsing value="false"/> <enable-file-serving value="true"/> <enable-reloading value="false"/> <enable-serving-servlets-by-class-name value="false" /> </web-ext>
- Save our changes and close the files.
- Update the /profile/apps/search-ear.ear/search-solr.war/WEB-INF/web.xml file. Change the URL pattern for the SolrSearchServlet servlet to /solr. For example:
<servlet-mapping> <servlet-name>SolrSearchServlet</servlet-name> <url-pattern>/solr</url-pattern> </servlet-mapping>
- Save our changes and close the file.
- Restart the Search container.
Results
Use the following URL to access the Solr administrative interface:http://hostname:3737/solr/index.html