Skip to content

Commit 46fabfc

Browse files
Solr 9.0 → 9.1 for integration tests (#1043)
Co-authored-by: Markus Kalkbrenner <git@kalki.de>
1 parent 713991d commit 46fabfc

4 files changed

Lines changed: 43 additions & 6 deletions

File tree

.github/workflows/run-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ jobs:
5151
ref: branch_8_11
5252
path: lucene-solr
5353

54-
- name: Checkout solr 9.0
54+
- name: Checkout solr 9.1
5555
if: matrix.solr == 9
5656
uses: actions/checkout@v2
5757
with:
5858
repository: apache/solr
59-
ref: branch_9_0
59+
ref: branch_9_1
6060
path: lucene-solr
6161

6262
- name: Start Solr ${{ matrix.solr }} in ${{ matrix.mode }} mode

examples/execute_all.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
use Solarium\Core\Client\Request;
4+
use Solarium\Exception\HttpException;
45
use Solarium\Support\Utility;
56

67
try {
@@ -89,6 +90,31 @@
8990
}
9091
}
9192

93+
// check if attr_* dynamic field definition exists (it was removed from the techproducts configset in Solr 9.1)
94+
try {
95+
$query = $client->createApi([
96+
'version' => Request::API_V1,
97+
'handler' => $collection_or_core_name.'/schema/dynamicfields/'.rawurlencode('attr_*'),
98+
]);
99+
$response = $client->execute($query);
100+
} catch (HttpException $e) {
101+
$query = $client->createApi([
102+
'version' => Request::API_V1,
103+
'handler' => $collection_or_core_name.'/schema',
104+
'method' => Request::METHOD_POST,
105+
'rawdata' => json_encode([
106+
'add-dynamic-field' => [
107+
'name' => 'attr_*',
108+
'type' => 'text_general',
109+
'indexed' => true,
110+
'stored' => true,
111+
'multiValued' => true,
112+
],
113+
]),
114+
]);
115+
$client->execute($query);
116+
}
117+
92118
// disable automatic commits for update examples
93119
$query = $client->createApi([
94120
'version' => Request::API_V1,

tests/Integration/AbstractTechproductsTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3782,6 +3782,7 @@ public function testExtractIntoDocument(bool $usePostBigExtractRequestPlugin)
37823782
$doc = $extract->createDocument();
37833783
$doc->id = 'extract-test-1-pdf';
37843784
$doc->cat = ['extract-test'];
3785+
$doc->foo_1 = 'bar 1';
37853786
$extract->setDocument($doc);
37863787
self::$client->extract($extract);
37873788

@@ -3790,6 +3791,7 @@ public function testExtractIntoDocument(bool $usePostBigExtractRequestPlugin)
37903791
$doc = $extract->createDocument();
37913792
$doc->id = 'extract-test-2-html';
37923793
$doc->cat = ['extract-test'];
3794+
$doc->foo_2 = 'bar 2';
37933795
$extract->setDocument($doc);
37943796
self::$client->extract($extract);
37953797

@@ -3805,11 +3807,13 @@ public function testExtractIntoDocument(bool $usePostBigExtractRequestPlugin)
38053807
$document = $iterator->current();
38063808
$this->assertSame('application/pdf', $document['content_type'][0], 'Written document does not contain extracted content type');
38073809
$this->assertSame('PDF Test', trim($document['content'][0]), 'Written document does not contain extracted result');
3810+
$this->assertSame(['bar 1'], $document['attr_foo_1']);
38083811
$iterator->next();
38093812
$document = $iterator->current();
38103813
$this->assertSame('text/html; charset=UTF-8', $document['content_type'][0], 'Written document does not contain extracted content type');
38113814
$this->assertSame('HTML Test Title', $document['title'][0], 'Written document does not contain extracted title');
38123815
$this->assertMatchesRegularExpression('/^HTML Test Title\s+HTML Test Body$/', trim($document['content'][0]), 'Written document does not contain extracted result');
3816+
$this->assertSame(['bar 2'], $document['attr_foo_2']);
38133817

38143818
// now cleanup the documents to have the initial index state
38153819
$update = self::$client->createUpdate();
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
diff --git a/solr/server/solr/configsets/sample_techproducts_configs/conf/managed-schema b/solr/server/solr/configsets/sample_techproducts_configs/conf/managed-schema
2-
index aad0c822f34..d0b272c39c2 100644
3-
--- a/solr/server/solr/configsets/sample_techproducts_configs/conf/managed-schema
4-
+++ b/solr/server/solr/configsets/sample_techproducts_configs/conf/managed-schema
1+
diff --git a/solr/server/solr/configsets/sample_techproducts_configs/conf/managed-schema.xml b/solr/server/solr/configsets/sample_techproducts_configs/conf/managed-schema.xml
2+
index 190214aebad..7a76a28276a 100644
3+
--- a/solr/server/solr/configsets/sample_techproducts_configs/conf/managed-schema.xml
4+
+++ b/solr/server/solr/configsets/sample_techproducts_configs/conf/managed-schema.xml
55
@@ -118,7 +118,9 @@
66
<!-- points to the root document of a block of nested documents. Required for nested
77
document support, may be removed otherwise
@@ -13,3 +13,10 @@ index aad0c822f34..d0b272c39c2 100644
1313

1414
<!-- Only remove the "id" field if you have a very good reason to. While not strictly
1515
required, it is highly recommended. A <uniqueKey> is present in almost all Solr
16+
@@ -218,6 +220,7 @@
17+
18+
<dynamicField name="random_*" type="random"/>
19+
<dynamicField name="ignored_*" type="ignored"/>
20+
+ <dynamicField name="attr_*" type="text_general" indexed="true" stored="true" multiValued="true"/>
21+
22+
<dynamicField name="*_c" type="currency" indexed="true" stored="true"/>

0 commit comments

Comments
 (0)