Skip to content

Commit a0a14df

Browse files
Solr 9.9 → 9.10 for integrations tests (#1165)
1 parent efe89c0 commit a0a14df

File tree

8 files changed

+49
-5
lines changed

8 files changed

+49
-5
lines changed

.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.9
54+
- name: Checkout solr 9.10
5555
if: matrix.solr == 9
5656
uses: actions/checkout@v4
5757
with:
5858
repository: apache/solr
59-
ref: branch_9_9
59+
ref: branch_9_10
6060
path: lucene-solr
6161

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

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [7.0.0]
8+
### Added
9+
- Solarium\QueryType\Extract\Query::setStreamType()
10+
811
### Changed
912
- Added `void` return type to `Solarium\Core\Plugin\PluginInterface::initPlugin()` method signature
1013
- Added `void` return type to `Solarium\Core\Plugin\PluginInterface::deinitPlugin()` method signature

docs/queries/extract-query.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ See the example code below.
1515
| omitheader | boolean | true | Disable Solr headers (saves some overhead, as the values aren't actually used in most cases) |
1616
| extractonly | boolean | false | If true, returns the extracted content from Tika without indexing the document |
1717
| extractformat | string | null | Controls the serialization format of the extracted content. By default 'xml', the other option is 'text'. Only valid if 'extractonly' is true |
18+
| stream.type | string | null | Explicitly specify a MIME type for Tika |
1819
||
1920

2021
Executing an extract query

src/QueryType/Extract/Query.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,30 @@ public function getFile()
145145
return $this->getOption('file');
146146
}
147147

148+
/**
149+
* Set an explicit MIME type for Tika.
150+
*
151+
* @param string $type
152+
*
153+
* @return self Provides fluent interface
154+
*/
155+
public function setStreamType(string $type): self
156+
{
157+
$this->setOption('stream.type', $type);
158+
159+
return $this;
160+
}
161+
162+
/**
163+
* Get the explicit MIME type for Tika.
164+
*
165+
* @return string|null
166+
*/
167+
public function getStreamType(): ?string
168+
{
169+
return $this->getOption('stream.type');
170+
}
171+
148172
/**
149173
* Set the prefix for fields that are not defined in the schema.
150174
*

src/QueryType/Extract/RequestBuilder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function build(QueryInterface|Query $query): Request
4141
$request->addParam('defaultField', $query->getDefaultField());
4242
$request->addParam('extractOnly', $query->getExtractOnly());
4343
$request->addParam('extractFormat', $query->getExtractFormat());
44+
$request->addParam('stream.type', $query->getStreamType());
4445

4546
foreach ($query->getFieldMappings() as $fromField => $toField) {
4647
$request->addParam('fmap.'.$fromField, $toField);

tests/Integration/AbstractTechproductsTestCase.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4522,18 +4522,15 @@ public function testExtractIntoDocument(bool $usePostBigExtractRequestPlugin): v
45224522

45234523
/** @var Document $document */
45244524
$document = $iterator->current();
4525-
$this->assertSame('application/pdf', $document['content_type'][0], 'Written document does not contain extracted content type');
45264525
$this->assertSame('PDF Test', trim($document['content'][0]), 'Written document does not contain extracted result');
45274526
$this->assertSame(['bar 1'], $document['attr_foo_1']);
45284527
$iterator->next();
45294528
$document = $iterator->current();
4530-
$this->assertSame('text/html; charset=UTF-8', $document['content_type'][0], 'Written document does not contain extracted content type');
45314529
$this->assertSame('HTML Test Title', $document['title'][0], 'Written document does not contain extracted title');
45324530
$this->assertMatchesRegularExpression('/^HTML Test Title\s+HTML Test Body$/', trim($document['content'][0]), 'Written document does not contain extracted result');
45334531
$this->assertSame(['bar 2'], $document['attr_foo_2']);
45344532
$iterator->next();
45354533
$document = $iterator->current();
4536-
$this->assertSame('text/html; charset=UTF-8', $document['content_type'][0], 'Written document does not contain extracted content type');
45374534
$this->assertSame('HTML Stream Title', $document['title'][0], 'Written document does not contain extracted title');
45384535
$this->assertMatchesRegularExpression('/^HTML Stream Title\s+HTML Stream Body$/', trim($document['content'][0]), 'Written document does not contain extracted result');
45394536
$this->assertSame(['bar 3'], $document['attr_foo_3']);

tests/QueryType/Extract/QueryTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ public function testSetAndGetFileResource(): void
8282
fclose($file);
8383
}
8484

85+
public function testSetAndGetStreamType(): void
86+
{
87+
$this->query->setStreamType('application/x-test');
88+
$this->assertSame('application/x-test', $this->query->getStreamType());
89+
}
90+
8591
public function testSetAndGetUprefix(): void
8692
{
8793
$this->query->setUprefix('dyn_');

tests/QueryType/Extract/RequestBuilderTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,18 @@ public function testGetUri(): void
127127
);
128128
}
129129

130+
public function testGetUriWithStreamType(): void
131+
{
132+
$query = $this->query;
133+
$query->setStreamType('application/x-test');
134+
$request = $this->builder->build($query);
135+
$this->assertSame(
136+
'update/extract?omitHeader=true&param1=value1&wt=json&json.nl=flat&extractOnly=false&stream.type=application%2Fx-test&fmap.from-field=to-field'.
137+
'&resource.name=RequestBuilderTest.php',
138+
$request->getUri()
139+
);
140+
}
141+
130142
public function testGetUriWithExtractFormat(): void
131143
{
132144
$query = $this->query;

0 commit comments

Comments
 (0)