Skip to content

Commit

Permalink
Disable Solr in the opencms-search.xml during upgrade process.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruediger Kurz committed Oct 25, 2013
1 parent ab5042d commit fb31931
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,11 @@ task updater (dependsOn: setupJar, type: Zip){
include 'update/**'
exclude 'update/empty.jar'
exclude 'update/readme.txt'
}
from ("${projectDir}/webapp/WEB-INF/solr/conf"){
into '/WEB-INF/solr-update/'
include 'schema.xml'
include 'solrconfig.xml'
}
from "${projectDir}/webapp/update/readme.txt"
from ("${projectDir}/webapp/WEB-INF"){
Expand Down
21 changes: 19 additions & 2 deletions src-setup/org/opencms/setup/xml/v8/CmsXmlAddSolrSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.Collections;
import java.util.List;

import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
Expand All @@ -52,10 +53,10 @@ public boolean executeUpdate(Document doc, String xpath, boolean forReal) {

Element node = (Element)doc.selectSingleNode("/opencms/search");
if (node.selectSingleNode("solr") == null) {
String solrComment = "To enable Solr in OpenCms you must create a solr/ home\n"
String solrComment = " To enable Solr in OpenCms you must create a solr/ home\n"
+ " directory in the WEB-INF folder of your OpenCms application.\n"
+ " Copy the solr/ folder from the OpenCms standard distribution\n"
+ " as a starting point for your configuration.";
+ " as a starting point for your configuration. ";
try {
Element solrElement = createElementFromXml("<solr enabled=\"false\"></solr>");
solrElement.addComment(solrComment);
Expand All @@ -64,6 +65,22 @@ public boolean executeUpdate(Document doc, String xpath, boolean forReal) {
System.out.println("Could not add solr node");
return false;
}
} else {
String solrComment = "\n"
+ " During the update Solr will be disabled in the WEB-INF/config/opencms-search.xml.\n"
+ " To update Solr you must update the 'schema.xml and' the 'solrconfig.xml' manually.\n"
+ " The new default configuration files are located in the solr-update/ directory in\n"
+ " the WEB-INF folder of your application. If you are using the default configuration\n"
+ " from the distribution, it is sufficient to copy the new configuration files to the\n"
+ " WEB-INF/solr folder. Else if you have customized the Solr configuration you might\n"
+ " want to merge the 'schema.xml' and the 'solrconfig.xml' first. When you are done\n"
+ " set the attribute enabled to 'true' again.\n";
Element solrElement = (Element)node.selectSingleNode("solr");
Attribute a = solrElement.attribute("enabled");
if (a != null) {
a.setValue("false");
}
solrElement.addComment(solrComment);
}
return true;
}
Expand Down
15 changes: 14 additions & 1 deletion webapp/update/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,20 @@ The wizard will finish similar to the setup wizard. After the final confirmation
the wizard will be locked again (in the opencms.properties file).


6. Shutdown and restart your OpenCms servlet container

6. Update Solr configuration

During the update Solr will be disabled in the WEB-INF/config/opencms-search.xml.
To update Solr you must update the 'schema.xml and' the 'solrconfig.xml' manually.
The new default configuration files are located in the solr-update/ directory in
the WEB-INF folder of your application. If you are using the default configuration
from the distribution, it is sufficient to copy the new configuration files to the
WEB-INF/solr folder. Else if you have customized the Solr configuration you might
want to merge the 'schema.xml' and the 'solrconfig.xml' first. When you are done
set the attribute enabled to 'true' again (and restart the servelt container).


7. Shutdown and restart your OpenCms servlet container

Note: to be sure all jsp files work correctly please delete the servlet containers
work directory (ie. ${TOMCAT_HOME}/work/Catalina/localhost/opencms/) and the
Expand Down

0 comments on commit fb31931

Please sign in to comment.