-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
AutoPhing SOLR | ||
============== | ||
|
||
Run SOLR Api commands | ||
|
||
## Targets ## | ||
|
||
### solr-core-create ### | ||
Create a (new) core in SOLR based on source configuration in your project. It will move the config to the running | ||
solr instance. | ||
|
||
### solr-api-core-create ### | ||
Create a core configuration | ||
|
||
### solr-api-core-reload ### | ||
Reload a core configuration | ||
|
||
### solr-api-core-unload ### | ||
Remove a solr core | ||
|
||
## Configuration ## | ||
|
||
+ `solr.http.url` - The SOLR http location. Defaults to `http;//localhost:8983/solr/` | ||
+ `solr.config.source` - The SOLR config project location (source files) | ||
+ `solr.config.destination` - The SOLR config folder | ||
+ `solr.core.source` - The SOLR core source configuration | ||
+ `solr.core.name` - The SOLR core name | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
solr.http.url=http://localhost:8983/solr/ | ||
|
||
solr.config.root=${phing.dir} | ||
solr.config.destination=${phing.dir} | ||
|
||
solr.core.source=autophing-core | ||
solr.core.name=${solr.core.source} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project name="solr" default="solr-core-reload" basedir="."> | ||
<property file="${phing.dir.solr}/solr.properties" /> | ||
|
||
<target name="solr-core-create"> | ||
<available property="solr.core.available" file="${solr.config.destination}/${solr.core.name}" type="dir" /> | ||
|
||
<if> | ||
<equals arg1="${solr.core.available}" arg2="true" /> | ||
<then> | ||
<!-- Core already available. Only remove config and let it rebuild --> | ||
<if> | ||
<!-- It can be possible to have same source and destination. Don't remove --> | ||
<not><equals arg1="${solr.config.source}/${solr.core.source}" arg2="${solr.config.destination}/${solr.core.name}" /></not> | ||
<then> | ||
<delete> | ||
<fileset dir="${solr.config.destination}/${solr.core.name}"> | ||
<exclude name="data/**" /> | ||
</fileset> | ||
</delete> | ||
</then> | ||
</if> | ||
</then> | ||
</if> | ||
|
||
<!-- Copy the contents of the config to the core --> | ||
<copy todir="${solr.config.destination}/${solr.core.name}"> | ||
<fileset dir="${solr.config.source}/${solr.core.source}"> | ||
<exclude name="data/**" /> | ||
</fileset> | ||
</copy> | ||
|
||
<if> | ||
<equals arg1="${solr.core.available}" arg2="true" /> | ||
<then> | ||
<phingcall target="solr-api-core-reload" /> | ||
</then> | ||
<else> | ||
<phingcall target="solr-api-core-create" /> | ||
</else> | ||
</if> | ||
</target> | ||
|
||
<target name="solr-api-core-create"> | ||
<exec passthru="${passthru}" executable="curl" escape="true"> | ||
<arg line="-X" /> | ||
<arg value="GET" /> | ||
<arg value="${solr.http.url}admin/cores?action=CREATE&name=${solr.core.name}&instanceDir=${solr.core.name}&persist=true" /> | ||
</exec> | ||
</target> | ||
|
||
<target name="solr-api-core-reload"> | ||
<exec passthru="${passthru}" executable="curl" escape="true"> | ||
<arg line="-X" /> | ||
<arg value="GET" /> | ||
<arg value="${solr.http.url}admin/cores?action=RELOAD&core=${solr.core.name}" /> | ||
</exec> | ||
</target> | ||
|
||
<target name="solr-api-core-unload"> | ||
<exec passthru="${passthru}" executable="curl" escape="true"> | ||
<arg line="-X" /> | ||
<arg value="GET" /> | ||
<arg value="${solr.http.url}admin/cores?action=UNLOAD&core=${solr.core.name}" /> | ||
</exec> | ||
</target> | ||
</project> |