MDL-74419 search_simpledb: Search with quotes not working on Oracle

Global search with quotes is not working on DB engines without
full-text search support (i.e. Oracle).
This commit is contained in:
Sara Arjona
2022-04-06 11:32:50 +02:00
parent ad6dc71c56
commit f2ff93b3bc
2 changed files with 21 additions and 2 deletions
+6 -2
View File
@@ -346,12 +346,16 @@ class engine extends \core_search\engine {
$DB->sql_like('description1', '?', false, false) . ' OR ' .
$DB->sql_like('description2', '?', false, false) .
')';
$params = array(
// Remove quotes from the query.
$q = str_replace('"', '', $q);
$params = [
'%' . $q . '%',
'%' . $q . '%',
'%' . $q . '%',
'%' . $q . '%'
);
];
return array($sql, $params);
}
+15
View File
@@ -44,6 +44,21 @@ Feature: Use global search interface
And I follow "ForumName1"
And I should see "ForumName1" in the ".breadcrumb" "css_element"
@javascript
Scenario: Search from search page with quotes
Given I search for "zombies" using the header global search box
And I should see "No results"
When I set the field "id_q" to "\"amphibians\""
# You cannot press "Search" because there's a fieldset with the same name that gets in the way.
And I press "id_submitbutton"
Then I should see "ForumName1"
And I should see "ForumDesc1"
And I should see "PageName1"
And I should see "PageDesc1"
# Check the link works.
And I follow "ForumName1"
And I should see "ForumName1" in the ".breadcrumb" "css_element"
@javascript
Scenario: Search starting from site context (no within option)
When I search for "frogs" using the header global search box