diff --git a/api/v1/database/mastodon/accounts/search/mod.php b/api/v1/database/mastodon/accounts/search/mod.php index c5a6d7d..d882b26 100644 --- a/api/v1/database/mastodon/accounts/search/mod.php +++ b/api/v1/database/mastodon/accounts/search/mod.php @@ -189,7 +189,7 @@ if (isset($_GET['profile']) && trim($_GET['profile']) != '') if (gettype($a_fields) === 'array') foreach ($a_fields as $field) $fields .= $field['name'].' '.$field['value'].' '; - $a_note = trim($fields) . $a_note; + $a_note = trim(trim($fields) . ' ' . $a_note); if ($qt === 'empty') { if ($a_note === '') { @@ -202,6 +202,8 @@ if (isset($_GET['profile']) && trim($_GET['profile']) != '') continue; $matches = false; + $debug_search = (isset($_GET['debug_search']) && $account['id'] === trim($_GET['debug_search'])); + if ($enable_caching && isset($match_data[$account['id']])) { $matches = $match_data[$account['id']]; } else if ($qt === 'simple') { @@ -221,7 +223,7 @@ if (isset($_GET['profile']) && trim($_GET['profile']) != '') } } } else if ($qt === 'expr') - $matches = matches_comparing_expression($q, $a_note); + $matches = matches_comparing_expression($q, $a_note, $debug_search); if ($user_filter === 'remote' && $enable_caching) $match_data[$account['id']] = $matches; diff --git a/base.php b/base.php index 9723a8b..f7ee360 100644 --- a/base.php +++ b/base.php @@ -453,11 +453,20 @@ function parse_comparing_expression($expr) { ]; } -function matches_comparing_expression($expr, $text) { +function matches_comparing_expression($expr, $text, $debug=false) { if (gettype($expr) === 'string') $expr = parse_comparing_expression($expr); $result = $expr['original']; + if ($debug) { + echo '
'.$text.''; + } $text = normalize_for_search($text); + if ($debug) { + echo '
'.$text.''; + echo '
'; + echo $content; + echo ''; + echo '
'; + echo $content; + echo ''; + echo '
'; + echo $content; + echo ''; + } $bool = strpos($a, $b) !== false; + if ($debug) { + echo '
'; + echo $content; + echo ''; + } $bool = preg_match('#'.$content.'#', $text) === 1; + if ($debug) { + echo '