diff --git a/assets/js/vue/components/search/SearchForm.vue b/assets/js/vue/components/search/SearchForm.vue index e19b40b4c1..e07b2527a2 100644 --- a/assets/js/vue/components/search/SearchForm.vue +++ b/assets/js/vue/components/search/SearchForm.vue @@ -150,6 +150,8 @@ export default { onStartDateChanged(event) { if (event.value instanceof Date) { this.form.collectionStartDate = event.value.toLocaleDateString(); + } else if (event.value) { + this.form.collectionStartDate = event.value; } else { this.form.collectionStartDate = ''; } @@ -157,6 +159,8 @@ export default { onEndDateChanged(event) { if (event.value instanceof Date) { this.form.collectionEndDate = event.value.toLocaleDateString(); + } else if (event.value) { + this.form.collectionEndDate = event.value; } else { this.form.collectionEndDate = ''; } diff --git a/composer.lock b/composer.lock index 5a69ab7e93..14d056d804 100644 --- a/composer.lock +++ b/composer.lock @@ -2534,24 +2534,24 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.5.7", + "version": "6.5.8", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "724562fa861e21a4071c652c8a159934e4f05592" + "reference": "a52f0440530b54fa079ce76e8c5d196a42cad981" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/724562fa861e21a4071c652c8a159934e4f05592", - "reference": "724562fa861e21a4071c652c8a159934e4f05592", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/a52f0440530b54fa079ce76e8c5d196a42cad981", + "reference": "a52f0440530b54fa079ce76e8c5d196a42cad981", "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.6.1", + "guzzlehttp/psr7": "^1.9", "php": ">=5.5", - "symfony/polyfill-intl-idn": "^1.17.0" + "symfony/polyfill-intl-idn": "^1.17" }, "require-dev": { "ext-curl": "*", @@ -2629,7 +2629,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/6.5.7" + "source": "https://github.com/guzzle/guzzle/tree/6.5.8" }, "funding": [ { @@ -2645,7 +2645,7 @@ "type": "tidelift" } ], - "time": "2022-06-09T21:36:50+00:00" + "time": "2022-06-20T22:16:07+00:00" }, { "name": "guzzlehttp/promises", @@ -2733,16 +2733,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.8.5", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268" + "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/337e3ad8e5716c15f9657bd214d16cc5e69df268", - "reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", + "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", "shasum": "" }, "require": { @@ -2763,7 +2763,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -2823,7 +2823,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.8.5" + "source": "https://github.com/guzzle/psr7/tree/1.9.0" }, "funding": [ { @@ -2839,7 +2839,7 @@ "type": "tidelift" } ], - "time": "2022-03-20T21:51:18+00:00" + "time": "2022-06-20T21:43:03+00:00" }, { "name": "hylianshield/alphabet", diff --git a/src/Util/Search.php b/src/Util/Search.php index c3723681f6..392b6ea66f 100644 --- a/src/Util/Search.php +++ b/src/Util/Search.php @@ -547,8 +547,8 @@ private function getFieldsQuery(string $queryTerm, string $specificField = null, // Bool query to add all fields $fieldsBoolQuery = new Query\BoolQuery(); - $queryTerm = $this->doesDoiExistInQueryTerm($queryTerm, $fieldsBoolQuery); - $queryTerm = $this->doesUdiExistInQueryTerm($queryTerm, $fieldsBoolQuery); + $this->doesDoiExistInQueryTerm($queryTerm, $fieldsBoolQuery); + $this->doesUdiExistInQueryTerm($queryTerm, $fieldsBoolQuery); $simpleQuery = new Query\SimpleQueryString($queryTerm, $specificField); $simpleQuery->setParam('flags', 'PHRASE|PREFIX|WHITESPACE'); @@ -791,18 +791,17 @@ private function getCollectionEndDateQuery(array $collectionDates): Query\Range * @param string $queryTerm Query term that needs to be checked if DOI exists. * @param Query\BoolQuery $fieldsBoolQuery The fields elastic boolean query that DOI query is added to. * - * @return string + * @return void */ - private function doesDoiExistInQueryTerm(string $queryTerm, Query\BoolQuery $fieldsBoolQuery): string + private function doesDoiExistInQueryTerm(string $queryTerm, Query\BoolQuery $fieldsBoolQuery): void { $doiRegEx = '!\b(?:[Dd][Oo][Ii]\s*:\s*)?(10.\d{4,9}/[-._;()/:A-Z0-9a-z]+)\b!'; if (preg_match_all($doiRegEx, $queryTerm, $matches)) { - trim(preg_replace($doiRegEx, '', $queryTerm)); - $queryTerm = $matches[1][0]; - $fieldsBoolQuery->addShould($this->getDoiQuery($queryTerm)); - $fieldsBoolQuery->addShould($this->getPubDoiQuery($queryTerm)); + foreach ($matches[1] as $doi) { + $fieldsBoolQuery->addShould($this->getDoiQuery($doi)); + $fieldsBoolQuery->addShould($this->getPubDoiQuery($doi)); + } } - return $queryTerm; } /** @@ -863,19 +862,19 @@ private function getUdiQuery(string $queryTerm): Query\MatchPhrase * @param string $queryTerm Query term that needs to be checked if udi exists. * @param Query\BoolQuery $fieldsBoolQuery The fields elastic boolean query that udi query is added to. * - * @return string + * @return void */ - private function doesUdiExistInQueryTerm(string $queryTerm, Query\BoolQuery $fieldsBoolQuery): string + private function doesUdiExistInQueryTerm(string $queryTerm, Query\BoolQuery $fieldsBoolQuery): void { $udiRegEx = '/\b([A-Z\d]{2}\.x\d\d\d\.\d\d\d[:.]\d\d\d\d)\b/i'; if (preg_match_all($udiRegEx, $queryTerm, $matches)) { trim(preg_replace($udiRegEx, '', $queryTerm)); - $queryTerm = $matches[1][0]; - // Replacing the 11th position to ":" - $queryTerm = substr_replace($queryTerm, ':', 11, 1); - $fieldsBoolQuery->addShould($this->getUdiQuery($queryTerm)); + foreach ($matches[1] as $udi) { + // Replacing the 11th position to ":" + $udi = substr_replace($udi, ':', 11, 1); + $fieldsBoolQuery->addShould($this->getUdiQuery($udi)); + } } - return $queryTerm; } /**