]> git.mxchange.org Git - friendica.git/commitdiff
Issue 9246: Don't perform fulltext searches on URL
authorMichael <heluecht@pirati.ca>
Sun, 20 Sep 2020 09:37:05 +0000 (09:37 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 20 Sep 2020 09:37:05 +0000 (09:37 +0000)
src/Module/Search/Index.php

index 80acd74b94dcc51e766238cd61bb57f244226e87..0cada373c630735188b6806d46b27d49e07b9616 100644 (file)
@@ -132,6 +132,14 @@ class Index extends BaseSearch
                        }
                }
 
+               // Don't perform a fulltext or tag search on fulltext or tag
+               // Tags don't look like an URL and the fulltext search does only work with natual words
+               if (parse_url($search, PHP_URL_SCHEME) && parse_url($search, PHP_URL_HOST)) {
+                       Logger::info('Skipping tag and fulltext search since the search looks like an URL.', ['q' => $search]);
+                       notice(DI::l10n()->t('No results.'));
+                       return $o;
+               }
+
                $tag = $tag || DI::config()->get('system', 'only_tag_search');
 
                // Here is the way permissions work in the search module...