use Friendica\Content\Widget\ContactBlock;
use Friendica\Core\Hook;
use Friendica\Core\Renderer;
+use Friendica\Core\Search;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Util\Network;
'$save_label' => $save_label,
'$search_hint' => DI::l10n()->t('@name, !forum, #tags, content'),
'$mode' => $mode,
- '$return_url' => urlencode('search?q=' . urlencode($s)),
+ '$return_url' => urlencode(Search::getSearchPath($s)),
];
if (!$aside) {
namespace Friendica\Content\Widget;
use Friendica\Core\Renderer;
+use Friendica\Core\Search;
use Friendica\Database\DBA;
use Friendica\DI;
'id' => $saved_search['id'],
'term' => $saved_search['term'],
'encodedterm' => urlencode($saved_search['term']),
+ 'searchpath' => Search::getSearchPath($saved_search['term']),
'delete' => DI::l10n()->t('Remove term'),
'selected' => $search == $saved_search['term'],
];
{
return DI::config()->get('system', 'directory', self::DEFAULT_DIRECTORY);
}
+
+ /**
+ * Return the search path (either fulltext search or tag search)
+ *
+ * @param string $search
+ * @return string search path
+ */
+ public static function getSearchPath(string $search)
+ {
+ if (substr($search, 0, 1) == '#') {
+ return 'search?tag=' . urlencode(substr($search, 1));
+ } else {
+ return 'search?q=' . urlencode($search);
+ }
+ }
}
use Friendica\Core\Cache\Duration;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
+use Friendica\Core\Search;
use Friendica\Core\Session;
use Friendica\Database\DBA;
use Friendica\DI;
}
if (local_user()) {
- DI::page()['aside'] .= Widget\SavedSearches::getHTML('search?q=' . urlencode($search), $search);
+ DI::page()['aside'] .= Widget\SavedSearches::getHTML(Search::getSearchPath($search), $search);
}
Nav::setSelected('search');
namespace Friendica\Module\Search;
use Friendica\BaseModule;
+use Friendica\Core\Search;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Util\Strings;
$action = DI::args()->get(2, 'none');
$search = Strings::escapeTags(trim(rawurldecode($_GET['term'] ?? '')));
- $return_url = $_GET['return_url'] ?? 'search?q=' . urlencode($search);
+ $return_url = $_GET['return_url'] ?? Search::getSearchPath($search);
if (local_user() && $search) {
switch ($action) {
{{foreach $saved as $search}}
<li role="menuitem" class="saved-search-li clear">
<a href="search/saved/remove?term={{$search.encodedterm}}&return_url={{$return_url}}" title="{{$search.delete}}" onclick="return confirmDelete();" id="drop-saved-search-term-{{$search.id}}" class="iconspacer savedsearchdrop"></a>
- <a href="search?q={{$search.encodedterm}}" id="saved-search-term-{{$search.id}}" class="savedsearchterm">{{$search.term}}</a>
+ <a href="{{$search.searchpath}}" id="saved-search-term-{{$search.id}}" class="savedsearchterm">{{$search.term}}</a>
</li>
{{/foreach}}
</ul>
<a href="search/saved/remove?term={{$search.encodedterm}}&return_url={{$return_url}}" title="{{$search.delete}}" onclick="return confirmDelete();" id="drop-saved-search-term-{{$search.id}}" class="savedsearchdrop pull-right widget-action faded-icon">
<i class="fa fa-trash" aria-hidden="true"></i>
</a>
- <a href="search?q={{$search.encodedterm}}" id="saved-search-term-{{$search.id}}" class="savedsearchterm">{{$search.term}}</a>
+ <a href="{{$search.searchpath}}" id="saved-search-term-{{$search.id}}" class="savedsearchterm">{{$search.term}}</a>
</li>
{{/foreach}}
</ul>
<ul id="saved-search-ul">
{{foreach $saved as $search}}
<li class="tool {{if $search.selected}}selected{{/if}}">
- <a href="search?q={{$search.encodedterm}}" class="label">{{$search.term}}</a>
+ <a href="{{$search.searchpath}}" class="label">{{$search.term}}</a>
<a href="search/saved/remove?term={{$search.encodedterm}}&return_url={{$return_url}}" class="action icon s10 delete" title="{{$search.delete}}" onclick="return confirmDelete();"></a>
</li>
{{/foreach}}