-
Notifications
You must be signed in to change notification settings - Fork 47
Install Solr and GSearch
-
Stop Fedora.
-
Download the desired version of Solr to
/opt
:basic-solr-config
BranchSolr Versions modular
3.6.2 (down to 1.4 may work) 4.x
4.2.0 4.10.x
4.10.4 -
Unpack the download archive.
-
Clone/unpack the matching branch of the
basic-solr-config
. In this documentation, we'll say we cloned it to/opt/gsearch_config
:# $BRANCH should correspond to the `basic-solr-config` branch for the given version of Solr. git clone [email protected]:discoverygarden/basic-solr-config.git --recursive --branch=$BRANCH /opt/gsearch_config
-
Make a symbolic link to the solr directory such that
/opt/solr
points at the unpacked archive.ln -s /opt/solr-4.2.0 /opt/solr
-
Add the following XML file to
$FEDORA_HOME/tomcat/conf/Catalina/localhost/solr.xml
. The/Context/@docBase
attribute should be altered to point at the.war
unpacked from the archive above, in the/opt/solr/dist
directory.<?xml version="1.0" encoding="UTF-8"?> <Context docBase="/opt/solr/dist/solr-4.2.0.war" debug="0" crossContext="true"> <Environment name="solr/home" type="java.lang.String" value="/usr/local/fedora/solr" override="true"/> </Context>
-
Copy over the default configuration files. This should be something like:
cp -r /opt/solr/example/solr $FEDORA_HOME/solr
Overwrite the example Solr config with that provided in our branch. Before Solr 4, this was something like $FEDORA_HOME/solr/conf
. For 4 and later, it should be something like $FEDORA_HOME/solr/collection1/conf
:
cp -r /opt/gsearch_config/conf $FEDORA_HOME/solr/collection1/conf
collection1: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Plugin init failure for [schema.xml] fieldType "text": Plugin init failure for [schema.xml] analyzer/filter: Error loading class 'solr.EnglishPorterFilterFactory'
Changed the deprecated "EnglishPorterFilterFactory" to use "SnowballPorterFilterFactory".
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
Becomes
<filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/>
collection1: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Unable to use updateLog: _version_field must exist in schema, using indexed="true" stored="true" and multiValued="false" (_version_ is multiValued
Changed the version of the schema from 1.1 to version 1.5 which includes these changes:
1.2: omitTermFreqAndPositions attribute introduced, true by default
except for text fields.
1.3: removed optional field compress feature
1.4: autoGeneratePhraseQueries attribute introduced to drive QueryParser
behavior when a single string produces multiple tokens. Defaults
to off for version >= 1.4
1.5: omitNorms defaults to true for primitive field types
(int, float, boolean, string…)
Also Added the following field to the schema.
<field name="_version_" type="long" indexed="true" stored="true"/>
With Fedora still stopped:
-
Place the fedoragsearch.war file in
$FEDORA_HOME/tomcat/webapps
-
Unzip the placed
.war
file:unzip $FEDORA_HOME/tomcat/webapps/fedoragsearch.war -d $FEDORA_HOME/tomcat/webapps/fedoragsearch
-
Navigate to
$FEDORA_HOME/tomcat/webapps/fedoragsearch/FgsConfig
cd $FEDORA_HOME/tomcat/webapps/fedoragsearch/FgsConfig
-
Modify the
fgsconfig-basic.properties
file as needed be sure that the following properties are set correctly:<path to fedora home>
should be the absolute path to your$FEDORA_HOME
directory; typically, something like/usr/local/fedora
:configDisplayName=configDemoOnSolr local.FEDORA_HOME=<path to fedora home> indexEngine=Solr indexDir=${local.FEDORA_HOME}/solr/collection1/data/index indexBase=http://localhost:8080/solr indexingDocXslt=foxmlToSolr
NOTE: The
indexDir
directory location varies. Prior to Solr 4, it would have been something like:${local.FEDORA_HOME}/solr/data/index
-
Run the following commands to generate the basic configuration:
ant generateIndexingXslt ant -f fgsconfig-basic.xml
-
Install the DGI GSearch Extensions to GSearch. See its included directions for details.
-
Go to the index directory of the GSearch:
cd $FEDORA_HOME/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex
-
Overwrite
$FEDORA_HOME/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/foxmlToSolr.xslt
with/opt/gsearch_config/foxmlToSolr.xslt
:cp /opt/gsearch/foxmlToSolr.xslt $FEDORA_HOME/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/foxmlToSolr.xslt
-
Copy
/opt/gsearch_config/islandora_transforms
to$FEDORA_HOME/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex
:cp -r /opt/gsearch_config/islandora_transforms $FEDORA_HOME/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex
NOTE: If you keep Fedora or Tomcat in the non-default location, you will need to update each of the *.xslt
files to reflect that as well.
- Start Fedora
/usr/local/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/foxmlToSolr.xslt was not present and it is the "default" solr xslt now in gsearch 2.7+.
Please read over sort out this issue see Install GSearch
cd $FEDORA_HOME/tomcat/webapps/fedoragsearch/FgsConfig
ant generateIndexingXslt
ant -f fgsconfig-basic.xml
Thu Oct 03 13:33:09 UTC 2013 IndexReader open error indexName=FgsIndex : ; nested exception is: org.apache.lucene.store.NoSuchDirectoryException: directory '/usr/local/fedora/solr/data/index' does not exist
Check the basic properties file as needed be sure that it points at the correct index directory:
indexDir=${local.FEDORA_HOME}/solr/collection1/data/index