Skip to content

Commit

Permalink
use lucene-solr checkout (solariumphp#835)
Browse files Browse the repository at this point in the history
use lucene-solr checkout as source for XML files to upload and to be able to patch/extend solrconfig.xml of the techproducts example according to our needs.
  • Loading branch information
Markus Kalkbrenner authored Aug 20, 2020
1 parent 5e1c6e2 commit 0c385b7
Show file tree
Hide file tree
Showing 24 changed files with 64 additions and 705 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,28 @@ jobs:
- name: Checkout solarium
uses: actions/checkout@v2

- name: Checkout solr 7.7
if: matrix.solr == 7
uses: actions/checkout@v2
with:
repository: apache/lucene-solr
ref: branch_7_7
path: lucene-solr

- name: Checkout solr 8.5
if: matrix.solr == 8
uses: actions/checkout@v2
with:
repository: apache/lucene-solr
ref: branch_8_5
path: lucene-solr

- name: Start Solr ${{ matrix.solr }} in ${{ matrix.mode }} mode
run: |
cd tests/Integration/Fixtures/docker/solr${{ matrix.solr }}_${{ matrix.mode }}
chmod -R a+w lucene-solr
cd lucene-solr
patch -p1 < ../tests/Integration/Fixtures/solrconf.patch
cd ../tests/Integration/Fixtures/docker/solr${{ matrix.solr }}_${{ matrix.mode }}
docker-compose up -d
- name: Install dependencies
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/build
/composer.lock
/lucene-solr
/vendor
.idea
/.phpunit.result.cache
Expand Down
8 changes: 7 additions & 1 deletion examples/execute_all.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@
$client->execute($query);

// index techproducts sample data
foreach (glob(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'tests'.DIRECTORY_SEPARATOR.'Integration'.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'techproducts'.DIRECTORY_SEPARATOR.'*.xml') as $file) {
$dataDir = __DIR__.
DIRECTORY_SEPARATOR.'..'.
DIRECTORY_SEPARATOR.'lucene-solr'.
DIRECTORY_SEPARATOR.'solr'.
DIRECTORY_SEPARATOR.'example'.
DIRECTORY_SEPARATOR.'exampledocs';
foreach (glob($dataDir.DIRECTORY_SEPARATOR.'*.xml') as $file) {
$update = $client->createUpdate();

if (null !== $encoding = Utility::getXmlEncoding($file)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/AbstractServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected static function createTechproducts(): void
// create core with unique name using the techproducts configset
$createAction = $coreAdminQuery->createCreate();
$createAction->setCore(self::$name)
->setConfigSet('sample_techproducts_configs');
->setConfigSet('solarium');
$coreAdminQuery->setAction($createAction);
$response = self::$client->coreAdmin($coreAdminQuery);
static::assertTrue($response->getWasSuccessful());
Expand Down
9 changes: 8 additions & 1 deletion tests/Integration/AbstractTechproductsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,14 @@ public static function setUpBeforeClass(): void

try {
// index techproducts sample data
foreach (glob(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'techproducts'.DIRECTORY_SEPARATOR.'*.xml') as $file) {
$dataDir = __DIR__.
DIRECTORY_SEPARATOR.'..'.
DIRECTORY_SEPARATOR.'..'.
DIRECTORY_SEPARATOR.'lucene-solr'.
DIRECTORY_SEPARATOR.'solr'.
DIRECTORY_SEPARATOR.'example'.
DIRECTORY_SEPARATOR.'exampledocs';
foreach (glob($dataDir.DIRECTORY_SEPARATOR.'*.xml') as $file) {
$update = self::$client->createUpdate();

if (null !== $encoding = Utility::getXmlEncoding($file)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ services:
image: solr:7
ports:
- "8983:8983"
command: bash -c "docker-entrypoint.sh solr start -c; solr zk upconfig -z localhost:9983 -n techproducts -d server/solr/configsets/sample_techproducts_configs/conf; mkdir /opt/solr/server/solr/data2; cp /opt/solr/server/solr/solr.xml /opt/solr/server/solr/data2; solr start -c -s /opt/solr/server/solr/data2 -p 8987 -z localhost:9983 -f"
volumes:
- ../../../../../lucene-solr/solr/server/solr/configsets/sample_techproducts_configs/conf:/opt/solr/server/solr/configsets/solarium/conf
command: bash -c "docker-entrypoint.sh solr start -c; solr zk upconfig -z localhost:9983 -n techproducts -d server/solr/configsets/solarium/conf; mkdir /opt/solr/server/solr/data2; cp /opt/solr/server/solr/solr.xml /opt/solr/server/solr/data2; solr start -c -s /opt/solr/server/solr/data2 -p 8987 -z localhost:9983 -f"
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ services:
image: solr:7
ports:
- "8983:8983"
command: bash -c "cp -R /opt/solr/server/solr/configsets /var/solr/data/configsets; docker-entrypoint.sh solr start -f"
volumes:
- ../../../../../lucene-solr/solr/server/solr/configsets/sample_techproducts_configs/conf:/opt/solr/server/solr/configsets/solarium/conf
command: bash -c "chown -R solr.solr /opt/solr/server/solr/configsets/solarium; cp -R /opt/solr/server/solr/configsets /var/solr/data/configsets; docker-entrypoint.sh solr start -f"
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
version: '3'
services:
solr8:
image: solr:8
image: solr:8.5
ports:
- "8983:8983"
command: bash -c "docker-entrypoint.sh solr start -c; solr zk upconfig -z localhost:9983 -n techproducts -d server/solr/configsets/sample_techproducts_configs/conf; mkdir /var/solr/data2; cp /var/solr/data/solr.xml /var/solr/data2/; solr start -c -s /var/solr/data2 -p 8987 -z localhost:9983 -f"
volumes:
- ../../../../../lucene-solr/solr/server/solr/configsets/sample_techproducts_configs/conf:/opt/solr/server/solr/configsets/solarium/conf
command: bash -c "docker-entrypoint.sh solr start -c; solr zk upconfig -z localhost:9983 -n techproducts -d server/solr/configsets/solarium/conf; mkdir /var/solr/data2; cp /var/solr/data/solr.xml /var/solr/data2/; solr start -c -s /var/solr/data2 -p 8987 -z localhost:9983 -f"
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
version: '3'
services:
solr8:
image: solr:8
image: solr:8.5
ports:
- "8983:8983"
command: bash -c "cp -R /opt/solr/server/solr/configsets /var/solr/data/configsets; docker-entrypoint.sh solr start -f"
volumes:
- ../../../../../lucene-solr/solr/server/solr/configsets/sample_techproducts_configs/conf:/opt/solr/server/solr/configsets/solarium/conf
command: bash -c "chown -R solr.solr /opt/solr/server/solr/configsets/solarium; cp -R /opt/solr/server/solr/configsets /var/solr/data/configsets; docker-entrypoint.sh solr start -f"
13 changes: 13 additions & 0 deletions tests/Integration/Fixtures/solrconf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml b/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
index 59f5eb7b448..c9ffe37a4bb 100644
--- a/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
+++ b/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
@@ -86,6 +86,8 @@
<lib dir="${solr.install.dir:../../../..}/contrib/velocity/lib" regex=".*\.jar" />
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-velocity-\d.*\.jar" />

+ <lib dir="${solr.install.dir:../../../..}/dist"/>
+
<!-- an exact 'path' can be used instead of a 'dir' to specify a
specific jar file. This will cause a serious error to be logged
if it can't be loaded.
32 changes: 0 additions & 32 deletions tests/Integration/Fixtures/techproducts/gb18030-example.xml

This file was deleted.

56 changes: 0 additions & 56 deletions tests/Integration/Fixtures/techproducts/hd.xml

This file was deleted.

60 changes: 0 additions & 60 deletions tests/Integration/Fixtures/techproducts/ipod_other.xml

This file was deleted.

40 changes: 0 additions & 40 deletions tests/Integration/Fixtures/techproducts/ipod_video.xml

This file was deleted.

75 changes: 0 additions & 75 deletions tests/Integration/Fixtures/techproducts/manufacturers.xml

This file was deleted.

Loading

0 comments on commit 0c385b7

Please sign in to comment.