Skip to content

Use solr for searching

Meine Toonen edited this page Apr 9, 2020 · 27 revisions

Installation

  1. Set up the viewer-admin and viewer for setting up the configuration for solr. See ad 1 and ad. 2 Setting the contextvariables
  2. Start the viewer-admin
  3. Drop the solr war in a directory (we recommend the flamingo data directory)
  4. Link to the war via this xml file.
  5. Change the docBase directory to which the war file resides
  6. Update and activate the Environment element in the solr.xml for solr/home to point to the data directory, eg. /opt/flamingo_data/.solr
  7. Copy (or symlink) from ${catalina.base}/conf/Catalina/localhost/solr.xml to the xml file
  8. Start solr from the Tomcat admin interface (unless you have auto-deploy enabled)
  9. Shield solr from the outside world. You can use apache webserver for example, using this configuration. (Perhaps this doesn't work: TODO)

Extra reference (in dutch): thanks to the Province of Groningen. Here is how they installed it.

ad 1: Configuring the context parameters in context.xml, in Tomcat/conf/Catalina//viewe(-admin).xml. For scheduling see: [http://en.wikipedia.org/wiki/Cron]. Set flamingo.solr.setup to true in the viewer-admin.xml, and to false in viewer.xml.

  <Parameter name="flamingo.data.dir" value="/opt/flamingo_data" override="false"/>
  <Parameter name="flamingo.solr.url" value="http://webkaart.b3p.nl/solr/" override="false"/>
  <Parameter name="flamingo.solr.schedule" value="0 1 * ? * *" override="false"/>
  <Parameter name="flamingo.solr.setup" value="true" override="false"/>

The advantage here is when you copy a new war, the settings will be saved. However, when undeploying it is removed and you have to set them again. Changing the values will require a restart of tomcat.

ad 2: For configuration of the variables in server.xml do the following.

Under the Host node add the following:

  <Context path="/viewer-admin">
         <Parameter name="flamingo.data.dir" value="/opt/flamingo_data" override="false"/>
         <Parameter name="flamingo.solr.url" value="http://webkaart.b3p.nl/solr/" override="false"/>
         <Parameter name="flamingo.solr.schedule" value="0 1 * ? * *" override="false"/>
         <Parameter name="flamingo.solr.setup" value="true" override="false"/>
  </Context>
  <Context path="/viewer">
         <Parameter name="flamingo.data.dir" value="/opt/flamingo_data" override="false"/>
         <Parameter name="flamingo.solr.url" value="http://webkaart.b3p.nl/solr/" override="false"/>
         <Parameter name="flamingo.solr.schedule" value="0 1 * ? * *" override="false"/>
         <Parameter name="flamingo.solr.setup" value="false" override="false"/>
  </Context>

Will always be stored, even after a undeploy. It requires a restart of tomcat when changing values. Match the path attribute to the applications (so the variables under path="/viewer" will be for viewer).

FAQ

  1. I get an error opening the solr url. I get the following error "HTTP Status 500 - {msg=SolrCore 'collection1' is not available due to init failure"
  2. Answer: Stop the solr webapp from the manager, Start the viewer-admin, start the solr webapp. The viewer-admin sets variables needed for solr. Alternatively, you could set a variable in the JvM point to the datadirectory. The viewer-admin sets this variable, which - under normal circumstances - should suffice.However, when you restart tomcat often, this might be causing some trouble. This might also occur when you have deployed your solr instance in a different tomcat. Edit the file bin/setclasspath.sh under the root of the Tomcat installation. Specify the solr.solr.home system property by setting the CATALINA_OPTS variable: CATALINA_OPTS="-Dsolr.solr.home=<flamingo_datadirectory>/.solr"
  3. There is no viewer(-admin).xml in conf/Catalina//
  4. Since tomcat 7 the defaultvalue for copyXML (responsible for copying the context.xml to that folder) is set to false. You can change this in Catalina/conf/server.xml, and then at , change it (or type it if it isn't already there) to true.

How to use

ToDo

Adding to index

ToDo

Configure search components

ToDo