This is a specific setup for use with periodic MySQL import, but can be used as a general solution by excluding the irrelevant parts.
Code | Description |
---|---|
<SOLR> |
E.g.: /var/lib/tomcat#/solr , /etc/solr , ... |
<CORE> |
Core name |
<INSTANCE_DIR> |
Generally the same as <CORE> |
<URL> |
E.g. http://example.com:8080/solr |
<SOURCE> |
Project source, e.g. /home/<USER>/project/ |
- The ordering of the operations is important.
-
Copy data import, MySQL etc jar's (e.g. solr3.6_jars.tar.gz for Solr 3.6) into lib folder (e.g.
/var/lib/tomcat#/webapps/solr/WEB-INF/lib/
) -
Set up Tomcat Utf-8 URI’s if required (add
URIEncoding="UTF-8"
to<Connector...
s in/etc/tomcat#/server.xml
) -
service tomcat# restart
-
mkdir <SOLR>/<CORE>
-
cp -r example/conf <CORE>/
-
mkdir <SOLR>/<CORE>/data
chown tomcat: <SOLR>/<CORE>/data
-
[OPTIONAL] Symlinking - If conf comes with the project repository and the project exists in the same host:
sh Link_solr_conf.sh <SOURCE>/solr/conf <SOLR>/<CORE>/conf
Get Link_solr_conf.sh here
Notes if used:
chmod a+x
all folder levels in the source, e.g.
chmod a+x /home/user /home/user/project ...
(Link_solr_conf.sh prompts for this)- Modify database credentials in
<SOLR>/<CORE>/conf/db-connection.xml
-
[OPTIONAL] Last import info - If delta import will be used
touch <SOLR>/<CORE>/conf/dataimport.properties
chown tomcat: <SOLR>/<CORE>/conf/dataimport.properties
-
<URL>/admin/cores?action=CREATE&name=<CORE>&instanceDir=<INSTANCE_DIR>
-
In
<SOLR>/solr.xml
, ifpersistent=false
, add the new core
<URL>/admin/cores?action=RELOAD&core=<CORE>
<URL>/<CORE>/dataimport?command=reload-config
<URL>/<CORE>/dataimport?command=full-import
<URL>/<CORE>/dataimport?command=full-import&entity=<ENTITY_NAME>
<URL>/<CORE>/select?q=*:*&wt=json&json.nl=map&start=0&rows=10
&facet.query={!key=date-last30 ex=date}date:[NOW/DAY-30DAY TO NOW/DAY+1DAY]
Multiple LocalParams
&facet.field={!ex=city,county}city
"The choice of Java constructor replace matching JavaScript argument types (function,string) is ambiguous; candidate constructors are:..."
See: http://www.mirthcorp.com/community/forums/showthread.php?t=235
In short, change
`row.get("etc").replace(/.../, ...)`
to:
`new String(row.get("etc")).replace(/.../, ...)`