diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a629d62..27e89942 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ## Adminer dev +- Allow specifying operator in search anywhere ## Adminer 5.3.0 (released 2025-05-04) - Align numeric functions right diff --git a/adminer/db.inc.php b/adminer/db.inc.php index f7aabd46..ecc02dd4 100644 --- a/adminer/db.inc.php +++ b/adminer/db.inc.php @@ -64,12 +64,13 @@ if (adminer()->homepage()) { echo "
\n"; if (support("table")) { echo "
" . lang('Search data in tables') . "
"; - echo ""; + echo html_select("op", adminer()->operators(), idx($_POST, "op", JUSH == "elastic" ? "should" : "LIKE %%")); + echo " "; echo script("qsl('input').onkeydown = partialArg(bodyKeydown, 'search');", ""); echo " \n"; echo "
\n"; if ($_POST["search"] && $_POST["query"] != "") { - $_GET["where"][0]["op"] = driver()->convertOperator("LIKE %%"); + $_GET["where"][0]["op"] = $_POST["op"]; search_tables(); } } diff --git a/adminer/include/driver.inc.php b/adminer/include/driver.inc.php index 8cf3b3db..5568839a 100644 --- a/adminer/include/driver.inc.php +++ b/adminer/include/driver.inc.php @@ -189,11 +189,6 @@ abstract class SqlDriver { return $idf; } - /** Convert operator so it can be used in search */ - function convertOperator(string $operator): string { - return $operator; - } - /** Convert value returned by database to actual value * @param Field $field */ diff --git a/plugins/drivers/elastic.php b/plugins/drivers/elastic.php index 0551b965..e07a2a82 100644 --- a/plugins/drivers/elastic.php +++ b/plugins/drivers/elastic.php @@ -287,10 +287,6 @@ if (isset($_GET["elastic"])) { return !!$this->conn->affected_rows; } - - function convertOperator($operator): string { - return $operator == "LIKE %%" ? "should" : $operator; - } } function support($feature) {