Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:craftcms/cms into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Feb 14, 2019
2 parents dfb9c8a + 1b68fe5 commit fb8e087
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixed
- Fixed a bug where the `relatedTo` element query param could include results for elements that were related via soft-deleted Matrix blocks. ([#3846](https://github.com/craftcms/cms/issues/3846))
- Fixed a bug where some edge case search queries would not match on MySQL servers.

## 3.1.11 - 2019-02-14

Expand Down
12 changes: 11 additions & 1 deletion src/services/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,17 @@ private function _getSqlFromTerm(SearchQueryTerm $term, int $siteId = null): arr

// Add quotes for exact match
if ($isMysql && StringHelper::contains($keywords, ' ')) {
$keywords = '"' . $keywords . '"';
if (StringHelper::first($keywords, 1) === '*') {
$keywords = StringHelper::insert($keywords, '"', 1);
} else {
$keywords = '"' . $keywords;
}

if (StringHelper::last($keywords, 1) === '*') {
$keywords = StringHelper::insert($keywords, '"', StringHelper::length($keywords) - 1);
} else {
$keywords .= '"';
}
}

// Determine prefix for the full-text keyword
Expand Down

0 comments on commit fb8e087

Please sign in to comment.